[refactor](fe) Refine volatile expression handling#63403
Merged
Conversation
Move volatile checks onto ExpressionTrait and let volatile expressions share the same caller path. Clean up UniqueFunction identity storage to rely on VolatileIdentity and expand the project-alias rewrite to volatile expressions. Key changes: - Use VolatileIdentity as the single identity holder for UniqueFunction and subclasses. - Rename AddProjectForUniqueFunction to AddProjectForVolatileExpression and apply it to volatile expressions. - Move containsVolatileExpression/isVolatile helpers to ExpressionTrait and update related call sites. Unit Test: - AddProjectForVolatileExpressionTest - UdfVolatilityTest - UniqueFunctionTest
Contributor
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
Contributor
Author
|
run buildall |
Contributor
Author
|
/review |
Fix the FE checkstyle failure caused by the import order in ExpressionTrait. Key changes: - Reorder ExpressionTrait imports according to checkstyle. Unit Test: - ./build.sh --fe
Contributor
Author
|
run buildall |
Clarify that UniqueFunction overrides the volatile expression unique-id handling API with a covariant return type. Key changes: - Add @OverRide to UniqueFunction.withIgnoreUniqueId. Unit Test: - ./build.sh --fe
Contributor
Author
|
run buildall |
Contributor
TPC-H: Total hot run time: 31278 ms |
Contributor
TPC-DS: Total hot run time: 169490 ms |
Contributor
TPC-H: Total hot run time: 31116 ms |
Contributor
TPC-DS: Total hot run time: 169291 ms |
Contributor
FE Regression Coverage ReportIncrement line coverage |
starocean999
approved these changes
May 20, 2026
Contributor
|
PR approved by at least one committer and no changes requested. |
Contributor
|
PR approved by anyone and no changes requested. |
Contributor
|
/review |
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.
What problem does this PR solve?
Issue Number: close #xxx
Related PR: #62698
Problem Summary:
PR #62698 introduced the UDF volatility property and added
VolatileExpression/VolatileIdentityso volatile UDF calls can carry per-call identity and avoid unsafe optimizer rewrites.This PR is a follow-up refactoring for that change. It removes duplicated unique identity state from
UniqueFunction, keepsVolatileIdentityas the single identity holder, moves volatile-expression helper methods intoExpressionTrait, and expands the formerAddProjectForUniqueFunctionrewrite to operate on volatile expressions rather than only unique functions.Release note
None
Check List (For Author)
Test
AddProjectForVolatileExpressionTestUdfVolatilityTestUniqueFunctionTestBehavior changed:
Does this need documentation?
Check List (For Reviewer who merge this PR)