Uroš Bojanić created SPARK-58621:
------------------------------------
Summary: Add descriptive messages to SummarizerBuffer metric
accessor require checks
Key: SPARK-58621
URL: https://issues.apache.org/jira/browse/SPARK-58621
Project: Spark
Issue Type: Improvement
Components: ML
Affects Versions: 4.3.0
Reporter: Uroš Bojanić
The nine metric accessors in SummarizerBuffer guard against reading a metric
that was not requested with a bare require, for example
require(requestedMetrics.contains(Mean)). When the guard trips, the resulting
IllegalArgumentException carries only "requirement failed", which does not say
which metric was involved.
This adds a short message naming the metric to each of the nine checks, for
example "mean was not a requested metric.". The quoted names match the user
facing metric names accepted by Summarizer.metrics, including numNonZeros.
These are plain require calls rather than part of the structured error
condition framework, and the adjacent require(totalWeightSum > 0, ...) checks
in the same methods already carry messages, so this brings the metric guards in
line with them. Conditions and exception types are unchanged; only the message
text is added.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]