Skip to content

Commit 7289bea

Browse files
phillipleblanckczimm
authored andcommitted
Support for metadata columns (location, size, last_modified) in ListingTableProvider (#74)
UPSTREAM NOTE: This PR was attempted to be upstreamed but was not accepted. Needs to be applied manually apache#15181
1 parent 7151f4d commit 7289bea

29 files changed

Lines changed: 2850 additions & 149 deletions

File tree

Cargo.lock

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

datafusion-examples/examples/advanced_parquet_index.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ impl TableProvider for IndexTableProvider {
495495
ParquetSource::default()
496496
// provide the predicate so the DataSourceExec can try and prune
497497
// row groups internally
498-
.with_predicate(predicate)
498+
.with_predicate(Arc::clone(&schema), predicate)
499499
// provide the factory to create parquet reader without re-reading metadata
500500
.with_parquet_file_reader_factory(Arc::new(reader_factory)),
501501
);

datafusion-examples/examples/custom_file_format.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ use arrow::{
2121
array::{AsArray, RecordBatch, StringArray, UInt8Array},
2222
datatypes::{DataType, Field, Schema, SchemaRef, UInt64Type},
2323
};
24-
use datafusion::physical_expr::LexRequirement;
2524
use datafusion::{
2625
catalog::Session,
2726
common::{GetExt, Statistics},
@@ -42,6 +41,7 @@ use datafusion::{
4241
physical_plan::ExecutionPlan,
4342
prelude::SessionContext,
4443
};
44+
use datafusion::{physical_expr::LexRequirement, physical_plan::PhysicalExpr};
4545
use object_store::{ObjectMeta, ObjectStore};
4646
use tempfile::tempdir;
4747

@@ -111,8 +111,11 @@ impl FileFormat for TSVFileFormat {
111111
&self,
112112
state: &dyn Session,
113113
conf: FileScanConfig,
114+
filters: Option<&Arc<dyn PhysicalExpr>>,
114115
) -> Result<Arc<dyn ExecutionPlan>> {
115-
self.csv_file_format.create_physical_plan(state, conf).await
116+
self.csv_file_format
117+
.create_physical_plan(state, conf, filters)
118+
.await
116119
}
117120

118121
async fn create_writer_physical_plan(

datafusion-examples/examples/parquet_index.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,8 @@ impl TableProvider for IndexTableProvider {
243243
let files = self.index.get_files(predicate.clone())?;
244244

245245
let object_store_url = ObjectStoreUrl::parse("file://")?;
246-
let source = Arc::new(ParquetSource::default().with_predicate(predicate));
246+
let source =
247+
Arc::new(ParquetSource::default().with_predicate(self.schema(), predicate));
247248
let mut file_scan_config_builder =
248249
FileScanConfigBuilder::new(object_store_url, self.schema(), source)
249250
.with_projection(projection.cloned())

datafusion/catalog-listing/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ object_store = { workspace = true }
4848
tokio = { workspace = true }
4949

5050
[dev-dependencies]
51+
chrono = { workspace = true }
52+
tempfile = { workspace = true }
5153

5254
[lints]
5355
workspace = true

0 commit comments

Comments
 (0)