[SPARK-56598][SQL] Custom metrics support for TruncatableTable#55511
Closed
ZiyaZa wants to merge 8 commits intoapache:masterfrom
Closed
[SPARK-56598][SQL] Custom metrics support for TruncatableTable#55511ZiyaZa wants to merge 8 commits intoapache:masterfrom
ZiyaZa wants to merge 8 commits intoapache:masterfrom
Conversation
aokolnychyi
reviewed
Apr 28, 2026
|
|
||
| override protected def run(): Seq[InternalRow] = { | ||
| table.deleteWhere(condition) | ||
| postDriverMetrics(table.reportDriverMetrics()) |
Contributor
There was a problem hiding this comment.
Do we need to move this into a finally block?
Contributor
There was a problem hiding this comment.
Similar to V2ExistingTableWriteExec?
aokolnychyi
reviewed
Apr 28, 2026
| * Returns an array of supported custom metrics with name and description. | ||
| * By default it returns empty array. | ||
| */ | ||
| default CustomMetric[] supportedCustomMetrics() { |
Contributor
There was a problem hiding this comment.
Do we need @since for the new methods?
aokolnychyi
reviewed
Apr 28, 2026
| */ | ||
| protected def createCustomMetrics(metrics: Array[CustomMetric]): Map[String, SQLMetric] = { | ||
| metrics.map { m => | ||
| m.name() -> SQLMetrics.createV2CustomMetric(sparkContext, m) |
Contributor
There was a problem hiding this comment.
Minor: m.name() -> m.name for simple getter access
aokolnychyi
reviewed
Apr 28, 2026
| } | ||
| val executionId = sparkContext.getLocalProperty(SQLExecution.EXECUTION_ID_KEY) | ||
| SQLMetrics.postDriverMetricUpdates( | ||
| sparkContext, executionId, updated.toImmutableArraySeq) |
Contributor
There was a problem hiding this comment.
Can this entire method call fit on one line?
Contributor
|
@ZiyaZa, test failures seem unrelated? Can you check? |
Contributor
|
Looks like there is a conflict too. |
# Conflicts: # 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/DeleteFromTableExec.scala
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?
Added support for connectors to provide custom metrics in Truncate and Delete operations. Refactored the existing custom metrics logic to be reusable across different plan nodes.
Why are the changes needed?
For connectors to provide metric values.
Does this PR introduce any user-facing change?
No.
How was this patch tested?
Existing tests.
Was this patch authored or co-authored using generative AI tooling?
Generated-by: Claude Opus 4.7