beliefer commented on code in PR #52451:
URL: https://github.com/apache/spark/pull/52451#discussion_r2380700805
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/v2Commands.scala:
##########
@@ -915,12 +915,13 @@ object MergeIntoTable {
matchedActions: Iterable[MergeAction],
notMatchedActions: Iterable[MergeAction],
notMatchedBySourceActions: Iterable[MergeAction]):
Seq[TableWritePrivilege] = {
- val privileges =
scala.collection.mutable.HashSet.empty[TableWritePrivilege]
- (matchedActions.iterator ++ notMatchedActions ++
notMatchedBySourceActions).foreach {
- case _: DeleteAction => privileges.add(TableWritePrivilege.DELETE)
- case _: UpdateAction | _: UpdateStarAction =>
privileges.add(TableWritePrivilege.UPDATE)
- case _: InsertAction | _: InsertStarAction =>
privileges.add(TableWritePrivilege.INSERT)
- }
+ val privileges = (matchedActions ++ notMatchedActions ++
notMatchedBySourceActions)
+ .collect {
+ case _: DeleteAction => TableWritePrivilege.DELETE
+ case _: UpdateAction | _: UpdateStarAction =>
TableWritePrivilege.UPDATE
+ case _: InsertAction | _: InsertStarAction =>
TableWritePrivilege.INSERT
+ }
+ .toSet
Review Comment:
@LuciferYang You said right. But the size of actions here is very small.
--
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]