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 2022/12/21 07:43:31 UTC

[GitHub] [spark] gengliangwang commented on a diff in pull request #39152: [SPARK-41660][SQL] Only propagate metadata columns if they are used

gengliangwang commented on code in PR #39152:
URL: https://github.com/apache/spark/pull/39152#discussion_r1054068399


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala:
##########
@@ -1012,15 +1012,18 @@ class Analyzer(override val catalogManager: CatalogManager)
       })
     }
 
-    private def addMetadataCol(plan: LogicalPlan): LogicalPlan = plan match {
-      case s: ExposesMetadataColumns => s.withMetadataColumns()
-      case p: Project =>
+    private def addMetadataCol(
+        plan: LogicalPlan,
+        isRequired: Attribute => Boolean): LogicalPlan = plan match {
+      case s: ExposesMetadataColumns if s.metadataOutput.exists(isRequired) =>
+        s.withMetadataColumns()

Review Comment:
   Since we are doing this, shall we propagate the required metadata columns only?



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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