-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Improve UX Rename FileScanConfig::new_exec to FileScanConfig::build
#14670
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
Conversation
|
|
||
| // Finally, put it all together into a DataSourceExec | ||
| Ok(file_scan_config.new_exec()) | ||
| Ok(file_scan_config.build()) |
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.
This is basically the change -- use build rather than new_exec which I think is more consistent with the style of code in the rest of this crate (and the Rust builder style in general)
| ) -> Result<Arc<dyn ExecutionPlan>> { | ||
| conf = conf.with_source(Arc::new(ArrowSource::default())); | ||
| Ok(conf.new_exec()) | ||
| Ok(conf.with_source(Arc::new(ArrowSource::default())).build()) |
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.
dive by cleanup to avoid mut and make it more concise
| // This process can be moved into CsvExec, but it would be an overlap of their responsibility. | ||
| Ok(all_alias_free_columns(projection.expr()).then(|| { | ||
| let mut file_scan = self.clone(); | ||
| let file_scan = self.clone(); |
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.
Previously calling new_exec always cloned. Now it is only cloned when necessary
| pub fn new_exec(&self) -> Arc<DataSourceExec> { | ||
| Arc::new(DataSourceExec::new(Arc::new(self.clone()))) | ||
| /// Returns a new [`DataSourceExec`] to scan the files specified by this config | ||
| pub fn build(self) -> Arc<DataSourceExec> { |
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.
renamed and changed to take self rather than &self
| /// PartitionedFile::new("file2.parquet", 56), | ||
| /// PartitionedFile::new("file3.parquet", 78), | ||
| /// ]); | ||
| /// // create an execution plan from the config |
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.
I also tried to add some docs that could make build easier to discover
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.
Nice 🧹
Which issue does this PR close?
DataSourceExecfor provided datasources, removeParquetExec,CsvExec, etc #14224 from @mertak-synnada ❤️Rationale for this change
This was something I noticed while trying to upgrade InfluxDB IOx to use the new APIs introduced in #14224
I would like to make it easier when someone using these APIs upgrades
What changes are included in this PR?
->build`selfrather than force a cloneAre these changes tested?
Are there any user-facing changes?
There are some changes to APIs that are not yet released