ulysses-you commented on code in PR #39870:
URL: https://github.com/apache/spark/pull/39870#discussion_r1096871625


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/execution/datasources/v2/DataSourceV2Relation.scala:
##########
@@ -54,15 +54,18 @@ case class DataSourceV2Relation(
 
   override lazy val metadataOutput: Seq[AttributeReference] = table match {
     case hasMeta: SupportsMetadataColumns =>
-      val resolve = conf.resolver
-      val outputNames = outputSet.map(_.name)
-      def isOutputColumn(col: MetadataColumn): Boolean = {
-        outputNames.exists(name => resolve(col.name, name))
+      getTagValue(CACHED_META_OUTPUT_TAG).getOrElse {

Review Comment:
   yes, but there is a conflict in `AddMetadataColumns`. We will add a new 
project(original output),  see
   
https://github.com/apache/spark/blob/6bb68b5f75ac883423a68583750258656f381c33/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala#L995-L1002
   
   then with this case, it will be:
   ```scala
   Project (_metadata.file_size)
     Project(c)
       File (_metadata.file_size > 0)
         Relation c, metadataoutput
   ```
   
   I guess the original idea is we should always use children.metadataoutputs 
to do resolving to prevent exposing unnecessary metadata columns, isn't it ?



-- 
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: [email protected]

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