Github user davies commented on a diff in the pull request:
https://github.com/apache/spark/pull/12306#discussion_r60008476
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/CheckAnalysis.scala
---
@@ -110,6 +110,31 @@ trait CheckAnalysis {
s"filter expression '${f.condition.sql}' " +
s"of type ${f.condition.dataType.simpleString} is not a
boolean.")
+ case f @ Filter(condition, child) =>
+ // Make sure no correlated predicate is in an OUTER join,
because this could change the
+ // semantics of the join.
+ lazy val attributes: Set[Expression] = child.output.toSet
+ def checkCorrelatedPredicates(p: PredicateSubquery): Unit =
p.query.foreach {
+ case j @ Join(left, right, jt, _) if jt != Inner =>
+ j.transformAllExpressions {
+ case e if attributes.contains(e) =>
+ failAnalysis(s"Accessing outer query column is not
allowed in outer joins: $e")
+ }
+ case _ =>
+ }
+ splitConjunctivePredicates(condition).foreach {
+ case p: PredicateSubquery =>
+ checkCorrelatedPredicates(p)
+ case Not(InSubQuery(_, query)) if
query.output.exists(_.nullable) =>
+ failAnalysis("NOT IN with nullable subquery is not
supported. " +
--- End diff --
This is something we should support eventually, but not now. so throwing a
NotImplementedException is not worse than throwing an AnalysisError.
---
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]