Skip to content

Commit

Permalink
Make parquet support optional for datafusion-common crate (#1886)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonmmease authored Feb 25, 2022
1 parent 993f0a3 commit 36279ed
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion datafusion-common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jit = ["cranelift-module"]

[dependencies]
arrow = { version = "9.0.0", features = ["prettyprint"] }
parquet = { version = "9.0.0", features = ["arrow"] }
parquet = { version = "9.0.0", features = ["arrow"], optional = true }
avro-rs = { version = "0.13", features = ["snappy"], optional = true }
pyo3 = { version = "0.15", optional = true }
sqlparser = "0.14"
Expand Down
4 changes: 4 additions & 0 deletions datafusion-common/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ use arrow::error::ArrowError;
use avro_rs::Error as AvroError;
#[cfg(feature = "jit")]
use cranelift_module::ModuleError;
#[cfg(feature = "parquet")]
use parquet::errors::ParquetError;
use sqlparser::parser::ParserError;

Expand All @@ -42,6 +43,7 @@ pub enum DataFusionError {
/// Error returned by arrow.
ArrowError(ArrowError),
/// Wraps an error from the Parquet crate
#[cfg(feature = "parquet")]
ParquetError(ParquetError),
/// Wraps an error from the Avro crate
#[cfg(feature = "avro")]
Expand Down Expand Up @@ -98,6 +100,7 @@ impl From<DataFusionError> for ArrowError {
}
}

#[cfg(feature = "parquet")]
impl From<ParquetError> for DataFusionError {
fn from(e: ParquetError) -> Self {
DataFusionError::ParquetError(e)
Expand Down Expand Up @@ -134,6 +137,7 @@ impl Display for DataFusionError {
fn fmt(&self, f: &mut Formatter) -> std::fmt::Result {
match *self {
DataFusionError::ArrowError(ref desc) => write!(f, "Arrow error: {}", desc),
#[cfg(feature = "parquet")]
DataFusionError::ParquetError(ref desc) => {
write!(f, "Parquet error: {}", desc)
}
Expand Down
2 changes: 1 addition & 1 deletion datafusion/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ row = []
jit = ["datafusion-jit"]

[dependencies]
datafusion-common = { path = "../datafusion-common", version = "7.0.0" }
datafusion-common = { path = "../datafusion-common", version = "7.0.0", features = ["parquet"] }
datafusion-expr = { path = "../datafusion-expr", version = "7.0.0" }
datafusion-jit = { path = "../datafusion-jit", version = "7.0.0", optional = true }
datafusion-physical-expr = { path = "../datafusion-physical-expr", version = "7.0.0" }
Expand Down

0 comments on commit 36279ed

Please sign in to comment.