add ExecutionPlan::dynamic_expressions() method - #24068
Conversation
|
Thank you for opening this pull request! Reviewer note: cargo-semver-checks reported the current version number is not SemVer-compatible with the changes in this pull request (compared against the base branch). Details |
LiaCastaneda
left a comment
There was a problem hiding this comment.
iiuc the motivation of this PR is: this function already existed but was not part of the trait. This PR updates it to be part of the trait because, for #23814, we need to differentiate which nodes are consumers and which are producers, and this function was implemented only by producers (and used for serialization, for example)
I guess we could use apply_expressions, downcast to the node, and then decide which nodes are producers and which are consumers. However, that might not be the cleanest approach, since the list of producers might vary.
| fn dynamic_expressions(&self) -> Vec<Arc<dyn PhysicalExpr>> { | ||
| Vec::new() | ||
| } |
There was a problem hiding this comment.
Do you think a better name would be dynamic_expressions_produced, or something that indicates it only returns dynamic filters that are produced? I think this name can be a bit misleading and might be interpreted as returning any dynamic filters the node is holding, whether it is a consumer holding the dynamic filters it will consume or a producer holding the dynamic filters it will produce. I had to read this comment to understand the motivation behind it
| vec![&self.left, &self.right] | ||
| } | ||
|
|
||
| fn dynamic_expressions(&self) -> Vec<Arc<dyn PhysicalExpr>> { |
There was a problem hiding this comment.
If this function is supposed to be the promotion of the non trait function dynamic_filter_expr, should we remove dynamic_filter_expr?
Which issue does this PR close?
ExecutionPlannodes discoverable #23814Rationale for this change
External users who wish to propagate dynamic filter updates across network boundaries need to know in which direction updates need to flow. Thus
ExecutionPlan::apply_expressionsis not enough. The proposal in #23814 is to provide a separate API for dynamic filter producers.What changes are included in this PR?
This change adds a new method
ExecutionPlan::dynamic_expressions(&self) -> Vec<Arc<dyn PhysicalExpr>>which should return dynamic filters produced by theExecutionPlan.Are these changes tested?
Yes. Adds a new invariant that all expressions returned by
ExecutionPlan::dynamic_expressionshave an expression id.Are there any user-facing changes?
There's a new API,
ExecutionPlan::dynamic_expressions(&self) -> Vec<Arc<dyn PhysicalExpr>>