rdblue commented on a change in pull request #28027:
URL: https://github.com/apache/spark/pull/28027#discussion_r512967572



##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/execution/datasources/v2/DataSourceV2Relation.scala
##########
@@ -48,6 +48,15 @@ case class DataSourceV2Relation(
 
   import DataSourceV2Implicits._
 
+  override lazy val metadataOutput: Seq[AttributeReference] = table match {
+    case hasMeta: SupportsMetadataColumns =>
+      val attrs = hasMeta.metadataColumns
+      val outputNames = outputSet.map(_.name).toSet
+      attrs.filterNot(col => outputNames.contains(col.name)).toAttributes

Review comment:
       You're right that this should respect the case sensitivity setting. I'll 
update it.
   
   I'd rather not use a struct for metadata columns. I think that would make 
them harder to produce and would also introduce an unnecessary row copy in a 
lot of cases. For example, if I run `select id, metadata._file`, then the 
source will produce something like `struct(id=1, 
metadata=struct(_file='path.parquet'))`, which would then be copied into the 
expected `struct(id=1, _file='path.parquet')`.
   
   I also thought that we would like to get away from using a function that 
behaves differently based on its context, like `input_file_name`. It is better 
to project `_file`, right?




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