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

    https://github.com/apache/spark/pull/9055#discussion_r42581783
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala
 ---
    @@ -270,6 +273,146 @@ class Analyzer(
       }
     
       /**
    +   * Rewrite the [[Exists]] [[In]] with left semi join or anti join.
    +   */
    +  object RewriteFilterSubQuery extends Rule[LogicalPlan] with 
PredicateHelper {
    +    def unapply(condition: Expression): Option[(Expression, 
Seq[Expression])] = {
    +      if (condition.resolved == false) {
    +        return None
    +      }
    +
    +      val conjuctions = splitConjunctivePredicates(condition).map(_ 
transformDown {
    +          // Remove the Cast expression for SubQueryExpression.
    +          case Cast(f: SubQueryExpression, BooleanType) => f
    +        }
    +      )
    +
    +      val (subqueries, others) = conjuctions.partition(c => 
c.isInstanceOf[SubQueryExpression])
    +      if (subqueries.isEmpty) {
    +        None
    +      } else if (subqueries.length > 1) {
    +        throw new AnalysisException(
    +          s"Only 1 SubQuery expression is supported, but we got 
$subqueries")
    --- End diff --
    
    Looks like the error message is not very user-friendly. I think we need to 
be more specific on why the query is not supported.


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