[WIP][SQL] DSv2 Write Timing Metrics#56033
Draft
ZiyaZa wants to merge 1 commit into
Draft
Conversation
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?
Adds 3 new metrics for write operations in DSv2 (the descriptions below are AI-generated):
executionTimeMs- Total wall-clock time, in milliseconds, of the V2 write exec from entry ofwriteWithV2throughrunJoband metric-collection bookkeeping, snapshotted just before the connector'sBatchWrite.commit(...). Includes: query.execute() (RDD lineage construction, plan prepare(), kicking off DPP/runtime-filter subqueries, AQE work that runs during execute), writer-factory creation, the main runJob, post-job driver bookkeeping, and getWriteSummary itself. Excludes: Catalyst analysis / optimization before V2TableWriteExec.run(), the connector's own BatchWrite.commit (the commit is what consumes this summary).groupFilterTimeMs- Cumulative time, in milliseconds, spent in the runtime group-filter subquery injected byRowLevelOperationRuntimeGroupFiltering- the subquery that identifies which target files contain rows matching the row-level operation condition. Measured as the sum ofcollectTimeover allExecSubqueryExpressionsin the runtime filters of the row-level target'sBatchScanExec.writeJobTimeMs- Wall-clock duration, in milliseconds, of the main Spark write job — i.e. thesparkContext.runJob(...)call insidewriteWithV2. This is the fused scan + filter + (join, for MERGE) + project + write tasks that produce the row-level deltas or replacement data. Excludes: Driver-side prep, runtime group-filter subquery execution (which runs in its own job in a separate thread pool), post-job processing.groupFilterTimeMsis -1 when the runtime group-filter subquery is not injected for the row-level operation. This happens in the following cases:cond != TrueLiteral.spark.sql.optimizer.runtimeRowLevelOperation.groupFilter.enabled= false.RewriteMergeIntoTabledoes not setgroupFilterConditionwhennotMatchedBySourceActionsis non-empty, since the whole target must be read.InsertOnlyMergeoptimization — MERGE rewritten to an append-style insert-only plan with no row-level target scan.RewriteDeleteFromTable.buildWriteDeltaPlannever setsgroupFilterCondition. Delta-based DELETE reads only row IDs, so file pruning by partition columns is not applicable.scan.filterAttributes.nonEmptyrequires the partition column to be in the scan's read schema. For delta-based UPDATE, when the partition column is being assigned (e.g.SET dep = 'literal') and is not referenced by the condition, column pruning removes it.WHERE col = NULL,WHERE false, or empty target tables, where the optimizer short-circuits the scan before runtime filtering is considered.Why are the changes needed?
For better visibility into the DML queries, showing how long each operation took.
Does this PR introduce any user-facing change?
No.
How was this patch tested?
Added validation for new metrics to existing tests.
Was this patch authored or co-authored using generative AI tooling?
Generated-by: Claude Opus 4.7