cloud-fan commented on code in PR #52866:
URL: https://github.com/apache/spark/pull/52866#discussion_r2492347260
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/v2Commands.scala:
##########
@@ -990,6 +1019,71 @@ object MergeIntoTable {
CaseInsensitiveMap(fieldMap)
}
}
+
+ // Filter the source schema to retain only fields that are referenced
+ // by at least one merge action
+ def referencedSourceSchema(merge: MergeIntoTable): StructType = {
+
+ val assignments = merge.originalSourceActions.collect {
+ case a: UpdateAction => a.assignments.map(_.key)
+ case a: InsertAction => a.assignments.map(_.key)
+ }.flatten
+
+ val containsStarAction = merge.originalSourceActions.exists {
+ case _: UpdateStarAction => true
+ case _: InsertStarAction => true
+ case _ => false
+ }
+
+ def filterSchema(sourceSchema: StructType, basePath: Seq[String]):
StructType =
Review Comment:
@viirya do you know any existing util functions from nested column pruning
to do this work?
--
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]