cloud-fan commented on a change in pull request #34575:
URL: https://github.com/apache/spark/pull/34575#discussion_r772199075



##########
File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/FileSourceStrategy.scala
##########
@@ -225,8 +238,18 @@ object FileSourceStrategy extends Strategy with 
PredicateHelper with Logging {
           dataFilters,
           table.map(_.identifier))
 
+      // extra Project node: wrap flat metadata columns to a metadata struct
+      val withMetadataProjections = metadataStructOpt.map { metadataStruct =>
+        val metadataAlias =
+          Alias(CreateStruct(metadataColumns), METADATA_NAME)(exprId = 
metadataStruct.exprId)
+        execution.ProjectExec(
+          scan.output.filterNot(metadataColumns.contains) :+ metadataAlias, 
scan)

Review comment:
       nit: `scan.output.dropRight(metadataColumns.length)`




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