Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upgrade to 0.9.0 #213

Merged
merged 3 commits into from
Sep 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/rust.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
name: Download duckdb
with:
repository: "duckdb/duckdb"
tag: "v0.8.1"
tag: "v0.9.0"
fileName: ${{ matrix.duckdb }}
out-file-path: .

Expand Down
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "duckdb"
version = "0.8.1"
version = "0.9.0"
authors = ["wangfenjin <[email protected]>"]
edition = "2021"
description = "Ergonomic wrapper for DuckDB"
Expand Down Expand Up @@ -79,7 +79,7 @@ polars-core = "0.33.2"

[dependencies.libduckdb-sys]
path = "libduckdb-sys"
version = "0.8.1"
version = "0.9.0"

[package.metadata.docs.rs]
features = []
Expand Down
2 changes: 1 addition & 1 deletion libduckdb-sys/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "libduckdb-sys"
version = "0.8.1"
version = "0.9.0"
authors = ["wangfenjin <[email protected]>"]
edition = "2021"
build = "build.rs"
Expand Down
9 changes: 8 additions & 1 deletion libduckdb-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,10 @@ mod build_bundled {
) {
cpp_files.extend(manifest.extensions.get(extension).unwrap().cpp_files.clone());
include_dirs.extend(manifest.extensions.get(extension).unwrap().include_dirs.clone());
cfg.define(&format!("BUILD_{}_EXTENSION", extension.to_uppercase()), Some("1"));
cfg.define(
&format!("DUCKDB_EXTENSION_{}_LINKED", extension.to_uppercase()),
Some("1"),
);
}

