prestodb/presto · error · PrestoException

NOT_SUPPORTED

NOT_SUPPORTED

Error message

State type not enabled for %s: %s

What it means

Guard in ReduceAggregationFunction.generateAggregation: the reduce() aggregation was specialized with a state (S) type whose use is not enabled under the current feature flags or configuration, so the generated accumulator state is rejected.

Source

Thrown at presto-main-base/src/main/java/com/facebook/presto/operator/aggregation/ReduceAggregationFunction.java:106

    {
        Type inputType = boundVariables.getTypeVariable("T");
        Type stateType = boundVariables.getTypeVariable("S");
        return generateAggregation(inputType, stateType);
    }

    private BuiltInAggregationFunctionImplementation generateAggregation(Type inputType, Type stateType)
    {
        DynamicClassLoader classLoader = new DynamicClassLoader(ReduceAggregationFunction.class.getClassLoader());

        MethodHandle inputMethodHandle;
        MethodHandle combineMethodHandle;
        MethodHandle outputMethodHandle;
        AccumulatorStateDescriptor stateDescriptor;

        if (!supportsComplexTypes && !(stateType.getJavaType() == long.class || stateType.getJavaType() == double.class || stateType.getJavaType() == boolean.class)) {
            // For large heap, State with Slice or Block may result in excessive JVM memory usage of remembered set.
            // See JDK-8017163.
            throw new PrestoException(NOT_SUPPORTED, format("State type not enabled for %s: %s", NAME, stateType.getDisplayName()));
        }

        inputMethodHandle = INPUT_FUNCTION.bindTo(inputType);
        combineMethodHandle = COMBINE_FUNCTION;
        outputMethodHandle = OUTPUT_FUNCTION.bindTo(stateType);

        stateDescriptor = new AccumulatorStateDescriptor(
                ReduceAggregationState.class,
                new ReduceAggregationStateSerializer(stateType),
                new ReduceAggregationStateFactory());

        AggregationMetadata metadata = new AggregationMetadata(
                generateAggregationName(getSignature().getNameSuffix(), inputType.getTypeSignature(), ImmutableList.of(inputType.getTypeSignature())),
                createInputParameterMetadata(inputType, stateType),
                inputMethodHandle.asType(
                        inputMethodHandle.type()
                                .changeParameterType(1, inputType.getJavaType())
                                .changeParameterType(2, stateType.getJavaType())),

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Enable the required state type via the corresponding session feature flag
  2. Use a supported built-in state type for the reduce aggregation
  3. Avoid reduce() with the unsupported type and use a native aggregation instead
Defensive patterns

Strategy: type-guard

When it happens

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

Common situations: See trigger scenarios.

Understand the failure class

Background: Presto NOT_SUPPORTED error: what "not supported" means and how to fix it — this error's family across 3 libraries.


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