Conversation
… for predicate pruning (apache#66906) ### What problem does this PR solve? Problem Summary: A project expression that computes a function over a uniform constant slot (e.g. `date_sub(dt, INTERVAL 1 DAY)` where `dt` is a uniform constant slot) did not propagate the resulting constant: `LogicalProject.computeUniform` only handled constant projects and bare slot aliases, so the projected slot had no uniform value and downstream constant propagation could not fold predicates over it. For a join predicate like `t1.dt = p.prev_dt` where `p.prev_dt` is such a projection, the predicate stayed unfolded, could not be pushed into the scan, and partition pruning failed. Fix: `LogicalProject`/`PhysicalProject`/`LogicalLoadProject.computeUniform` now fold a project expression whose input slots are all uniform constants: the constant values are substituted into the expression (new helper `ExpressionUtils.foldToConstantByUniformValues`) and the projected slot is registered as a uniform constant, so downstream constant propagation can fold predicates over it and push them into the scan for partition pruning. ### Release note None ### Check List (For Author) - Test: FE unit test ConstantProjectionFoldingTest (the uniform constant source is a filter predicate, independent of constant CTEs; asserts the outer scan prunes to the expected single partition). - Behavior changed: No - Does this need documentation: No
Contributor
Author
|
run buildall |
Contributor
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
Contributor
FE UT Coverage ReportIncrement line coverage |
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.
Cherry-pick of #66906 to branch-4.2
fix Fold function projections over uniform constants for predicate pruning