Skip to content

Commit adc1601

Browse files
szehon-hoHyukjinKwon
authored andcommitted
[SPARK-53891][SQL][FOLLOW-UP] Clarify javadocs for case when merge summary metric is not found
### What changes were proposed in this pull request? Clarify javadocs to explain situations where the metric is not found. ### Why are the changes needed? As we begin to handle more write summaries like in #52669, involving more complex walks of the executed plan graph, the code to calculate merge summary may encounter some plan it does not expect and would need to populate -1. This was actually called out in #52595 (comment) , it was not done as it was not case then, but now I realize it will be possible as this code evolves. Especially as we plan to still populate MergeSummary in cases where the optimizer rewrites Merge plan to get rid of MergeRowsExec or Join. As it is more an error-handling case, we don't need to change the model of the MergeSummary to return Long or OptionalLong, so we can put -1 and indicate this in the javadoc. ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? No ### Was this patch authored or co-authored using generative AI tooling? No Closes #52797 from szehon-ho/SPARK-53891-follow. Authored-by: Szehon Ho <szehon.apache@gmail.com> Signed-off-by: Hyukjin Kwon <gurwls223@apache.org>
1 parent ec6122f commit adc1601

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

sql/catalyst/src/main/java/org/apache/spark/sql/connector/write/MergeSummary.java

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,42 +28,45 @@
2828
public interface MergeSummary extends WriteSummary {
2929

3030
/**
31-
* Returns the number of target rows copied unmodified because they did not match any action.
31+
* Returns the number of target rows copied unmodified because they did not match any action,
32+
* or -1 if not found.
3233
*/
3334
long numTargetRowsCopied();
3435

3536
/**
36-
* Returns the number of target rows deleted.
37+
* Returns the number of target rows deleted, or -1 if not found.
3738
*/
3839
long numTargetRowsDeleted();
3940

4041
/**
41-
* Returns the number of target rows updated.
42+
* Returns the number of target rows updated, or -1 if not found.
4243
*/
4344
long numTargetRowsUpdated();
4445

4546
/**
46-
* Returns the number of target rows inserted.
47+
* Returns the number of target rows inserted, or -1 if not found.
4748
*/
4849
long numTargetRowsInserted();
4950

5051
/**
51-
* Returns the number of target rows updated by a matched clause.
52+
* Returns the number of target rows updated by a matched clause, or -1 if not found.
5253
*/
5354
long numTargetRowsMatchedUpdated();
5455

5556
/**
56-
* Returns the number of target rows deleted by a matched clause
57+
* Returns the number of target rows deleted by a matched clause, or -1 if not found.
5758
*/
5859
long numTargetRowsMatchedDeleted();
5960

6061
/**
61-
* Returns the number of target rows updated by a not matched by source clause.
62+
* Returns the number of target rows updated by a not matched by source clause,
63+
* or -1 if not found.
6264
*/
6365
long numTargetRowsNotMatchedBySourceUpdated();
6466

6567
/**
66-
* Returns the number of target rows deleted by a not matched by source clause.
68+
* Returns the number of target rows deleted by a not matched by source clause,
69+
* or -1 if not found.
6770
*/
6871
long numTargetRowsNotMatchedBySourceDeleted();
6972
}

0 commit comments

Comments
 (0)