aokolnychyi commented on code in PR #51091:
URL: https://github.com/apache/spark/pull/51091#discussion_r2167382707
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/MergeRowsExec.scala:
##########
@@ -203,23 +223,35 @@ case class MergeRowsExec(
if (isTargetRowPresent && isSourceRowPresent) {
cardinalityValidator.validate(row)
- applyInstructions(row, matchedInstructions)
+ applyInstructions(row, matchedInstructions, sourcePresent = true,
targetPresent = true)
} else if (isSourceRowPresent) {
- applyInstructions(row, notMatchedInstructions)
+ applyInstructions(row, notMatchedInstructions, sourcePresent = true)
} else if (isTargetRowPresent) {
- applyInstructions(row, notMatchedBySourceInstructions)
+ applyInstructions(row, notMatchedBySourceInstructions, targetPresent =
true)
} else {
null
}
}
private def applyInstructions(
row: InternalRow,
- instructions: Seq[InstructionExec]): InternalRow = {
+ instructions: Seq[InstructionExec],
+ sourcePresent: Boolean = false,
+ targetPresent: Boolean = false): InternalRow = {
for (instruction <- instructions) {
if (instruction.condition.eval(row)) {
instruction match {
+ case copy: CopyExec =>
+ // For GroupBased Merge, Spark inserts a Copy predicate
Review Comment:
What about simplifying it a bit?
```
// group-based operations copy over target rows that didn't match any actions
```
--
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]