{"record":{"id":"b9d93b199a906890","repo":"prestodb/presto","slug":"invalid-function-argument-b9d93b","errorCode":"INVALID_FUNCTION_ARGUMENT","errorMessage":"Prediction value must be between 0.0 and 1.0","messagePattern":"Prediction value must be between 0\\.0 and 1\\.0","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-main-base/src/main/java/com/facebook/presto/operator/aggregation/PrecisionRecallAggregation.java","lineNumber":68,"sourceCode":"            @AggregationState PrecisionRecallState state,\n            @SqlType(StandardTypes.BIGINT) long bucketCount,\n            @SqlType(StandardTypes.BOOLEAN) boolean outcome,\n            @SqlType(StandardTypes.DOUBLE) double pred,\n            @SqlType(StandardTypes.DOUBLE) double weight)\n    {\n        if (state.getTrueWeights() == null) {\n            state.setTrueWeights(new FixedDoubleHistogram(\n                    (int) (bucketCount),\n                    MIN_PREDICTION_VALUE,\n                    MAX_PREDICTION_VALUE));\n            state.setFalseWeights(new FixedDoubleHistogram(\n                    (int) (bucketCount),\n                    MIN_PREDICTION_VALUE,\n                    MAX_PREDICTION_VALUE));\n        }\n\n        if (pred < MIN_PREDICTION_VALUE || pred > MAX_PREDICTION_VALUE) {\n            throw new PrestoException(\n                    INVALID_FUNCTION_ARGUMENT,\n                    ILLEGAL_PREDICTION_VALUE_MESSAGE);\n        }\n        pred = Math.min(pred, MAX_PREDICTION_VALUE_FOR_HISTOGRAM);\n        if (weight < 0) {\n            throw new PrestoException(\n                    INVALID_FUNCTION_ARGUMENT,\n                    NEGATIVE_WEIGHT_MESSAGE);\n        }\n        if (bucketCount != state.getTrueWeights().getBucketCount()) {\n            throw new PrestoException(\n                    INVALID_FUNCTION_ARGUMENT,\n                    INCONSISTENT_BUCKET_COUNT_MESSAGE);\n        }\n\n        if (outcome) {\n            state.getTrueWeights().add(pred, weight);\n        }","sourceCodeStart":50,"sourceCodeEnd":86,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-main-base/src/main/java/com/facebook/presto/operator/aggregation/PrecisionRecallAggregation.java#L50-L86","documentation":"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.","triggerScenarios":"Thrown at presto-main-base/src/main/java/com/facebook/presto/operator/aggregation/PrecisionRecallAggregation.java:68 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Clamp or filter predictions to the 0.0-1.0 range before aggregating","Fix the upstream model so it emits valid probabilities","Check for NaN or miscomputed scores feeding the aggregation"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}