allisonwang-db commented on a change in pull request #32787:
URL: https://github.com/apache/spark/pull/32787#discussion_r658450441



##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala
##########
@@ -1571,6 +1582,26 @@ class Analyzer(override val catalogManager: 
CatalogManager)
       }
     }
 
+    // Expand the star expression using the input plan first. If failed, try 
resolve
+    // the star expression using the outer query plan and wrap the resolved 
attributes
+    // in outer references. Otherwise throw the original exception.
+    private def expand(s: Star, plan: LogicalPlan): Seq[NamedExpression] = {
+      withPosition(s) {
+        try {
+          s.expand(plan, resolver)
+        } catch {
+          case e: AnalysisException =>
+            AnalysisContext.get.outerPlan.map(p =>
+              // Only a few unary nodes (Project/Aggregate) can host star 
expressions.
+              Try(s.expand(p.children.head, resolver)) match {

Review comment:
       Join can't host star expressions I think. Only star expressions in 
Project and Aggregate are handled in the Analyzer. 




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to