Fix filter source variable not found bug in left join to semi join optimizer#25111
Merged
Conversation
feilong-liu
commented
May 14, 2025
| assertNotEquals(computeActual("EXPLAIN(TYPE DISTRIBUTED) " + sql).getOnlyValue().toString().indexOf("Aggregate"), -1); | ||
|
|
||
| // filter in right child of join | ||
| sql = "with t1 as (select * from (values (1, 2), (2, 3), (1, 0)) t(k1, k2)), t2 as (select * from (values (1, 2), (2, 3)) t(k1, k2)) select t1.k1, t1.k2 from t1 left join t2 on t1.k2=t2.k2 and t2.k1 > 1 where t2.k2 is null"; |
Contributor
Author
There was a problem hiding this comment.
Query to trigger the bug
21 tasks
This was referenced May 30, 2025
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.
Description
Fix a bug introduced in #24884
An example to trigger the bug is
which will return error like:
In this case, the right child of the left join will have more than one output variables (although only one variable will be used in the left join, which will be the join key), we cannot assume that the first output variable is the join key.
Motivation and Context
Fix a bug
Impact
Bug fix
Test Plan
Add unit test
Contributor checklist
Release Notes
Please follow release notes guidelines and fill in the release notes below.