Skip to content

Refactor: expose predicate constant inference from physical-expr#21167

Open
xudong963 wants to merge 1 commit intoapache:mainfrom
xudong963:constant_pro
Open

Refactor: expose predicate constant inference from physical-expr#21167
xudong963 wants to merge 1 commit intoapache:mainfrom
xudong963:constant_pro

Conversation

@xudong963
Copy link
Copy Markdown
Member

@xudong963 xudong963 commented Mar 26, 2026

Which issue does this PR close?

  • Closes #.

Rationale for this change

The predicate constant inference logic is helpful, we also use it in in our product, but we just copied that becuase it's now in the filter's method.

What changes are included in this PR?

The PR extracts the related logic into a helper method in physical expr.

Are these changes tested?

Yes

Are there any user-facing changes?

@github-actions github-actions bot added physical-expr Changes to the physical-expr crates physical-plan Changes to the physical-plan crate labels Mar 26, 2026
Copy link
Copy Markdown
Member

@asolimando asolimando left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, it's nice to expose helpers like this more broadly, it's convenient wherever you have an expression/predicate, which is not necessarily a filter

Copy link
Copy Markdown
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @xudong963 and @asolimando

split_impl(Operator::And, predicate, vec![])
}

/// Collects predicate-derived constants from equality conjunctions.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To make this more discoverable (aka a greater chance that someone will be able to find it). I recommend making this a method on ConstExpr

So like

let const_exprs = ConstExpr::collect_predicate_constants(,,)

Also, I think an example or two might help (not necessairly code examples, but textural)

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 physical-plan Changes to the physical-plan crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants