spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hvanhovell <...@git.apache.org>
Subject [GitHub] spark pull request: [SPARK-4226][SQL] Support Correlated Sub-queri...
Date Mon, 18 Apr 2016 05:44:51 GMT
Github user hvanhovell commented on a diff in the pull request:

    https://github.com/apache/spark/pull/12306#discussion_r60007877
  
    --- 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")
    --- End diff --
    
    A filter can be below a join, i.e.:
    
        SELECT *
        FROM     l
        WHERE EXISTS(SELECT *
                     FROM   r
                            LEFT JOIN (SELECT * FROM s WHERE s.id = l.id) t
                             ON t.id = r.id)
    
    But sure I'll add a test.
                                                   


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Mime
View raw message