prestodb/presto · error · PrestoException

INVALID_FUNCTION_ARGUMENT

INVALID_FUNCTION_ARGUMENT

Error message

In differential_entropy UDF, bucket count must be non-negative: %s

What it means

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.

Source

Thrown at presto-main-base/src/main/java/com/facebook/presto/operator/aggregation/differentialentropy/FixedHistogramStateStrategyUtils.java:34

import com.facebook.presto.spi.PrestoException;

import static com.facebook.presto.spi.StandardErrorCode.INVALID_FUNCTION_ARGUMENT;
import static java.lang.String.format;

/**
 * Utility class for different strategies for calculating entropy based on fixed histograms.
 */
public class FixedHistogramStateStrategyUtils
{
    private FixedHistogramStateStrategyUtils() {}

    public static void validateParameters(
            long bucketCount,
            double min,
            double max)
    {
        if (bucketCount < 0) {
            throw new PrestoException(
                    INVALID_FUNCTION_ARGUMENT,
                    format("In differential_entropy UDF, bucket count must be non-negative: %s", bucketCount));
        }

        if (min >= max) {
            throw new PrestoException(
                    INVALID_FUNCTION_ARGUMENT, format(
                            "In differential_entropy UDF, min must be larger than max: min=%s, max=%s", min, max));
        }
    }

    public static void validateParameters(
            long histogramBucketCount,
            double histogramMin,
            double histogramMax,
            long bucketCount,
            double sample,
            double weight,

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Pass a non-negative bucket count to differential_entropy
  2. Use a positive bucket count matching the desired histogram resolution
  3. Validate the bucket-count expression upstream if it is computed
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at presto-main-base/src/main/java/com/facebook/presto/operator/aggregation/differentialentropy/FixedHistogramStateStrategyUtils.java:34 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/da6b637a545e2c65. Report an issue: GitHub.