{"record":{"id":"da6b637a545e2c65","repo":"prestodb/presto","slug":"invalid-function-argument-da6b63","errorCode":"INVALID_FUNCTION_ARGUMENT","errorMessage":"In differential_entropy UDF, bucket count must be non-negative: %s","messagePattern":"In differential_entropy UDF, bucket count must be non-negative: (.+?)","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-main-base/src/main/java/com/facebook/presto/operator/aggregation/differentialentropy/FixedHistogramStateStrategyUtils.java","lineNumber":34,"sourceCode":"import com.facebook.presto.spi.PrestoException;\n\nimport static com.facebook.presto.spi.StandardErrorCode.INVALID_FUNCTION_ARGUMENT;\nimport static java.lang.String.format;\n\n/**\n * Utility class for different strategies for calculating entropy based on fixed histograms.\n */\npublic class FixedHistogramStateStrategyUtils\n{\n    private FixedHistogramStateStrategyUtils() {}\n\n    public static void validateParameters(\n            long bucketCount,\n            double min,\n            double max)\n    {\n        if (bucketCount < 0) {\n            throw new PrestoException(\n                    INVALID_FUNCTION_ARGUMENT,\n                    format(\"In differential_entropy UDF, bucket count must be non-negative: %s\", bucketCount));\n        }\n\n        if (min >= max) {\n            throw new PrestoException(\n                    INVALID_FUNCTION_ARGUMENT, format(\n                            \"In differential_entropy UDF, min must be larger than max: min=%s, max=%s\", min, max));\n        }\n    }\n\n    public static void validateParameters(\n            long histogramBucketCount,\n            double histogramMin,\n            double histogramMax,\n            long bucketCount,\n            double sample,\n            double weight,","sourceCodeStart":16,"sourceCodeEnd":52,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-main-base/src/main/java/com/facebook/presto/operator/aggregation/differentialentropy/FixedHistogramStateStrategyUtils.java#L16-L52","documentation":"Argument validation in FixedHistogramStateStrategyUtils.validateParameters for differential_entropy with a fixed-histogram strategy: the bucket count argument is negative, which cannot define a histogram. Note the check only rejects negative values.","triggerScenarios":"Thrown at presto-main-base/src/main/java/com/facebook/presto/operator/aggregation/differentialentropy/FixedHistogramStateStrategyUtils.java:34 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass a non-negative bucket count to differential_entropy","Use a positive bucket count matching the desired histogram resolution","Validate the bucket-count expression upstream if it is computed"],"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"}