branch-4.0: [fix](project push down) union and its children's output are mis order #58765#59886
Merged
yiguolei merged 1 commit intobranch-4.0from Jan 15, 2026
Merged
Conversation
#58765) ### What problem does this PR solve? Related PR: #57204 Problem Summary: This pull request refactors and improves the `PushDownProject` rule in the Nereids optimizer, mainly focusing on the logic for pushing down projections through `UNION` operations. It also introduces a comprehensive unit test to verify the new logic, making the relevant methods more testable and robust. **Refactoring and Logic Improvements:** * Refactored the `pushThroughUnion` logic by extracting it into a new static method, making it easier to test and use independently. The main logic now takes explicit arguments instead of relying on the context object. * Improved the handling of projections and child outputs when pushing down through `UNION`, ensuring correct mapping and replacement of slots. This includes using regulator outputs for children and constant expressions, and making the slot replacement logic static for better testability. **Testing Enhancements:** * Added a new unit test class `PushDownProjectTest` to rigorously test the pushdown logic in various scenarios, including unions with and without children. The tests verify both the structure and the correctness of the rewritten plans. **Code Quality Improvements:** * Added the `@VisibleForTesting` annotation and imported necessary dependencies to clarify method visibility and intent for testing. * Replaced some usages of `Collection` with `List` for better type safety and clarity in projection handling. These changes make the projection pushdown logic more modular, testable, and robust, and provide strong test coverage for future maintenance.
Contributor
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
Contributor
|
run buildall |
Contributor
FE UT Coverage ReportIncrement line coverage |
yiguolei
approved these changes
Jan 15, 2026
ybtsdst
pushed a commit
to ybtsdst/doris
that referenced
this pull request
Feb 27, 2026
…are mis order apache#58765 (apache#59886) Cherry-picked from apache#58765 Co-authored-by: morrySnow <zhangwenxin@selectdb.com>
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-picked from #58765