-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
refactor: add ExecutionPlan::file_scan_config to avoid downcasting #7175
refactor: add ExecutionPlan::file_scan_config to avoid downcasting #7175
Conversation
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.
Seems like a nice improvement to me
I want to feature-gate AvroExec in a followup commit, so that you cannot get bitten by AvroExec::execute returning an NotImplemented error if the "avro" feature isn't enabled. (Since idiomatic Rust code should work if it compiles.) As a preparation for that this commit gets rid of a `plan_any.downcast_ref::<AvroExec>()` call that couldn't be easily put behind a `cfg(feature = "avro")` without complicating the control flow.
6686b6c
to
34d4e6c
Compare
I just slightly improved the doc comment for the new trait method: - /// Returns the [`FileScanConfig`] in case this is a physical execution plan or `None` otherwise.
+ /// Returns the [`FileScanConfig`] in case this is a data source scanning execution plan or `None` otherwise. |
|
||
collector.push(file_groups); | ||
Ok(VisitRecursion::Skip) | ||
if let Some(file_scan_config) = plan.file_scan_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.
that certainly looks nicer
🤔 it seems like this has now introduced another dependency between datafusion and the physical plans (I am trying to cut out the physical plans into their own crate in #1754 ) I will futz with this and see if I can get an API that achieves both |
Thanks for bringing this up here. I disagree that this PR introduced any new dependency ... it just made the existing dependency explicit. Since I think you should of course be able to implement your own data source scanning execution plan (which previously you could not because of the hard-coded downcasting in the physical plan). So I think the solution here is to move the new |
I think that is a great idea, and I will create a PR shortly for discussion |
Thanks - I filed #7357 to track the work / continue the conversation so it wasn't lost on this merged PR. Let's continue the conversation there |
I want to feature-gate AvroExec in a followup commit, so that you cannot get bitten by AvroExec::execute returning an NotImplemented error if the "avro" feature isn't enabled. (Since idiomatic Rust code should work if it compiles.)
As a preparation for that this commit gets rid of a
plan_any.downcast_ref::<AvroExec>()
call that couldn't be easily put behind acfg(feature = "avro")
without complicating the control flow.Are there any user-facing changes?
Yes this PR adds the
file_scan_config
method to theExecutionPlan
trait.