Skip to content

Commit

Permalink
Remove libprotobuf dep (#527)
Browse files Browse the repository at this point in the history
* Remove libprotobuf as a build time dependency of Conda

* Add substrait feature which enables building with substrait features

* Add datafusion._internal/substrait to the pyproject.toml file so substrait will be built for pytests when using pip

* Rename feature to just substrait

* Add protoc since libprotobuf was removed from conda requirements file

* Refactor substrait module being initialized as a function

* Reintroduce libprotobuf as build dependency for conda build
  • Loading branch information
jdye64 authored Oct 26, 2023
1 parent aaaeeb1 commit da6c183
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ include = ["/src", "/datafusion", "/LICENSE.txt", "pyproject.toml", "Cargo.toml"
[features]
default = ["mimalloc"]
protoc = [ "datafusion-substrait/protoc" ]
substrait = ["dep:datafusion-substrait"]

[dependencies]
tokio = { version = "1.24", features = ["macros", "rt", "rt-multi-thread", "sync"] }
Expand All @@ -41,7 +42,7 @@ datafusion-common = { version = "32.0.0", features = ["pyarrow"] }
datafusion-expr = { version = "32.0.0" }
datafusion-optimizer = { version = "32.0.0" }
datafusion-sql = { version = "32.0.0" }
datafusion-substrait = { version = "32.0.0" }
datafusion-substrait = { version = "32.0.0", optional = true }
prost = "0.11"
prost-types = "0.11"
uuid = { version = "1.3", features = ["v4"] }
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,4 @@ include = [
exclude = [".github/**", "ci/**", ".asf.yaml"]
# Require Cargo.lock is up to date
locked = true
features = ["substrait"]
13 changes: 12 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ pub use datafusion_common;
pub use datafusion_expr;
pub use datafusion_optimizer;
pub use datafusion_sql;

#[cfg(feature = "substrait")]
pub use datafusion_substrait;

#[allow(clippy::borrow_deref_ref)]
Expand All @@ -48,6 +50,8 @@ mod pyarrow_filter_expression;
mod record_batch;
pub mod sql;
pub mod store;

#[cfg(feature = "substrait")]
pub mod substrait;
#[allow(clippy::borrow_deref_ref)]
mod udaf;
Expand Down Expand Up @@ -108,9 +112,16 @@ fn _internal(py: Python, m: &PyModule) -> PyResult<()> {
m.add_submodule(store)?;

// Register substrait as a submodule
#[cfg(feature = "substrait")]
setup_substrait_module(py, m)?;

Ok(())
}

#[cfg(feature = "substrait")]
fn setup_substrait_module(py: Python, m: &PyModule) -> PyResult<()> {
let substrait = PyModule::new(py, "substrait")?;
substrait::init_module(substrait)?;
m.add_submodule(substrait)?;

Ok(())
}

0 comments on commit da6c183

Please sign in to comment.