[SPARK-55619][SQL][3.5] Fix custom metrics in case of coalesced partitions#54409
Open
viirya wants to merge 1 commit intoapache:branch-3.5from
Open
[SPARK-55619][SQL][3.5] Fix custom metrics in case of coalesced partitions#54409viirya wants to merge 1 commit intoapache:branch-3.5from
viirya wants to merge 1 commit intoapache:branch-3.5from
Conversation
Member
Author
szehon-ho
approved these changes
Feb 21, 2026
7692b66 to
ca6db66
Compare
Member
dongjoon-hyun
left a comment
There was a problem hiding this comment.
Could you fix the compilation error?
KeyGroupedPartitioningSuite.scala:1250: not found: value itemsColumns
…tions Replace PartitionMetricCallback with a ConcurrentHashMap keyed by task attempt ID to correctly track reader state across multiple compute() calls when DataSourceRDD is coalesced. The completion listener is registered only once per task attempt, and metrics are flushed and carried forward between readers as partitions are advanced. Co-Authored-By: Peter Toth <peter.toth@gmail.com> Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
ca6db66 to
2124044
Compare
Member
Author
I thought I fixed it but didn't commit the fix. Fixed it now. |
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?
Replace
PartitionMetricCallbackwith aConcurrentHashMapkeyed by task attempt ID to correctly track reader state across multiplecompute()calls whenDataSourceRDDis coalesced. The completion listener is registered only once per task attempt, and metrics are flushed and carried forward between readers as partitions are advanced.Why are the changes needed?
When
DataSourceRDDis coalesced (e.g., via.coalesce(1)),compute()gets called multiple times per task, which causes the custom metrics incorrect.Does this PR introduce any user-facing change?
No
How was this patch tested?
Unit test
Was this patch authored or co-authored using generative AI tooling?
Generated-by: Claude Sonnet 4.6