-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
194 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Licensed to the Apache Software Foundation (ASF) under one | ||
// or more contributor license agreements. See the NOTICE file | ||
// distributed with this work for additional information | ||
// regarding copyright ownership. The ASF licenses this file | ||
// to you under the Apache License, Version 2.0 (the | ||
// "License"); you may not use this file except in compliance | ||
// with the License. You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, | ||
// software distributed under the License is distributed on an | ||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
// KIND, either express or implied. See the License for the | ||
// specific language governing permissions and limitations | ||
// under the License. | ||
|
||
#[cfg(feature = "parquet")] | ||
mod parquet; | ||
|
||
#[cfg(feature = "parquet")] | ||
pub use parquet::*; | ||
|
||
#[cfg(not(feature = "parquet"))] | ||
mod parquet_stub; | ||
|
||
#[cfg(not(feature = "parquet"))] | ||
pub use parquet_stub::*; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
datafusion/common/src/file_options/parquet_writer/parquet_stub.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Licensed to the Apache Software Foundation (ASF) under one | ||
// or more contributor license agreements. See the NOTICE file | ||
// distributed with this work for additional information | ||
// regarding copyright ownership. The ASF licenses this file | ||
// to you under the Apache License, Version 2.0 (the | ||
// "License"); you may not use this file except in compliance | ||
// with the License. You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, | ||
// software distributed under the License is distributed on an | ||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
// KIND, either express or implied. See the License for the | ||
// specific language governing permissions and limitations | ||
// under the License. | ||
|
||
use crate::config::ConfigOptions; | ||
use crate::file_options::StatementOptions; | ||
use crate::not_impl_err; | ||
|
||
/// Stub implementation of `ParquetFormat` that always returns a | ||
/// NotYetImplemented error used when parquet feature is not activated. | ||
#[derive(Clone, Debug)] | ||
pub struct ParquetWriterOptions {} | ||
|
||
impl TryFrom<(&ConfigOptions, &StatementOptions)> for ParquetWriterOptions { | ||
type Error = DataFusionError; | ||
|
||
fn try_from(_: (&ConfigOptions, &StatementOptions)) -> Result<Self> { | ||
not_impl_err!( | ||
"Parquet format is not enabled, Hint enable the `parquet` feature flag" | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Licensed to the Apache Software Foundation (ASF) under one | ||
// or more contributor license agreements. See the NOTICE file | ||
// distributed with this work for additional information | ||
// regarding copyright ownership. The ASF licenses this file | ||
// to you under the Apache License, Version 2.0 (the | ||
// "License"); you may not use this file except in compliance | ||
// with the License. You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, | ||
// software distributed under the License is distributed on an | ||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
// KIND, either express or implied. See the License for the | ||
// specific language governing permissions and limitations | ||
// under the License. | ||
|
||
//! FileFormat for parquet | ||
/// If parquet is enabled, use actual implementation | ||
#[cfg(feature = "parquet")] | ||
mod parquet; | ||
#[cfg(feature = "parquet")] | ||
pub use parquet::*; | ||
|
||
/// If parquet is not enabled, use dummy implementation | ||
#[cfg(not(feature = "parquet"))] | ||
mod parquet_stub; | ||
#[cfg(not(feature = "parquet"))] | ||
pub use parquet_stub::ParquetFormat; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
84 changes: 84 additions & 0 deletions
84
datafusion/core/src/datasource/file_format/parquet/parquet_stub.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
// Licensed to the Apache Software Foundation (ASF) under one | ||
// or more contributor license agreements. See the NOTICE file | ||
// distributed with this work for additional information | ||
// regarding copyright ownership. The ASF licenses this file | ||
// to you under the Apache License, Version 2.0 (the | ||
// "License"); you may not use this file except in compliance | ||
// with the License. You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, | ||
// software distributed under the License is distributed on an | ||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
// KIND, either express or implied. See the License for the | ||
// specific language governing permissions and limitations | ||
// under the License. | ||
|
||
use crate::datasource::file_format::FileFormat; | ||
use crate::datasource::physical_plan::FileScanConfig; | ||
use crate::execution::context::SessionState; | ||
use arrow_schema::SchemaRef; | ||
use async_trait::async_trait; | ||
use datafusion_common::{DataFusionError, FileType, Result, Statistics}; | ||
use datafusion_physical_expr::PhysicalExpr; | ||
use datafusion_physical_plan::ExecutionPlan; | ||
use object_store::{ObjectMeta, ObjectStore}; | ||
use std::any::Any; | ||
use std::sync::Arc; | ||
|
||
/// Stub implementation of `ParquetFormat` that always returns a NotYetImplemented error. | ||
#[derive(Debug, Default)] | ||
pub struct ParquetFormat; | ||
|
||
impl ParquetFormat { | ||
/// Create a new instance of the Parquet format | ||
pub fn new() -> Self { | ||
Self | ||
} | ||
} | ||
|
||
fn nyi_error() -> DataFusionError { | ||
DataFusionError::NotImplemented( | ||
"Parquet support not enabled. Hint enable the `parquet` crate feature".into(), | ||
) | ||
} | ||
|
||
#[async_trait] | ||
impl FileFormat for ParquetFormat { | ||
fn as_any(&self) -> &dyn Any { | ||
self | ||
} | ||
|
||
async fn infer_schema( | ||
&self, | ||
_: &SessionState, | ||
_: &Arc<dyn ObjectStore>, | ||
_: &[ObjectMeta], | ||
) -> Result<SchemaRef> { | ||
Err(nyi_error()) | ||
} | ||
|
||
async fn infer_stats( | ||
&self, | ||
_: &SessionState, | ||
_: &Arc<dyn ObjectStore>, | ||
_: SchemaRef, | ||
_: &ObjectMeta, | ||
) -> Result<Statistics> { | ||
Err(nyi_error()) | ||
} | ||
|
||
async fn create_physical_plan( | ||
&self, | ||
_: &SessionState, | ||
_: FileScanConfig, | ||
_: Option<&Arc<dyn PhysicalExpr>>, | ||
) -> Result<Arc<dyn ExecutionPlan>> { | ||
Err(nyi_error()) | ||
} | ||
|
||
fn file_type(&self) -> FileType { | ||
FileType::PARQUET | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters