[fix](set operation) Use regular child output for set operation rules#64908
Conversation
### What problem does this PR solve? Issue Number: None Related PR: apache#64900, apache#64906 Problem Summary: Some Nereids rewrite rules mapped set operation outputs to child outputs by list index. Set operations can carry regulator child outputs whose order and cardinality differ from the child plan output, so those rules could read past the child output or rewrite expressions with the wrong child slot. This change makes one-row union merge and distinct TopN/Limit pushdown build child mappings from regular child outputs instead. ### Release note Fix planner failures or incorrect set operation rewrites when regulated child outputs differ from child plan outputs. ### Check List (For Author) - Test: Regression test / Unit Test - ./run-fe-ut.sh --run org.apache.doris.nereids.rules.rewrite.SetOperationOutputMappingTest - cd fe && mvn checkstyle:check -pl fe-core - ./run-regression-test.sh --run -d nereids_rules_p0/push_down_top_n -s push_down_top_n_distinct_through_union - ./run-regression-test.sh --run -d nereids_rules_p0/push_down_limit_distinct -s push_down_limit_distinct_through_union - ./run-regression-test.sh --run -d nereids_rules_p0/merge_one_row_relation -s merge_one_row_relation_into_union - Behavior changed: Yes (fixes set operation rewrites to use regular child outputs) - Does this need documentation: No
|
/review |
|
run buildall |
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
There was a problem hiding this comment.
Automated review found one blocking issue: the new regression EXPLAIN cases use plain sql, so they execute but do not compare the shape plan golden output. Inline comments mark each instance.
Checkpoint conclusions:
- Goal/scope: The code change is focused on using
regularChildrenOutputsin set-operation rewrites, and the implementation path appears semantically consistent after tracingBindExpression.bindSetOperation,LogicalUnion, expression replacement, and physical union translation. - Tests: FE unit tests target the internal mapping, but the added regression coverage is incomplete because the new planner-session EXPLAIN statements are not
qt_checks and add no.outresults. - Concurrency/lifecycle/config/compatibility/persistence/storage/cloud: not involved by this FE optimizer/test-only PR.
- Parallel paths: one-row merge plus limit/topN distinct union paths were reviewed; no additional rewrite issue was found.
- Validation:
git diff --checkpassed. I did not run FE/regression tests locally becausethirdparty/installed/bin/protocis absent in this checkout.
Subagent conclusions:
- optimizer-rewrite: no optimizer semantic or mapping candidates; final convergence round returned
NO_NEW_VALUABLE_FINDINGS. - tests-session-config: TSC-1 accepted as the inline regression-test issue; final convergence round returned
NO_NEW_VALUABLE_FINDINGS.
User focus: no additional focus was provided.
TPC-H: Total hot run time: 29252 ms |
TPC-DS: Total hot run time: 171538 ms |
ClickBench: Total hot run time: 25.17 s |
FE UT Coverage ReportIncrement line coverage |
FE Regression Coverage ReportIncrement line coverage |
|
PR approved by at least one committer and no changes requested. |
…#64908) ### What problem does this PR solve? Related PR: #24060, #27628 Problem Summary: Some Nereids rewrite rules mapped set operation outputs to child outputs by list index. Set operations can carry regulator child outputs whose order and cardinality differ from the child plan output, so those rules could read past the child output or rewrite expressions with the wrong child slot. This change makes one-row union merge and distinct TopN/Limit pushdown build child mappings from regular child outputs instead. ### Release note Fix planner failures or incorrect set operation rewrites when regulated child outputs differ from child plan outputs.
…#64908) ### What problem does this PR solve? Related PR: #24060, #27628 Problem Summary: Some Nereids rewrite rules mapped set operation outputs to child outputs by list index. Set operations can carry regulator child outputs whose order and cardinality differ from the child plan output, so those rules could read past the child output or rewrite expressions with the wrong child slot. This change makes one-row union merge and distinct TopN/Limit pushdown build child mappings from regular child outputs instead. ### Release note Fix planner failures or incorrect set operation rewrites when regulated child outputs differ from child plan outputs.
…ration rules #64908 (#65071) Cherry-picked from #64908 Co-authored-by: morrySnow <[email protected]>
…ration rules #64908 (#65070) Cherry-picked from #64908 Co-authored-by: morrySnow <[email protected]>
What problem does this PR solve?
Related PR: #24060, #27628
Problem Summary: Some Nereids rewrite rules mapped set operation outputs to child outputs by list index. Set operations can carry regulator child outputs whose order and cardinality differ from the child plan output, so those rules could read past the child output or rewrite expressions with the wrong child slot. This change makes one-row union merge and distinct TopN/Limit pushdown build child mappings from regular child outputs instead.
Release note
Fix planner failures or incorrect set operation rewrites when regulated child outputs differ from child plan outputs.
Check List (For Author)