Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/21745#discussion_r201971954
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala
 ---
    @@ -1167,7 +1169,8 @@ class Analyzer(
               case p: Project =>
                 val maybeResolvedExprs = exprs.map(resolveExpression(_, p))
                 val (newExprs, newChild) = 
resolveExprsAndAddMissingAttrs(maybeResolvedExprs, p.child)
    -            val missingAttrs = AttributeSet(newExprs) -- 
AttributeSet(maybeResolvedExprs)
    +            // Only add missing attributes coming from `newChild`.
    +            val missingAttrs = (AttributeSet(newExprs) -- 
p.outputSet).intersect(newChild.outputSet)
    --- End diff --
    
    The logic gets convoluted here and we need to add comments. Basically we 
need to explain when we should expand the project list.


---

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

Reply via email to