Github user scwf commented on a diff in the pull request:

    https://github.com/apache/spark/pull/4812#discussion_r27392069
  
    --- Diff: sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveQl.scala ---
    @@ -619,10 +619,26 @@ 
https://cwiki.apache.org/confluence/display/Hive/Enhanced+Aggregation%2C+Cube%2C
               case Some(f) => nodeToRelation(f)
               case None => NoRelation
             }
    - 
    +
    +        val not = "(?i)not".r
    +        val exists = "(?i)exists".r
    +
             val withWhere = whereClause.map { whereNode =>
    -          val Seq(whereExpr) = whereNode.getChildren.toSeq
    -          Filter(nodeToExpr(whereExpr), relations)
    +          val Seq(clause) = whereNode.getChildren.toSeq
    +          clause match {
    +            case Token(not(),
    +                   Token("TOK_SUBQUERY_EXPR",
    +                     Token("TOK_SUBQUERY_OP", Token(exists(), Nil) :: Nil) 
::
    +                     subquery :: Nil) :: Nil) =>
    +              Exists(relations, nodeToPlan(subquery), false)
    +            case Token("TOK_SUBQUERY_EXPR",
    +                   Token("TOK_SUBQUERY_OP", Token(exists(), Nil) :: Nil) ::
    +                   subquery :: Nil) =>
    +              Exists(relations, nodeToPlan(subquery), true)
    +            // TODO add IN and NOT IN
    +            case whereExpr =>
    +              Filter(nodeToExpr(whereExpr), relations)
    +          }
    --- End diff --
    
    Seems this do not support sql with both predicts and exists in where clause:
    ```
    select * 
    from src b 
    where 
    (not exists 
      (select a.key 
      from src a 
      where b.value = a.value  and a.key = b.key and a.value > 'val_2'
      )
    ) and key > 1
    ;
    ```
    



---
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]

Reply via email to