adriangb commented on code in PR #17242:
URL: https://github.com/apache/datafusion/pull/17242#discussion_r2298304076
##########
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));
Review Comment:
This is just moving code around to initialize the FileScanConfig before the
ParquetSource ✅
##########
datafusion-examples/examples/csv_json_opener.rs:
##########
@@ -58,20 +58,17 @@ async fn csv_opener() -> Result<()> {
let scan_config = FileScanConfigBuilder::new(
ObjectStoreUrl::local_filesystem(),
Arc::clone(&schema),
- Arc::new(CsvSource::default()),
)
.with_projection(Some(vec![12, 0]))
+ .with_batch_size(Some(8192))
.with_limit(Some(5))
.with_file(PartitionedFile::new(path.display().to_string(), 10))
.build();
- let config = CsvSource::new(true, b',', b'"')
- .with_comment(Some(b'#'))
- .with_schema(schema)
- .with_batch_size(8192)
- .with_projection(&scan_config);
Review Comment:
It makes sense that the schema, batch size and projection are not properties
inherent to CSVs and thus should be part of FileScanConfig. In fact they are
currently duplicated!
--
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]