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

    https://github.com/apache/spark/pull/16954#discussion_r103398818
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala
 ---
    @@ -707,13 +709,85 @@ class Analyzer(
               } transformUp {
                 case other => other transformExpressions {
                   case a: Attribute =>
    -                
attributeRewrites.get(a).getOrElse(a).withQualifier(a.qualifier)
    +                dedupAttr(a, attributeRewrites)
    +              case s: SubqueryExpression =>
    +                s.withNewPlan(dedupOuterReferencesInSubquery(s.plan, 
attributeRewrites))
                 }
               }
               newRight
           }
         }
     
    +    private def dedupAttr(attr: Attribute, attrMap: 
AttributeMap[Attribute]): Attribute = {
    +      attrMap.get(attr).getOrElse(attr).withQualifier(attr.qualifier)
    +    }
    +
    +    /**
    +     * The outer plan may have been de-duplicated and the function below 
updates the
    +     * outer references to refer to the de-duplicated attributes.
    +     *
    +     * For example (SQL):
    +     * {{{
    +     *   SELECT * FROM t1
    +     *   WHERE EXISTS (SELECT 1
    +     *                 FROM t2
    +     *                 WHERE t1.c1 = t2.c1)
    +     *   INTERSECT
    +     *   SELECT * FROM t1
    +     *   WHERE EXISTS (SELECT 1
    +     *                 FROM t2
    +     *                 WHERE t1.c1 = t2.c1)
    +     * }}}
    +      * Plan before resolveReference rule.
    --- End diff --
    
    @hvanhovell I will work on a smaller example. I think we don't need the 
subquery expression in the left plan. That should cut down the plan size.


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

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

Reply via email to