Github user nsyca commented on the issue:
https://github.com/apache/spark/pull/14899
With the fix in this PR, the Analyzed Logical Plan and Optimized Logical
Plan become:
```
== Analyzed Logical Plan ==
c3: int
Project [c3#123]
+- Filter NOT predicate-subquery#124 [(c3#123 = c2#133)]
: +- Project [c2#133]
: +- SubqueryAlias t2
: +- Project [value#107 AS c2#133]
: +- LocalRelation [value#107]
+- SubqueryAlias t3
+- Project [(c2#132 + 1) AS c3#123]
+- Join LeftOuter, (c1#131 = c2#132)
:- SubqueryAlias t1
: +- Project [value#100 AS c1#131]
: +- LocalRelation [value#100]
+- SubqueryAlias t2
+- Project [value#107 AS c2#132]
+- LocalRelation [value#107]
== Optimized Logical Plan ==
Project [(c2#132 + 1) AS c3#123]
+- Join LeftAnti, (isnull(((c2#132 + 1) = c2#133)) || ((c2#132 + 1) =
c2#133))
:- Join LeftOuter, (c1#131 = c2#132)
: :- LocalRelation [c1#131]
: +- LocalRelation [c2#132]
+- LocalRelation [c2#133]
```
Here, the code generates a new `c2#133` for the T2 referenced in the NOT IN
predicate in the Analyzed Logical Plan. With now the two different `c2`, the
`PushPredicateThroughJoin` rule recognizes that the equality predicate `(c2#132
+ 1) = c2#133 [nullAware]` is not a so-called local predicate (predicate
referencing columns from a single relation) anymore and hence the predicate
(or, more precise, the LeftAnti operator) is not pushed down to the right table
`t2` of the LeftOuter.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]