friendlymatthew commented on code in PR #17242:
URL: https://github.com/apache/datafusion/pull/17242#discussion_r2298427903
##########
datafusion-examples/examples/advanced_parquet_index.rs:
##########
@@ -491,23 +492,22 @@ impl TableProvider for IndexTableProvider {
CachedParquetFileReaderFactory::new(Arc::clone(&self.object_store))
.with_file(indexed_file);
- let file_source = Arc::new(
- ParquetSource::default()
+ let file_scan_config = FileScanConfigBuilder::new(object_store_url,
schema)
+ .with_limit(limit)
+ .with_projection(projection.cloned())
+ .with_file(partitioned_file)
+ .build();
+
+ let file_source =
+ ParquetSource::new(TableParquetOptions::default(),
file_scan_config.clone())
// provide the predicate so the DataSourceExec can try and
prune
// row groups internally
.with_predicate(predicate)
// provide the factory to create parquet reader without
re-reading metadata
- .with_parquet_file_reader_factory(Arc::new(reader_factory)),
- );
- let file_scan_config =
- FileScanConfigBuilder::new(object_store_url, schema, file_source)
- .with_limit(limit)
- .with_projection(projection.cloned())
- .with_file(partitioned_file)
- .build();
+ .with_parquet_file_reader_factory(Arc::new(reader_factory));
// Finally, put it all together into a DataSourceExec
- Ok(DataSourceExec::from_data_source(file_scan_config))
Review Comment:
You'll see this pattern a lot in this PR.
The old flow goes something like:
1. Define the file source
2. Define the file scan config and move the file source inside
3. Derive a data source plan from the file scan config
Inside this flow, there's a circular dependency (call file source from
config, create file opener from file source but also pass in the config).
The new flow goes something like:
1. Define the config
2. Define the file source which now owns the config
3. Derive a data source plan from the file source
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]