From 968e875d0704a639e53fcac2a163556b86e41951 Mon Sep 17 00:00:00 2001 From: Jon Mease Date: Fri, 25 Feb 2022 07:10:47 -0500 Subject: [PATCH] Make parquet support optional for datafusion-common crate --- datafusion-common/Cargo.toml | 2 +- datafusion-common/src/error.rs | 4 ++++ datafusion/Cargo.toml | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/datafusion-common/Cargo.toml b/datafusion-common/Cargo.toml index 30831b892b71..9678efb41c9e 100644 --- a/datafusion-common/Cargo.toml +++ b/datafusion-common/Cargo.toml @@ -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" diff --git a/datafusion-common/src/error.rs b/datafusion-common/src/error.rs index ec59a8ac1db5..4a82ac3e9cf5 100644 --- a/datafusion-common/src/error.rs +++ b/datafusion-common/src/error.rs @@ -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; @@ -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")] @@ -98,6 +100,7 @@ impl From for ArrowError { } } +#[cfg(feature = "parquet")] impl From for DataFusionError { fn from(e: ParquetError) -> Self { DataFusionError::ParquetError(e) @@ -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) } diff --git a/datafusion/Cargo.toml b/datafusion/Cargo.toml index 23eb7cecd96b..81722fd91c5b 100644 --- a/datafusion/Cargo.toml +++ b/datafusion/Cargo.toml @@ -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" }