dongjoon-hyun commented on a change in pull request #26978: [SPARK-29721][SQL] Prune unnecessary nested fields from Generate without Project URL: https://github.com/apache/spark/pull/26978#discussion_r369809823
########## File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/NestedColumnAliasing.scala ########## @@ -155,6 +155,49 @@ object NestedColumnAliasing { case MapType(keyType, valueType, _) => totalFieldNum(keyType) + totalFieldNum(valueType) case _ => 1 // UDT and others } +} + +/** + * This prunes unnessary nested columns from `Generate` and optional `Project` on top + * of it. + */ +object GeneratorNestedColumnAliasing { + def unapply(plan: LogicalPlan): Option[LogicalPlan] = plan match { + case Project(projectList, g: Generate) if (SQLConf.get.nestedPruningOnExpressions || + SQLConf.get.nestedSchemaPruningEnabled) && canPruneGenerator(g.generator) => Review comment: For the following, is this a new bug? Or, the side-effect of code sharing? > If nestedSchemaPruningEnabled is enabled, I think we should push down it through Project + Generate even nestedPruningOnExpressions is disabled. If not, nested column won't pushed down to scan node. ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org