viirya commented on a change in pull request #34845:
URL: https://github.com/apache/spark/pull/34845#discussion_r766282637



##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/NestedColumnAliasing.scala
##########
@@ -414,6 +409,23 @@ object GeneratorNestedColumnAliasing {
       None
   }
 
+  /**
+   * Replace the refernece attribute of extractor expression with generator 
input.
+   */
+  private def replaceGenerator(generator: ExplodeBase, expr: Expression): 
Expression = {
+    expr.transformDown {
+      case _: Attribute =>
+        generator.child

Review comment:
       Oh, this is good point. For `GetStructField`, because we simply replace 
with another `ExtractValue`, I think we are fine. For `Attribute` case, if 
`generator.child` is not an attribute but, for example, another `ExtractValue`, 
we might wrongly recursively transform down.
   
   We should add a guard here. I will update it too.




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

To unsubscribe, e-mail: [email protected]

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