morrySnow opened a new pull request, #64906:
URL: https://github.com/apache/doris/pull/64906
### What problem does this PR solve?
Issue Number: None
Related PR: #24060
Problem Summary: MergeOneRowRelationIntoUnion previously built constant rows
by matching one-row child projects to UNION outputs by list index. When a UNION
child output used a different position or fewer columns than the one-row child
projects, the rewrite could read past the UNION output list or place the wrong
constant into the UNION constant expression list. The fix builds a
slot-to-expression map from the one-row child and rewrites each regular child
output expression through that map, preserving the UNION child output order and
cardinality.
### Release note
Fix incorrect results or failures for UNION ALL constant queries whose
one-row child output order differs from the UNION output order.
### Check List (For Author)
- Test: Regression test / Unit Test
- ./run-fe-ut.sh --run
org.apache.doris.nereids.rules.rewrite.MergeOneRowRelationIntoUnionTest
- ./run-regression-test.sh --run -d query_p0/compress_materialize -s
compress_materialize -forceGenOut
- Behavior changed: Yes (fixes UNION constant-row rewrite to follow child
output mapping instead of project indexes)
- Does this need documentation: No
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]