fn untar_archive() {
Expand Down Expand Up @@ -131,6 +134,10 @@ mod build_bundled {
#[cfg(feature = "json")]
add_extension(&mut cfg, &manifest, "json", &mut cpp_files, &mut include_dirs);

// duckdb/tools/pythonpkg/setup.py
cfg.define("DUCKDB_EXTENSION_AUTOINSTALL_DEFAULT", "1");
cfg.define("DUCKDB_EXTENSION_AUTOLOAD_DEFAULT", "1");

// Since the manifest controls the set of files, we require it to be changed to know whether
// to rebuild the project
println!("cargo:rerun-if-changed={}/manifest.json", lib_name);
Expand Down
2 changes: 1 addition & 1 deletion libduckdb-sys/duckdb-sources
Submodule duckdb-sources updated 3204 files
Binary file modified libduckdb-sys/duckdb.tar.gz
Binary file not shown.
5 changes: 0 additions & 5 deletions libduckdb-sys/extras/httpfs_config.py

This file was deleted.

106 changes: 103 additions & 3 deletions libduckdb-sys/src/bindgen_bundled_version.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* automatically generated by rust-bindgen 0.66.0 */
/* automatically generated by rust-bindgen 0.68.1 */

#[repr(C)]
#[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
Expand Down Expand Up @@ -12075,6 +12075,37 @@ fn bindgen_test_layout__duckdb_arrow() {
pub type duckdb_arrow = *mut _duckdb_arrow;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct _duckdb_arrow_stream {
pub __arrwstr: *mut ::std::os::raw::c_void,
}
#[test]
fn bindgen_test_layout__duckdb_arrow_stream() {
const UNINIT: ::std::mem::MaybeUninit<_duckdb_arrow_stream> = ::std::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::std::mem::size_of::<_duckdb_arrow_stream>(),
8usize,
concat!("Size of: ", stringify!(_duckdb_arrow_stream))
);
assert_eq!(
::std::mem::align_of::<_duckdb_arrow_stream>(),
8usize,
concat!("Alignment of ", stringify!(_duckdb_arrow_stream))
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).__arrwstr) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(_duckdb_arrow_stream),
"::",
stringify!(__arrwstr)
)
);
}
pub type duckdb_arrow_stream = *mut _duckdb_arrow_stream;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct _duckdb_config {
pub __cnfg: *mut ::std::os::raw::c_void,
}
Expand Down Expand Up @@ -12291,6 +12322,7 @@ pub type duckdb_state = ::std::os::raw::c_uint;
pub const duckdb_pending_state_DUCKDB_PENDING_RESULT_READY: duckdb_pending_state = 0;
pub const duckdb_pending_state_DUCKDB_PENDING_RESULT_NOT_READY: duckdb_pending_state = 1;
pub const duckdb_pending_state_DUCKDB_PENDING_ERROR: duckdb_pending_state = 2;
pub const duckdb_pending_state_DUCKDB_PENDING_NO_TASKS_AVAILABLE: duckdb_pending_state = 3;
pub type duckdb_pending_state = ::std::os::raw::c_uint;
extern "C" {
#[doc = "Creates a new database or opens an existing database file stored at the the given path.\nIf no path is given a new in-memory database is created instead.\nThe instantiated database should be closed with 'duckdb_close'\n\n path: Path to the database file on disk, or `nullptr` or `:memory:` to open an in-memory database.\n out_database: The result database object.\n returns: `DuckDBSuccess` on success or `DuckDBError` on failure."]
Expand All @@ -12313,6 +12345,14 @@ extern "C" {
#[doc = "Opens a connection to a database. Connections are required to query the database, and store transactional state\nassociated with the connection.\nThe instantiated connection should be closed using 'duckdb_disconnect'\n\n database: The database file to connect to.\n out_connection: The result connection object.\n returns: `DuckDBSuccess` on success or `DuckDBError` on failure."]
pub fn duckdb_connect(database: duckdb_database, out_connection: *mut duckdb_connection) -> duckdb_state;
}
extern "C" {
#[doc = "Interrupt running query\n\n connection: The connection to interruot"]
pub fn duckdb_interrupt(connection: duckdb_connection);
}
extern "C" {
#[doc = "Get progress of the running query\n\n connection: The working connection\n returns: -1 if no progress or a percentage of the progress"]
pub fn duckdb_query_progress(connection: duckdb_connection) -> f64;
}
extern "C" {
#[doc = "Closes the specified connection and de-allocates all memory allocated for that connection.\n\n connection: The connection to close."]
pub fn duckdb_disconnect(connection: *mut duckdb_connection);
Expand Down Expand Up @@ -12581,6 +12621,13 @@ extern "C" {
#[doc = "Returns the number of parameters that can be provided to the given prepared statement.\n\nReturns 0 if the query was not successfully prepared.\n\n prepared_statement: The prepared statement to obtain the number of parameters for."]
pub fn duckdb_nparams(prepared_statement: duckdb_prepared_statement) -> idx_t;
}
extern "C" {
#[doc = "Returns the name used to identify the parameter\nThe returned string should be freed using `duckdb_free`.\n\nReturns NULL if the index is out of range for the provided prepared statement.\n\n prepared_statement: The prepared statement for which to get the parameter name from."]
pub fn duckdb_parameter_name(
prepared_statement: duckdb_prepared_statement,
index: idx_t,
) -> *const ::std::os::raw::c_char;
}
extern "C" {
#[doc = "Returns the parameter type for the parameter at the given index.\n\nReturns `DUCKDB_TYPE_INVALID` if the parameter index is out of range or the statement was not successfully prepared.\n\n prepared_statement: The prepared statement.\n param_idx: The parameter index.\n returns: The parameter type"]
pub fn duckdb_param_type(prepared_statement: duckdb_prepared_statement, param_idx: idx_t) -> duckdb_type;
Expand All @@ -12589,6 +12636,22 @@ extern "C" {
#[doc = "Clear the params bind to the prepared statement."]
pub fn duckdb_clear_bindings(prepared_statement: duckdb_prepared_statement) -> duckdb_state;
}
extern "C" {
#[doc = "Binds a value to the prepared statement at the specified index."]
pub fn duckdb_bind_value(
prepared_statement: duckdb_prepared_statement,
param_idx: idx_t,
val: duckdb_value,
) -> duckdb_state;
}
extern "C" {
#[doc = "Retrieve the index of the parameter for the prepared statement, identified by name"]
pub fn duckdb_bind_parameter_index(
prepared_statement: duckdb_prepared_statement,
param_idx_out: *mut idx_t,
name: *const ::std::os::raw::c_char,
) -> duckdb_state;
}
extern "C" {
#[doc = "Binds a bool value to the prepared statement at the specified index."]
pub fn duckdb_bind_boolean(
Expand Down Expand Up @@ -12749,6 +12812,24 @@ extern "C" {
out_result: *mut duckdb_arrow,
) -> duckdb_state;
}
extern "C" {
#[doc = "Scans the Arrow stream and creates a view with the given name.\n\n connection: The connection on which to execute the scan.\n table_name: Name of the temporary view to create.\n arrow: Arrow stream wrapper.\n returns: `DuckDBSuccess` on success or `DuckDBError` on failure."]
pub fn duckdb_arrow_scan(
connection: duckdb_connection,
table_name: *const ::std::os::raw::c_char,
arrow: duckdb_arrow_stream,
) -> duckdb_state;
}
extern "C" {
#[doc = "Scans the Arrow array and creates a view with the given name.\n\n connection: The connection on which to execute the scan.\n table_name: Name of the temporary view to create.\n arrow_schema: Arrow schema wrapper.\n arrow_array: Arrow array wrapper.\n out_stream: Output array stream that wraps around the passed schema, for releasing/deleting once done.\n returns: `DuckDBSuccess` on success or `DuckDBError` on failure."]
pub fn duckdb_arrow_array_scan(
connection: duckdb_connection,
table_name: *const ::std::os::raw::c_char,
arrow_schema: duckdb_arrow_schema,
arrow_array: duckdb_arrow_array,
out_stream: *mut duckdb_arrow_stream,
) -> duckdb_state;
}
extern "C" {
#[doc = "Extract all statements from a query.\nNote that after calling `duckdb_extract_statements`, the extracted statements should always be destroyed using\n`duckdb_destroy_extracted`, even if no statements were extracted.\nIf the extract fails, `duckdb_extract_statements_error` can be called to obtain the reason why the extract failed.\n connection: The connection object\n query: The SQL query to extract\n out_extracted_statements: The resulting extracted statements object\n returns: The number of extracted statements or 0 on failure."]
pub fn duckdb_extract_statements(
Expand Down Expand Up @@ -12809,6 +12890,10 @@ extern "C" {
out_result: *mut duckdb_result,
) -> duckdb_state;
}
extern "C" {
#[doc = "Returns whether a duckdb_pending_state is finished executing. For example if `pending_state` is\nDUCKDB_PENDING_RESULT_READY, this function will return true.\n\n pending_state: The pending state on which to decide whether to finish execution.\n returns: Boolean indicating pending execution should be considered finished."]
pub fn duckdb_pending_execution_is_finished(pending_state: duckdb_pending_state) -> bool;
}
extern "C" {
#[doc = "Destroys the value and de-allocates all memory allocated for that type.\n\n value: The value to destroy."]
pub fn duckdb_destroy_value(value: *mut duckdb_value);
Expand Down Expand Up @@ -12856,6 +12941,14 @@ extern "C" {
member_count: idx_t,
) -> duckdb_logical_type;
}
extern "C" {
#[doc = "Creates a STRUCT type from the passed member name and type arrays.\nThe resulting type should be destroyed with `duckdb_destroy_logical_type`.\n\n member_types: The array of types that the struct should consist of.\n member_names: The array of names that the struct should consist of.\n member_count: The number of members that were specified for both arrays.\n returns: The logical type."]
pub fn duckdb_create_struct_type(
member_types: *mut duckdb_logical_type,
member_names: *mut *const ::std::os::raw::c_char,
member_count: idx_t,
) -> duckdb_logical_type;
}
extern "C" {
#[doc = "Creates a `duckdb_logical_type` of type decimal with the specified width and scale\nThe resulting type should be destroyed with `duckdb_destroy_logical_type`.\n\n width: The width of the decimal type\n scale: The scale of the decimal type\n returns: The logical type."]
pub fn duckdb_create_decimal_type(width: u8, scale: u8) -> duckdb_logical_type;
Expand Down Expand Up @@ -13010,11 +13103,11 @@ extern "C" {
pub fn duckdb_struct_vector_get_child(vector: duckdb_vector, index: idx_t) -> duckdb_vector;
}
extern "C" {
#[doc = "Returns whether or not a row is valid (i.e. not NULL) in the given validity mask.\n\n validity: The validity mask, as obtained through `duckdb_data_chunk_get_validity`\n row: The row index\n returns: true if the row is valid, false otherwise"]
#[doc = "Returns whether or not a row is valid (i.e. not NULL) in the given validity mask.\n\n validity: The validity mask, as obtained through `duckdb_vector_get_validity`\n row: The row index\n returns: true if the row is valid, false otherwise"]
pub fn duckdb_validity_row_is_valid(validity: *mut u64, row: idx_t) -> bool;
}
extern "C" {
#[doc = "In a validity mask, sets a specific row to either valid or invalid.\n\nNote that `duckdb_data_chunk_ensure_validity_writable` should be called before calling `duckdb_data_chunk_get_validity`,\nto ensure that there is a validity mask to write to.\n\n validity: The validity mask, as obtained through `duckdb_data_chunk_get_validity`.\n row: The row index\n valid: Whether or not to set the row to valid, or invalid"]
#[doc = "In a validity mask, sets a specific row to either valid or invalid.\n\nNote that `duckdb_vector_ensure_validity_writable` should be called before calling `duckdb_vector_get_validity`,\nto ensure that there is a validity mask to write to.\n\n validity: The validity mask, as obtained through `duckdb_vector_get_validity`.\n row: The row index\n valid: Whether or not to set the row to valid, or invalid"]
pub fn duckdb_validity_set_row_validity(validity: *mut u64, row: idx_t, valid: bool);
}
extern "C" {
Expand Down Expand Up @@ -13355,6 +13448,13 @@ extern "C" {
#[doc = "Fetch the internal arrow schema from the arrow result.\n\n result: The result to fetch the schema from.\n out_schema: The output schema.\n returns: `DuckDBSuccess` on success or `DuckDBError` on failure."]
pub fn duckdb_query_arrow_schema(result: duckdb_arrow, out_schema: *mut duckdb_arrow_schema) -> duckdb_state;
}
extern "C" {
#[doc = "Fetch the internal arrow schema from the prepared statement.\n\n result: The prepared statement to fetch the schema from.\n out_schema: The output schema.\n returns: `DuckDBSuccess` on success or `DuckDBError` on failure."]
pub fn duckdb_prepared_arrow_schema(
prepared: duckdb_prepared_statement,
out_schema: *mut duckdb_arrow_schema,
) -> duckdb_state;
}
extern "C" {
#[doc = "Fetch an internal arrow array from the arrow result.\n\nThis function can be called multiple time to get next chunks, which will free the previous out_array.\nSo consume the out_array before calling this function again.\n\n result: The result to fetch the array from.\n out_array: The output array.\n returns: `DuckDBSuccess` on success or `DuckDBError` on failure."]
pub fn duckdb_query_arrow_array(result: duckdb_arrow, out_array: *mut duckdb_arrow_array) -> duckdb_state;
Expand Down
15 changes: 0 additions & 15 deletions libduckdb-sys/update_sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,6 @@
# but not included in the final build unless they're explicitly enabled.
EXTENSIONS = ["parquet", "json", "httpfs"]

# copy in the https_config.py file that allows https to be included in the cmopiled sources
shutil.copyfile(
os.path.join(SCRIPT_DIR, "extras", "httpfs_config.py"),
os.path.join(
SCRIPT_DIR, "duckdb-sources", "extension", "httpfs", "httpfs_config.py"
),
)

# Clear the duckdb directory
try:
shutil.rmtree(os.path.join(TARGET_DIR))
Expand Down Expand Up @@ -107,10 +99,3 @@ def get_sources(extensions):
+ '/bindgen_bundled_version.rs" \;',
shell=True,
)

# Remove the extra patch file
os.remove(
os.path.join(
SCRIPT_DIR, "duckdb-sources", "extension", "httpfs", "httpfs_config.py"
)
)
4 changes: 2 additions & 2 deletions libduckdb-sys/upgrade.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ export DUCKDB_LIB_DIR="$SCRIPT_DIR/duckdb"
export DU_INCLUDE_DIR="$DUCKDB_LIB_DIR"

# Download and extract amalgamation
DUCKDB_VERSION=v0.8.1
DUCKDB_VERSION=v0.9.0
git submodule update --init --checkout
cd "$SCRIPT_DIR/duckdb-sources" || { echo "fatal error" >&2; exit 1; }
git fetch
git switch "$DUCKDB_VERSION"
git checkout "$DUCKDB_VERSION"
cd "$SCRIPT_DIR" || { echo "fatal error" >&2; exit 1; }
python3 "$SCRIPT_DIR/update_sources.py"

Expand Down
Loading