[SPARK-55302][SQL] Fix custom metrics in case of KeyGroupedPartitioning#54081
Closed
peter-toth wants to merge 2 commits intoapache:masterfrom
Closed
[SPARK-55302][SQL] Fix custom metrics in case of KeyGroupedPartitioning#54081peter-toth wants to merge 2 commits intoapache:masterfrom
KeyGroupedPartitioning#54081peter-toth wants to merge 2 commits intoapache:masterfrom
Conversation
JIRA Issue Information=== Bug SPARK-55302 === This comment was automatically generated by GitHub Actions |
Contributor
Author
|
@viirya, @szehon-ho can you please take a look at this fix when you have some time? |
| } | ||
| } | ||
|
|
||
| test("SSPARK-55302: Custom metrics of grouped partitions") { |
Member
There was a problem hiding this comment.
nit. SSPARK-55302 -> SPARK-55302?
viirya
reviewed
Feb 2, 2026
| * when multiple {@link PartitionReader}s are grouped into one partition in case of | ||
| * {@link org.apache.spark.sql.connector.read.partitioning.KeyGroupedPartitioning} and the reader | ||
| * is initialized with the metrics returned by the previous reader that belongs to the same | ||
| * partition. |
Member
There was a problem hiding this comment.
Should we mention that by default this is no-op?
dongjoon-hyun
approved these changes
Feb 2, 2026
Member
dongjoon-hyun
left a comment
There was a problem hiding this comment.
+1, LGTM. Thank you, @peter-toth .
viirya
approved these changes
Feb 2, 2026
Contributor
Author
|
Thank you @dongjoon-hyun and @viirya for the review! Merged to |
peter-toth
added a commit
to peter-toth/spark
that referenced
this pull request
Feb 20, 2026
…ing` This PR adds a new `initMetricsValues()` method to `PartitionReader` so as to initialize custom metrics returned by `currentMetricsValues()`. In case of `KeyGroupedPartitioning` multiple input partitions are grouped and so multiple `PartitionReader` belong to one output partition. A `PartitionReader` needs to be initialized with metrics calculated by the previous `PartitionReader` of the same partition group to calculate the right value. To calculate custom metrics correctly. It fixes metrics calculation. New UT is added. No. Closes apache#54081 from peter-toth/SPARK-55302-fix-kgp-custom-metrics. Authored-by: Peter Toth <peter.toth@gmail.com> Signed-off-by: Peter Toth <peter.toth@gmail.com>
peter-toth
added a commit
to peter-toth/spark
that referenced
this pull request
Feb 20, 2026
…ing` This PR adds a new `initMetricsValues()` method to `PartitionReader` so as to initialize custom metrics returned by `currentMetricsValues()`. In case of `KeyGroupedPartitioning` multiple input partitions are grouped and so multiple `PartitionReader` belong to one output partition. A `PartitionReader` needs to be initialized with metrics calculated by the previous `PartitionReader` of the same partition group to calculate the right value. To calculate custom metrics correctly. It fixes metrics calculation. New UT is added. No. Closes apache#54081 from peter-toth/SPARK-55302-fix-kgp-custom-metrics. Authored-by: Peter Toth <peter.toth@gmail.com> Signed-off-by: Peter Toth <peter.toth@gmail.com>
peter-toth
added a commit
to peter-toth/spark
that referenced
this pull request
Feb 20, 2026
…ing` This PR adds a new `initMetricsValues()` method to `PartitionReader` so as to initialize custom metrics returned by `currentMetricsValues()`. In case of `KeyGroupedPartitioning` multiple input partitions are grouped and so multiple `PartitionReader` belong to one output partition. A `PartitionReader` needs to be initialized with metrics calculated by the previous `PartitionReader` of the same partition group to calculate the right value. To calculate custom metrics correctly. It fixes metrics calculation. New UT is added. No. Closes apache#54081 from peter-toth/SPARK-55302-fix-kgp-custom-metrics. Authored-by: Peter Toth <peter.toth@gmail.com> Signed-off-by: Peter Toth <peter.toth@gmail.com>
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?
This PR adds a new
initMetricsValues()method toPartitionReaderso as to initialize custom metrics returned bycurrentMetricsValues(). In case ofKeyGroupedPartitioningmultiple input partitions are grouped and so multiplePartitionReaderbelong to one output partition. APartitionReaderneeds to be initialized with metrics calculated by the previousPartitionReaderof the same partition group to calculate the right value.Why are the changes needed?
To calculate custom metrics correctly.
Does this PR introduce any user-facing change?
It fixes metrics calculation.
How was this patch tested?
New UT is added.
Was this patch authored or co-authored using generative AI tooling?
No.