Skip to content

feat: placeholders in execution plans#20169

Open
LLDay wants to merge 1 commit intoapache:mainfrom
LLDay:feat/placeholder-physical-expression
Open

feat: placeholders in execution plans#20169
LLDay wants to merge 1 commit intoapache:mainfrom
LLDay:feat/placeholder-physical-expression

Conversation

@LLDay
Copy link

@LLDay LLDay commented Feb 5, 2026

Rationale for this change

Part of #14342.

Previously, DataFusion required all placeholders to be resolved to literal values before physical planning. This limitation made it difficult to work in systems where physical plans might be cached or reused, or where resolution happens later in the execution pipeline.

By introducing PlaceholderExpr at the physical level, we allow the physical planner to handle unresolved placeholders. This is a logical next step for PR #20009 and part of the effort to improve plan reuse support in DataFusion.

What changes are included in this PR?

  • Introduced PlaceholderExpr as a new physical expression.
  • Updated the physical planner to support creating PlaceholderExpr when encountering Expr::Placeholder.
  • Updated the constant evaluator to correctly handle (skip) placeholders during optimization.

Are these changes tested?

Yes, SLTs have been added, which verifies that placeholders are correctly preserved in physical plans across a wide range of SQL queries.

Are there any user-facing changes?

Yes, users can now generate physical plans for queries containing unresolved placeholders. Attempting to execute these plans without resolving the placeholders will still result in an error, but the planning phase no longer requires their resolution.

Introduces `PlaceholderExpr`, allowing placeholder parameters to be
preserved in the physical plan. Previously, placeholders had to be
resolved to literals before physical planning.
@github-actions github-actions bot added physical-expr Changes to the physical-expr crates sqllogictest SQL Logic Tests (.slt) proto Related to proto crate labels Feb 5, 2026
@LLDay LLDay marked this pull request as ready for review February 5, 2026 13:30
@LLDay LLDay changed the title Placeholders in execution plans feat: placeholders in execution plans Feb 5, 2026
@LLDay
Copy link
Author

LLDay commented Feb 5, 2026

@askalt, you've already read the code. Could you take another look at it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

physical-expr Changes to the physical-expr crates proto Related to proto crate sqllogictest SQL Logic Tests (.slt)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant