{"record":{"id":"9388df18c18dcbae","repo":"prestodb/presto","slug":"not-supported-9388df","errorCode":"NOT_SUPPORTED","errorMessage":"State type not enabled for %s: %s","messagePattern":"State type not enabled for (.+?): (.+?)","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-main-base/src/main/java/com/facebook/presto/operator/aggregation/ReduceAggregationFunction.java","lineNumber":106,"sourceCode":"    {\n        Type inputType = boundVariables.getTypeVariable(\"T\");\n        Type stateType = boundVariables.getTypeVariable(\"S\");\n        return generateAggregation(inputType, stateType);\n    }\n\n    private BuiltInAggregationFunctionImplementation generateAggregation(Type inputType, Type stateType)\n    {\n        DynamicClassLoader classLoader = new DynamicClassLoader(ReduceAggregationFunction.class.getClassLoader());\n\n        MethodHandle inputMethodHandle;\n        MethodHandle combineMethodHandle;\n        MethodHandle outputMethodHandle;\n        AccumulatorStateDescriptor stateDescriptor;\n\n        if (!supportsComplexTypes && !(stateType.getJavaType() == long.class || stateType.getJavaType() == double.class || stateType.getJavaType() == boolean.class)) {\n            // For large heap, State with Slice or Block may result in excessive JVM memory usage of remembered set.\n            // See JDK-8017163.\n            throw new PrestoException(NOT_SUPPORTED, format(\"State type not enabled for %s: %s\", NAME, stateType.getDisplayName()));\n        }\n\n        inputMethodHandle = INPUT_FUNCTION.bindTo(inputType);\n        combineMethodHandle = COMBINE_FUNCTION;\n        outputMethodHandle = OUTPUT_FUNCTION.bindTo(stateType);\n\n        stateDescriptor = new AccumulatorStateDescriptor(\n                ReduceAggregationState.class,\n                new ReduceAggregationStateSerializer(stateType),\n                new ReduceAggregationStateFactory());\n\n        AggregationMetadata metadata = new AggregationMetadata(\n                generateAggregationName(getSignature().getNameSuffix(), inputType.getTypeSignature(), ImmutableList.of(inputType.getTypeSignature())),\n                createInputParameterMetadata(inputType, stateType),\n                inputMethodHandle.asType(\n                        inputMethodHandle.type()\n                                .changeParameterType(1, inputType.getJavaType())\n                                .changeParameterType(2, stateType.getJavaType())),","sourceCodeStart":88,"sourceCodeEnd":124,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-main-base/src/main/java/com/facebook/presto/operator/aggregation/ReduceAggregationFunction.java#L88-L124","documentation":"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.","triggerScenarios":"Thrown at presto-main-base/src/main/java/com/facebook/presto/operator/aggregation/ReduceAggregationFunction.java:106 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Enable the required state type via the corresponding session feature flag","Use a supported built-in state type for the reduce aggregation","Avoid reduce() with the unsupported type and use a native aggregation instead"],"exampleFix":null,"handlingStrategy":"type-guard","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"}