[SPARK-58621][ML] Add descriptive messages to SummarizerBuffer metric accessor require checks - #57823
Open
uros-b wants to merge 1 commit into
Open
[SPARK-58621][ML] Add descriptive messages to SummarizerBuffer metric accessor require checks#57823uros-b wants to merge 1 commit into
uros-b wants to merge 1 commit into
Conversation
uros-b
commented
Aug 6, 2026
uros-b
left a comment
Member
Author
There was a problem hiding this comment.
Waiting for CI. @zhengruifeng Please review.
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 a short descriptive message to the nine bare
require(requestedMetrics.contains(X))guards inSummarizerBuffer, so that reading a metric that was not requested fails with a message naming the metric:Why are the changes needed?
These guards currently produce a bare
requirement failed, which does not indicate which metric was involved. The quoted names match the user-facing metric names accepted bySummarizer.metrics(...)per theallMetricstable, includingnumNonZeros(the metric string differs in casing from thenumNonzerosaccessor, so the message quotes the name a caller actually passes).These are plain
requirecalls rather than part of the structured error-condition framework, and the adjacentrequire(totalWeightSum > 0, ...)check in each of the same methods already carries a message, so this brings the metric guards in line with their immediate neighbours.Does this PR introduce any user-facing change?
No.
SummarizerBufferisprivate[spark], and only the message text of an existing check is added.How was this patch tested?
Conditions and exception types are unchanged, so existing tests continue to apply; the error-handling tests in
SummarizerSuiteassert only the exception type and do not match on message text.Was this patch authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Opus 4.8)