prestodb/presto · error · PrestoException

INVALID_FUNCTION_ARGUMENT

INVALID_FUNCTION_ARGUMENT

Error message

e.getMessage()

What it means

Catch-and-rethrow in HyperLogLogUtils.mergeState: merging two HyperLogLogs whose bucket counts differ throws inside the library; because the counts are not accessible, the original exception is rethrown with its raw message (hence the generic 'e.getMessage()' text) as INVALID_FUNCTION_ARGUMENT.

Source

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

    }

    public static void mergeState(@AggregationState HyperLogLogState state, HyperLogLog input)
    {
        HyperLogLog previous = state.getHyperLogLog();
        if (previous == null) {
            state.setHyperLogLog(input);
            state.addMemoryUsage(input.estimatedInMemorySize());
        }
        else {
            state.addMemoryUsage(-previous.estimatedInMemorySize());
            try {
                // Throws if the bucket counts are different.
                // We currently cannot access these counts from HLL so we must
                // catch and rethrow a more useful exception
                previous.mergeWith(input);
            }
            catch (IllegalArgumentException e) {
                throw new PrestoException(INVALID_FUNCTION_ARGUMENT, e.getMessage(), e);
            }
            state.addMemoryUsage(previous.estimatedInMemorySize());
        }
    }

    private static int log2Ceiling(int value)
    {
        return Integer.highestOneBit(value - 1) << 1;
    }
}

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Ensure all HLL inputs to the merge/union were created with the same number of buckets
  2. Create HLLs from the same engine/version with identical index configurations
  3. Rebuild the HLLs from raw data with matching bucket counts before merging
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at presto-main-base/src/main/java/com/facebook/presto/operator/aggregation/HyperLogLogUtils.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/3991b662c03ef5b7. Report an issue: GitHub.