Open
Conversation
askalt
approved these changes
Feb 5, 2026
askalt
left a comment
There was a problem hiding this comment.
Thank you! The generalization looks good to me. We could combine all stuff needed to re-use plan in single rule and wrap the plan with it.
Introduces `PlaceholderExpr`, allowing placeholder parameters to be preserved in the physical plan. Previously, placeholders had to be resolved to literals before physical planning.
904da3e to
0691772
Compare
This commit introduces a mechanism to resolve placeholders in the execution plans. It adds a new `TransformPlanExec` that allows replacing `PlaceholderExpr` with values from `TaskContext` during the execution phase. This enables physical plan reuse for queries with parameters.
0691772 to
d02b869
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rationale for this change
Currently, DataFusion's support for placeholders is handled at the logical plan level. This requires re-planning every time parameter values change.
This PR introduces physical-level support for placeholders, allowing a physical plan to be created once and then executed multiple times with different parameter values. This should improve performance for repeated executions of the same query with different parameters by avoiding the overhead of physical planning.
What changes are included in this PR?
This PR introduces several key components to support physical placeholders:
PlaceholderExpr: A new physical expression that represents a placeholder in the physical plan. It stores the placeholder ID and its data type.
TransformPlanExec: A new execution plan node that can rewrite execution plans at execution time.
PhysicalExprResolver Optimizer Rule: Wraps the final optimized plan in a
TransformPlanExecif any unresolved placeholders are detected.TaskContext Update: Updated to carry
ParamValues.Are these changes tested?
TransformPlanExecandPhysicalExprResolverare tested with unit tests and SLT tests.Are there any user-facing changes?
Yes, a user can now build physical plan from a logical plan with placeholders.