uros-b opened a new pull request, #57823: URL: https://github.com/apache/spark/pull/57823
### What changes were proposed in this pull request? Adds a short descriptive message to the nine bare `require(requestedMetrics.contains(X))` guards in `SummarizerBuffer`, so that reading a metric that was not requested fails with a message naming the metric: ```scala require(requestedMetrics.contains(Mean), "mean was not a requested 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 by `Summarizer.metrics(...)` per the `allMetrics` table, including `numNonZeros` (the metric string differs in casing from the `numNonzeros` accessor, so the message quotes the name a caller actually passes). These are plain `require` calls rather than part of the structured error-condition framework, and the adjacent `require(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. `SummarizerBuffer` is `private[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 `SummarizerSuite` assert 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) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
