You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2019/02/07 02:53:41 UTC

[GitHub] viirya commented on a change in pull request #23740: [SPARK-26837][SQL] Pruning nested fields from object serializers

viirya commented on a change in pull request #23740: [SPARK-26837][SQL] Pruning nested fields from object serializers
URL: https://github.com/apache/spark/pull/23740#discussion_r254532012
 
 

 ##########
 File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/Optimizer.scala
 ##########
 @@ -561,10 +561,31 @@ object ColumnPruning extends Rule[LogicalPlan] {
     case d @ DeserializeToObject(_, _, child) if !child.outputSet.subsetOf(d.references) =>
       d.copy(child = prunedChild(child, d.references))
 
-    case p @ Project(_, s: SerializeFromObject) if p.references != s.outputSet =>
+    case p @ Project(_, s: SerializeFromObject) =>
+      // Prunes individual serializer if it is not used at all by above projection.
       val usedRefs = p.references
       val prunedSerializer = s.serializer.filter(usedRefs.contains)
-      p.copy(child = SerializeFromObject(prunedSerializer, s.child))
+
+      val fields = SchemaPruning.identifyRootFields(p.projectList, Seq.empty)
+
+      if (SQLConf.get.serializerNestedSchemaPruningEnabled && fields.nonEmpty) {
+        // Prunes nested fields in serialzers.
+        val prunedSchema = SchemaPruning.pruneDataSchema(
 
 Review comment:
   I think we can skip pruning if `prunedSchema` is as same as original one. But I keep it simpler now for review. Can update it later.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org