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



##########
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)
 
     case plan if SQLConf.get.nestedSchemaPruningEnabled && canPruneOn(plan) =>

Review comment:
       No big deal but I would rename `plan` to `p` to avoid shadowing the 
`plan` var. At least my IDE complains on that.

##########
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)
 
     case plan if SQLConf.get.nestedSchemaPruningEnabled && canPruneOn(plan) =>

Review comment:
       No big deal but I would rename `plan` to `p` to avoid shadowing the 
`plan` argument. At least my IDE complains on that.




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