wangyum commented on a change in pull request #31993:
URL: https://github.com/apache/spark/pull/31993#discussion_r612033519
##########
File path:
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/PushDownUtils.scala
##########
@@ -89,14 +93,12 @@ object PushDownUtils extends PredicateHelper {
} else {
new StructType()
}
- r.pruneColumns(prunedSchema)
+ val neededFieldNames = neededOutput.map(_.name).toSet
+ r.pruneColumns(StructType(prunedSchema.filter(f =>
neededFieldNames.contains(f.name))))
Review comment:
Move [filter logical from
`SchemaPruning`](https://github.com/apache/spark/blob/0f2c0b53e8fb18c86c67b5dd679c006db93f94a5/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/SchemaPruning.scala#L38-L39)
to `PushDownUtils` to support datasource V2 column pruning.
--
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]