Skip to content

Commit

Permalink
Remove built-in HTTPFS extension and fix Windows CI (#353)
Browse files Browse the repository at this point in the history
* Remove HTTPFS, try to re-enable Windows test

* Fix vtab types

* Re-generate bindgen
  • Loading branch information
Mytherin authored Jul 11, 2024
1 parent 983e02a commit 4d227f7
Show file tree
Hide file tree
Showing 9 changed files with 8 additions and 43 deletions.
1 change: 1 addition & 0 deletions .github/workflows/rust.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ jobs:
fail-fast: true
matrix:
include:
- { target: x86_64-pc-windows-msvc, os: windows-latest, duckdb: libduckdb-windows-amd64.zip }
- { target: x86_64-unknown-linux-gnu, os: ubuntu-latest, duckdb: libduckdb-linux-amd64.zip }
#- { target: x86_64-apple-darwin, os: macos-latest }
#- {
Expand Down
6 changes: 1 addition & 5 deletions crates/duckdb/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,15 @@ name = "duckdb"
[features]
default = []
bundled = ["libduckdb-sys/bundled"]
httpfs = ["libduckdb-sys/httpfs", "bundled"]
json = ["libduckdb-sys/json", "bundled"]
parquet = ["libduckdb-sys/parquet", "bundled"]
openssl_vendored = ["libduckdb-sys/openssl_vendored", "bundled"]
unstable_boringssl = ["libduckdb-sys/unstable_boringssl", "bundled"]
openssl_bindgen = ["libduckdb-sys/openssl_bindgen", "bundled"]
vtab = []
vtab-loadable = ["vtab", "duckdb-loadable-macros"]
vtab-excel = ["vtab", "calamine"]
vtab-arrow = ["vtab", "num"]
appender-arrow = ["vtab-arrow"]
vtab-full = ["vtab-excel", "vtab-arrow", "appender-arrow"]
extensions-full = ["httpfs", "json", "parquet", "vtab-full"]
extensions-full = ["json", "parquet", "vtab-full"]
buildtime_bindgen = ["libduckdb-sys/buildtime_bindgen"]
modern-full = ["chrono", "serde_json", "url", "r2d2", "uuid", "polars"]
polars = ["dep:polars"]
Expand Down
11 changes: 0 additions & 11 deletions crates/duckdb/src/extension.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,4 @@ mod test {
);
Ok(())
}

// https://duckdb.org/docs/extensions/httpfs
#[test]
fn test_extension_httpfs() -> Result<()> {
let db = Connection::open_in_memory()?;
assert_eq!(
300f32,
db.query_row::<f32, _, _>(r#"SELECT SUM(value) FROM read_parquet('https://github.com/duckdb/duckdb-rs/raw/main/crates/duckdb/examples/int32_decimal.parquet');"#, [], |r| r.get(0))?
);
Ok(())
}
}
6 changes: 3 additions & 3 deletions crates/duckdb/src/vtab/function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use std::{
/// An interface to store and retrieve data during the function bind stage
#[derive(Debug)]
pub struct BindInfo {
ptr: *mut c_void,
ptr: duckdb_bind_info,
}

impl BindInfo {
Expand Down Expand Up @@ -264,7 +264,7 @@ impl TableFunction {
///
/// # Arguments
/// * `function`: The init function
pub fn set_init(&self, init_func: Option<unsafe extern "C" fn(*mut c_void)>) -> &Self {
pub fn set_init(&self, init_func: Option<unsafe extern "C" fn(duckdb_init_info)>) -> &Self {
unsafe {
duckdb_table_function_set_init(self.ptr, init_func);
}
Expand All @@ -275,7 +275,7 @@ impl TableFunction {
///
/// # Arguments
/// * `function`: The bind function
pub fn set_bind(&self, bind_func: Option<unsafe extern "C" fn(*mut c_void)>) -> &Self {
pub fn set_bind(&self, bind_func: Option<unsafe extern "C" fn(duckdb_bind_info)>) -> &Self {
unsafe {
duckdb_table_function_set_bind(self.ptr, bind_func);
}
Expand Down
9 changes: 1 addition & 8 deletions crates/libduckdb-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,16 @@ exclude = ["duckdb-sources"]
default = ["vcpkg", "pkg-config"]
bundled = ["cc"]
buildtime_bindgen = ["bindgen", "pkg-config", "vcpkg"]

httpfs = ["bundled"]
json = ["bundled"]
parquet = ["bundled"]
extensions-full = ["httpfs", "json", "parquet"]

openssl_vendored = ["bundled", "openssl-src"]
openssl_bindgen = ["bundled", "bindgen", "pkg-config", "vcpkg"]
unstable_boringssl = ["bundled"]
extensions-full = ["json", "parquet"]

[dependencies]

[build-dependencies]
autocfg = { workspace = true }
bindgen = { workspace = true, features = ["runtime"], optional = true }
flate2 = { workspace = true }
openssl-src = { version = "300.3.0", optional = true, features = ["legacy"] }
pkg-config = { workspace = true, optional = true }
cc = { workspace = true, features = ["parallel"], optional = true }
vcpkg = { workspace = true, optional = true }
Expand Down
14 changes: 0 additions & 14 deletions crates/libduckdb-sys/build.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
use std::{env, path::Path};

#[cfg(feature = "httpfs")]
mod openssl;

/// Tells whether we're building for Windows. This is more suitable than a plain
/// `cfg!(windows)`, since the latter does not properly handle cross-compilation
///
Expand Down Expand Up @@ -137,17 +134,6 @@ mod build_bundled {
println!("cargo:rerun-if-changed=duckdb.tar.gz");

cfg.include(lib_name);

// Note: dont move this, the link order is important and we need to make
// sure we link openssl after duckdb
#[cfg(feature = "httpfs")]
{
if let Ok((_, openssl_include_dir)) = super::openssl::get_openssl_v2() {
cfg.include(openssl_include_dir);
}
add_extension(&mut cfg, &manifest, "httpfs", &mut cpp_files, &mut include_dirs);
}

cfg.includes(include_dirs.iter().map(|dir| format!("{out_dir}/{lib_name}/{dir}")));

for f in cpp_files.into_iter().map(|file| format!("{out_dir}/{file}")) {
Expand Down
Binary file modified crates/libduckdb-sys/duckdb.tar.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion crates/libduckdb-sys/src/bindgen_bundled_version.rs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion crates/libduckdb-sys/update_sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

# List of extensions' sources to grab. Technically, these sources will be compiled
# but not included in the final build unless they're explicitly enabled.
EXTENSIONS = ["parquet", "json", "httpfs"]
EXTENSIONS = ["parquet", "json"]

# Clear the duckdb directory
try:
Expand Down

0 comments on commit 4d227f7

Please sign in to comment.