Skip to content

Commit da6c183

Browse files
authored
Remove libprotobuf dep (#527)
* 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
1 parent aaaeeb1 commit da6c183

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ include = ["/src", "/datafusion", "/LICENSE.txt", "pyproject.toml", "Cargo.toml"
3131
[features]
3232
default = ["mimalloc"]
3333
protoc = [ "datafusion-substrait/protoc" ]
34+
substrait = ["dep:datafusion-substrait"]
3435

3536
[dependencies]
3637
tokio = { version = "1.24", features = ["macros", "rt", "rt-multi-thread", "sync"] }
@@ -41,7 +42,7 @@ datafusion-common = { version = "32.0.0", features = ["pyarrow"] }
4142
datafusion-expr = { version = "32.0.0" }
4243
datafusion-optimizer = { version = "32.0.0" }
4344
datafusion-sql = { version = "32.0.0" }
44-
datafusion-substrait = { version = "32.0.0" }
45+
datafusion-substrait = { version = "32.0.0", optional = true }
4546
prost = "0.11"
4647
prost-types = "0.11"
4748
uuid = { version = "1.3", features = ["v4"] }

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,4 @@ include = [
6262
exclude = [".github/**", "ci/**", ".asf.yaml"]
6363
# Require Cargo.lock is up to date
6464
locked = true
65+
features = ["substrait"]

src/lib.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ pub use datafusion_common;
2525
pub use datafusion_expr;
2626
pub use datafusion_optimizer;
2727
pub use datafusion_sql;
28+
29+
#[cfg(feature = "substrait")]
2830
pub use datafusion_substrait;
2931

3032
#[allow(clippy::borrow_deref_ref)]
@@ -48,6 +50,8 @@ mod pyarrow_filter_expression;
4850
mod record_batch;
4951
pub mod sql;
5052
pub mod store;
53+
54+
#[cfg(feature = "substrait")]
5155
pub mod substrait;
5256
#[allow(clippy::borrow_deref_ref)]
5357
mod udaf;
@@ -108,9 +112,16 @@ fn _internal(py: Python, m: &PyModule) -> PyResult<()> {
108112
m.add_submodule(store)?;
109113

110114
// Register substrait as a submodule
115+
#[cfg(feature = "substrait")]
116+
setup_substrait_module(py, m)?;
117+
118+
Ok(())
119+
}
120+
121+
#[cfg(feature = "substrait")]
122+
fn setup_substrait_module(py: Python, m: &PyModule) -> PyResult<()> {
111123
let substrait = PyModule::new(py, "substrait")?;
112124
substrait::init_module(substrait)?;
113125
m.add_submodule(substrait)?;
114-
115126
Ok(())
116127
}

0 commit comments

Comments
 (0)