-
Notifications
You must be signed in to change notification settings - Fork 1.8k
move projection handling into FileSource #18627
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -64,22 +64,22 @@ async fn csv_opener() -> Result<()> { | |||||||||||||||||||||||||||||||||||
| ..Default::default() | ||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| let scan_config = FileScanConfigBuilder::new( | ||||||||||||||||||||||||||||||||||||
| ObjectStoreUrl::local_filesystem(), | ||||||||||||||||||||||||||||||||||||
| Arc::new(CsvSource::new(Arc::clone(&schema)).with_csv_options(options.clone())), | ||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||
| .with_projection_indices(Some(vec![12, 0])) | ||||||||||||||||||||||||||||||||||||
| .with_limit(Some(5)) | ||||||||||||||||||||||||||||||||||||
| .with_file(PartitionedFile::new(path.display().to_string(), 10)) | ||||||||||||||||||||||||||||||||||||
| .build(); | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| let config = CsvSource::new(Arc::clone(&schema)) | ||||||||||||||||||||||||||||||||||||
| let source = CsvSource::new(Arc::clone(&schema)) | ||||||||||||||||||||||||||||||||||||
| .with_csv_options(options) | ||||||||||||||||||||||||||||||||||||
| .with_comment(Some(b'#')) | ||||||||||||||||||||||||||||||||||||
| .with_batch_size(8192) | ||||||||||||||||||||||||||||||||||||
| .with_projection(&scan_config); | ||||||||||||||||||||||||||||||||||||
| .with_batch_size(8192); | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| let scan_config = | ||||||||||||||||||||||||||||||||||||
| FileScanConfigBuilder::new(ObjectStoreUrl::local_filesystem(), source) | ||||||||||||||||||||||||||||||||||||
| .with_projection_indices(Some(vec![12, 0]))? | ||||||||||||||||||||||||||||||||||||
| .with_limit(Some(5)) | ||||||||||||||||||||||||||||||||||||
| .with_file(PartitionedFile::new(path.display().to_string(), 10)) | ||||||||||||||||||||||||||||||||||||
| .build(); | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| let opener = config.create_file_opener(object_store, &scan_config, 0); | ||||||||||||||||||||||||||||||||||||
| let opener = | ||||||||||||||||||||||||||||||||||||
| scan_config | ||||||||||||||||||||||||||||||||||||
| .file_source() | ||||||||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This one is still kind of weird -- look like we might be able to replace it entirely with datafusion/datafusion/datasource/src/file_scan_config.rs Lines 501 to 517 in 3c21b54
But then we would have to change the example to setup the runtime env
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah I'll leave it untouched for now. |
||||||||||||||||||||||||||||||||||||
| .create_file_opener(object_store, &scan_config, 0)?; | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| let mut result = vec![]; | ||||||||||||||||||||||||||||||||||||
| let mut stream = | ||||||||||||||||||||||||||||||||||||
|
|
@@ -133,7 +133,7 @@ async fn json_opener() -> Result<()> { | |||||||||||||||||||||||||||||||||||
| ObjectStoreUrl::local_filesystem(), | ||||||||||||||||||||||||||||||||||||
| Arc::new(JsonSource::new(schema)), | ||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||
| .with_projection_indices(Some(vec![1, 0])) | ||||||||||||||||||||||||||||||||||||
| .with_projection_indices(Some(vec![1, 0]))? | ||||||||||||||||||||||||||||||||||||
| .with_limit(Some(5)) | ||||||||||||||||||||||||||||||||||||
| .with_file(PartitionedFile::new(path.to_string(), 10)) | ||||||||||||||||||||||||||||||||||||
| .build(); | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -620,7 +620,7 @@ mod test { | |
| let plan_string = get_plan_string(&aggregate_exec_partial).swap_remove(0); | ||
| assert_snapshot!( | ||
| plan_string, | ||
| @"AggregateExec: mode=Partial, gby=[id@0 as id, 1 + id@0 as expr], aggr=[COUNT(c)]" | ||
| @"AggregateExec: mode=Partial, gby=[id@0 as id, 1 + id@0 as expr], aggr=[COUNT(c)], ordering_mode=Sorted" | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm actually not sure where this is coming from... we need to double check it's correct / an improvement
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The table is created with (I don't really know why it started appearing either) |
||
| ); | ||
|
|
||
| let p0_statistics = aggregate_exec_partial.partition_statistics(Some(0))?; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I agree it is really nice to not have this strange circular dependency between the source and the config