[fix](fe) Fix invalid semi-join transpose when the bottom join is a mark join - #66574
Draft
starocean999 wants to merge 1 commit into
Draft
[fix](fe) Fix invalid semi-join transpose when the bottom join is a mark join#66574starocean999 wants to merge 1 commit into
starocean999 wants to merge 1 commit into
Conversation
Contributor
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
Contributor
Author
|
run buildall |
Contributor
TPC-H: Total hot run time: 28806 ms |
Contributor
TPC-DS: Total hot run time: 159090 ms |
Contributor
ClickBench: Total hot run time: 24.05 s |
Contributor
FE Regression Coverage ReportIncrement line coverage |
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: #xxx
Problem Summary:
A query with a subquery inside the ON condition of an anti join failed at
physical planning with "A expression contains slot not from children", e.g.:
The subquery is unnested into a mark join
(t1 LEFT ANTI JOIN t3)that producesa mark slot, and the outer anti join references the mark slot in its conjuncts.
Root cause: the exploration rule
SemiJoinSemiJoinTransposeProjecttransposestwo nested left semi/anti joins
(A ⟕̸ B) ⟕̸ Cinto(A ⟕̸ C) ⟕̸ B. When thebottom join
(A ⟕̸ B)is a mark join, the transposed plan buildsnewBottomSemi = (A ⟕̸ C)from the top join, inheriting the top join's conjunctsthat reference the bottom mark slot, while the mark slot is now produced above by
the new top mark join. The mark slot is therefore referenced by a join whose
children don't output it, and physical planning fails with "slot not from
children".
The fix rejects the transpose when the bottom semi join is a mark join and the
top semi join references the bottom mark slot in its conjuncts, so the mark join
is always kept below the join that consumes the mark slot. After the fix the
query above executes correctly and returns the expected result.
Release note
None
Check List (For Author)
Test
Behavior changed:
Does this need documentation?
Check List (For Reviewer who merge this PR)