prestodb/presto · error · PrestoException

INVALID_FUNCTION_ARGUMENT

INVALID_FUNCTION_ARGUMENT

Error message

Prediction value must be between 0.0 and 1.0

What it means

Argument validation in PrecisionRecallAggregation.input: the prediction score supplied to the precision/recall aggregation lies outside [0.0, 1.0], which violates the histogram contract that buckets predictions in the unit interval.

Source

Thrown at presto-main-base/src/main/java/com/facebook/presto/operator/aggregation/PrecisionRecallAggregation.java:68

            @AggregationState PrecisionRecallState state,
            @SqlType(StandardTypes.BIGINT) long bucketCount,
            @SqlType(StandardTypes.BOOLEAN) boolean outcome,
            @SqlType(StandardTypes.DOUBLE) double pred,
            @SqlType(StandardTypes.DOUBLE) double weight)
    {
        if (state.getTrueWeights() == null) {
            state.setTrueWeights(new FixedDoubleHistogram(
                    (int) (bucketCount),
                    MIN_PREDICTION_VALUE,
                    MAX_PREDICTION_VALUE));
            state.setFalseWeights(new FixedDoubleHistogram(
                    (int) (bucketCount),
                    MIN_PREDICTION_VALUE,
                    MAX_PREDICTION_VALUE));
        }

        if (pred < MIN_PREDICTION_VALUE || pred > MAX_PREDICTION_VALUE) {
            throw new PrestoException(
                    INVALID_FUNCTION_ARGUMENT,
                    ILLEGAL_PREDICTION_VALUE_MESSAGE);
        }
        pred = Math.min(pred, MAX_PREDICTION_VALUE_FOR_HISTOGRAM);
        if (weight < 0) {
            throw new PrestoException(
                    INVALID_FUNCTION_ARGUMENT,
                    NEGATIVE_WEIGHT_MESSAGE);
        }
        if (bucketCount != state.getTrueWeights().getBucketCount()) {
            throw new PrestoException(
                    INVALID_FUNCTION_ARGUMENT,
                    INCONSISTENT_BUCKET_COUNT_MESSAGE);
        }

        if (outcome) {
            state.getTrueWeights().add(pred, weight);
        }

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Clamp or filter predictions to the 0.0-1.0 range before aggregating
  2. Fix the upstream model so it emits valid probabilities
  3. Check for NaN or miscomputed scores feeding the aggregation
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at presto-main-base/src/main/java/com/facebook/presto/operator/aggregation/PrecisionRecallAggregation.java:68 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04). Data as JSON: /api/errors/b9d93b199a906890. Report an issue: GitHub.