[SPARK-56680][SQL] DSv2 INSERT and Insert-Only MERGE Metrics#55586
Open
ZiyaZa wants to merge 10 commits intoapache:masterfrom
Open
[SPARK-56680][SQL] DSv2 INSERT and Insert-Only MERGE Metrics#55586ZiyaZa wants to merge 10 commits intoapache:masterfrom
ZiyaZa wants to merge 10 commits intoapache:masterfrom
Conversation
# Conflicts: # sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/DataSourceV2Strategy.scala # sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/WriteToDataSourceV2Exec.scala
# Conflicts: # sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/v2Commands.scala # sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/WriteToDataSourceV2Exec.scala
# Conflicts: # sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/WriteToDataSourceV2Exec.scala
aokolnychyi
reviewed
May 1, 2026
Contributor
aokolnychyi
left a comment
There was a problem hiding this comment.
A few questions but looks good otherwise.
| /** | ||
| * Returns the number of output rows, or -1 if not found. | ||
| */ | ||
| long numOutputRows(); |
Contributor
There was a problem hiding this comment.
Would calling this numInsertedRows be more consistent with the rest of summaries?
| write: Option[Write] = None, | ||
| analyzedQuery: Option[LogicalPlan] = None) extends V2WriteCommand with TransactionalWrite { | ||
| analyzedQuery: Option[LogicalPlan] = None, | ||
| rowLevelCommand: Option[RowLevelOperation.Command] = None) |
Contributor
There was a problem hiding this comment.
How do you feel about adding a new node like InsertOnlyMerge and InsertOnlyMergeExec instead of making AppendData that is heavily used aware of the row-level operation?
I vibecoded it locally and it is fairly easy.
Contributor
There was a problem hiding this comment.
I don't feel strongly here. More like 60/40 to have a new node, to be honest.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
MERGE and INSERT / write metrics for DSv2.
This PR only handles pure-inserts. Overwrites will be handled in a future PR, as those require some values from the connector.
Why are the changes needed?
For better visibility into what happened as a result of DML queries.
Does this PR introduce any user-facing change?
No.
How was this patch tested?
Added metric verification to existing tests.
Was this patch authored or co-authored using generative AI tooling?
Generated-by: Claude Opus 4.7