singhpk234 commented on code in PR #15014:
URL: https://github.com/apache/iceberg/pull/15014#discussion_r2685219482


##########
spark/v4.1/spark/src/main/java/org/apache/iceberg/spark/source/SparkPositionDeltaWrite.java:
##########
@@ -347,6 +359,45 @@ private void commitOperation(SnapshotUpdate<?> operation, 
String description) {
         throw e;
       }
     }
+
+    private void setMergeSummaryProperties(SnapshotUpdate<?> operation, 
MergeSummary mergeSummary) {
+      setIfPositive(
+          operation, "spark.merge-into.num-target-rows-copied", 
mergeSummary.numTargetRowsCopied());
+      setIfPositive(
+          operation,
+          "spark.merge-into.num-target-rows-deleted",
+          mergeSummary.numTargetRowsDeleted());
+      setIfPositive(
+          operation,
+          "spark.merge-into.num-target-rows-updated",
+          mergeSummary.numTargetRowsUpdated());
+      setIfPositive(
+          operation,
+          "spark.merge-into.num-target-rows-inserted",
+          mergeSummary.numTargetRowsInserted());
+      setIfPositive(
+          operation,
+          "spark.merge-into.num-target-rows-matched-updated",
+          mergeSummary.numTargetRowsMatchedUpdated());
+      setIfPositive(
+          operation,
+          "spark.merge-into.num-target-rows-matched-deleted",
+          mergeSummary.numTargetRowsMatchedDeleted());
+      setIfPositive(
+          operation,
+          "spark.merge-into.num-target-rows-not-matched-by-source-updated",
+          mergeSummary.numTargetRowsNotMatchedBySourceUpdated());
+      setIfPositive(
+          operation,
+          "spark.merge-into.num-target-rows-not-matched-by-source-deleted",
+          mergeSummary.numTargetRowsNotMatchedBySourceDeleted());
+    }
+
+    private void setIfPositive(SnapshotUpdate<?> operation, String key, long 
value) {
+      if (value >= 0) {
+        operation.set(key, String.valueOf(value));
+      }
+    }

Review Comment:
   minor : I wonder if we should just move this to a util to have reuse and 
incase we add new metrics we just add in one place, thoughts ?



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