Skip to content

branch:4.2: [fix](using join) Fix USING JOIN merge key for RIGHT/FULL OUTER and RIGHT SEMI joins #64718 - #68287

Open
morrySnow wants to merge 3 commits into
apache:branch-4.2from
morrySnow:pick-64718-to-branch-4.2
Open

morrySnow wants to merge 3 commits into
apache:branch-4.2from
morrySnow:pick-64718-to-branch-4.2

Conversation

@morrySnow

Copy link
Copy Markdown
Contributor

picked from #64718

Issue Number: None

Related PR: None

Problem Summary: USING JOIN merge key output in Nereids was inconsistent across join types and star expansion forms. RIGHT and FULL OUTER USING joins could expose the wrong nullable side as the merged key, RIGHT SEMI style joins could lose the merged key from SELECT * output, qualified table.* expansion could hide the original qualified USING keys, and chained USING joins could re-expose keys that an inner USING project had already hidden. The fix moves merge-key construction into a LogicalProject above the join, keeps LogicalJoin output complete for qualified references, distinguishes unqualified star expansion from qualified star expansion, stores explicit asterisk outputs on LogicalProject, and propagates child asterisk outputs through chained USING joins.

None

- Test: Unit Test / Regression test attempted
    - Unit Test: ./run-fe-ut.sh --run org.apache.doris.nereids.rules.analysis.BindUsingJoinTest
    - Regression test attempted: ./run-regression-test.sh --run -d query_p0/join -s test_using_join_merge_key (local running FE service did not include current FE changes, so the result was not used)
- Behavior changed: Yes (USING JOIN SELECT * now exposes the correct merged key while qualified table.* keeps the table's original USING key)
- Does this need documentation: No

(cherry picked from commit cb74cf4)
@morrySnow
morrySnow requested a review from yiguolei as a code owner September 20, 2026 18:01
@hello-stephen

Copy link
Copy Markdown
Contributor

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR.

Please clearly describe your PR:

  1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
  2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
  3. What features were added. Why was this function added?
  4. Which code was refactored and why was this part of the code refactored?
  5. Which functions were optimized and what is the difference before and after the optimization?

@morrySnow

Copy link
Copy Markdown
Contributor Author

run buildall

@hello-stephen

Copy link
Copy Markdown
Contributor

FE UT Coverage Report

Increment line coverage 87.50% (63/72) 🎉
Increment coverage report
Complete coverage report

@hello-stephen

Copy link
Copy Markdown
Contributor

FE Regression Coverage Report

Increment line coverage 91.67% (66/72) 🎉
Increment coverage report
Complete coverage report

@morrySnow morrySnow changed the title branch:4.1: [fix](using join) Fix USING JOIN merge key for RIGHT/FULL OUTER and RIGHT SEMI joins #64718 branch:4.2: [fix](using join) Fix USING JOIN merge key for RIGHT/FULL OUTER and RIGHT SEMI joins #64718 Sep 20, 2026
@morrySnow

Copy link
Copy Markdown
Contributor Author

run buildall

@morrySnow

Copy link
Copy Markdown
Contributor Author

run buildall

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants