HyukjinKwon commented on a change in pull request #28556:
URL: https://github.com/apache/spark/pull/28556#discussion_r439257774



##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/NestedColumnAliasing.scala
##########
@@ -34,7 +34,8 @@ object NestedColumnAliasing {
     : Option[(Map[ExtractValue, Alias], Map[ExprId, Seq[Alias]])] = plan match 
{
     case Project(projectList, child)
         if SQLConf.get.nestedSchemaPruningEnabled && 
canProjectPushThrough(child) =>
-      getAliasSubMap(projectList)
+      val exprCandidatesToPrune = projectList ++ child.expressions
+      getAliasSubMap(exprCandidatesToPrune, child.producedAttributes.toSeq)

Review comment:
       @viirya, just to clarify, you added `producedAttributes` here just to be 
safe but not related to the current changes (?). Seems `Join` and 
`RepartitionByExpression` have an empty `producedAttributes`.

##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/NestedColumnAliasing.scala
##########
@@ -34,7 +34,8 @@ object NestedColumnAliasing {
     : Option[(Map[ExtractValue, Alias], Map[ExprId, Seq[Alias]])] = plan match 
{
     case Project(projectList, child)
         if SQLConf.get.nestedSchemaPruningEnabled && 
canProjectPushThrough(child) =>
-      getAliasSubMap(projectList)
+      val exprCandidatesToPrune = projectList ++ child.expressions
+      getAliasSubMap(exprCandidatesToPrune, child.producedAttributes.toSeq)

Review comment:
       @viirya, just to clarify, you added `producedAttributes` here just to be 
safe but not related to the current changes (?). Seems `Join` and 
`RepartitionByExpression` have an empty `producedAttributes`.

##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/NestedColumnAliasing.scala
##########
@@ -34,7 +34,8 @@ object NestedColumnAliasing {
     : Option[(Map[ExtractValue, Alias], Map[ExprId, Seq[Alias]])] = plan match 
{
     case Project(projectList, child)
         if SQLConf.get.nestedSchemaPruningEnabled && 
canProjectPushThrough(child) =>
-      getAliasSubMap(projectList)
+      val exprCandidatesToPrune = projectList ++ child.expressions
+      getAliasSubMap(exprCandidatesToPrune, child.producedAttributes.toSeq)

Review comment:
       @viirya, just to clarify, you added `producedAttributes` here just to be 
safe but not related to the current changes (?). Seems `Join` and 
`RepartitionByExpression` have an empty `producedAttributes`.




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