Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
1.21.0
Description
The rule PruneEmptyRules#JOIN_RIGHT_INSTANCE "converts a Join to empty if its right child is empty", e.g.
Join(Scan(Emp), Empty, INNER) becomes Empty
The rule verifies that the join type cannot be LEFT / FULL, and the transformation is not performed in those cases:
if (join.getJoinType().generatesNullsOnRight()) { // i.e. JoinType == LEFT || JoinType == FULL // "select * from emp left join dept" is not necessarily empty if dept is empty return; }
However in case of ANTI, it performs the transformation:
Join(Scan(Emp), Empty, ANTI) becomes Empty
but this transformation is wrong for anti-join, in this case the actual result should be:
Join(Scan(Emp), Empty, ANTI) becomes Scan(Emp)
in case of anti equi-join (in case of non-equi, no transformation shall be made).
Attachments
Issue Links
- relates to
-
CALCITE-3837 AntiJoin with empty right input can always be transformed as its left input
- Closed
- links to