{"record":{"id":"8882a8b25b9c4dc2","repo":"prestodb/presto","slug":"function-implementation-error-8882a8","errorCode":"FUNCTION_IMPLEMENTATION_ERROR","errorMessage":"Unexpected group enum type %s","messagePattern":"Unexpected group enum type (.+?)","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-main-base/src/main/java/com/facebook/presto/operator/aggregation/multimapagg/MultimapAggregationStateFactory.java","lineNumber":59,"sourceCode":"        return new SingleMultimapAggregationState(keyType, valueType);\n    }\n\n    @Override\n    public Class<? extends MultimapAggregationState> getSingleStateClass()\n    {\n        return SingleMultimapAggregationState.class;\n    }\n\n    @Override\n    public MultimapAggregationState createGroupedState()\n    {\n        switch (implementation) {\n            case NEW:\n                return new GroupedMultimapAggregationState(keyType, valueType);\n            case LEGACY:\n                return new LegacyGroupedMultimapAggregationState(keyType, valueType);\n            default:\n                throw new PrestoException(FUNCTION_IMPLEMENTATION_ERROR, format(\"Unexpected group enum type %s\", implementation));\n        }\n    }\n\n    @Override\n    public Class<? extends MultimapAggregationState> getGroupedStateClass()\n    {\n        switch (implementation) {\n            case NEW:\n                return GroupedMultimapAggregationState.class;\n            case LEGACY:\n                return LegacyGroupedMultimapAggregationState.class;\n            default:\n                throw new PrestoException(FUNCTION_IMPLEMENTATION_ERROR, format(\"Unexpected group enum type %s\", implementation));\n        }\n    }\n}\n","sourceCodeStart":41,"sourceCodeEnd":76,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-main-base/src/main/java/com/facebook/presto/operator/aggregation/multimapagg/MultimapAggregationStateFactory.java#L41-L76","documentation":"MultimapAggregationStateFactory picks a state implementation based on the configured MultimapImplementation enum (NEW or LEGACY, controlled by a session/config feature flag). createGroupedState hits the default branch only if the enum is null or an unknown constant, which would be an internal configuration/injection error, so FUNCTION_IMPLEMENTATION_ERROR is thrown.","triggerScenarios":"Creating a grouped multimap_agg aggregation state when the injected MultimapAggregationStateFactory's 'implementation' enum holds a value other than NEW or LEGACY (typically null due to failed config binding).","commonSituations":"Misconfigured feature-flag/config property for the multimap aggregation implementation; partial deployment or version mismatch where a new enum constant exists in code but the factory switch was not updated; broken Guice binding leaving the field null.","solutions":["Set the multimap aggregation implementation config/session property to a valid value (NEW or LEGACY).","Restart the coordinator/workers to rebind configuration cleanly after an upgrade.","Verify all nodes run the same Presto version — mixed-version clusters can carry unknown enum constants.","If this persists, file a bug; hitting the default branch indicates an engine bug, not a query problem."],"exampleFix":"// config.properties\n// before\n// (missing or invalid multimap implementation setting)\n// after\nmultimap-aggregation-implementation=NEW","handlingStrategy":"validation","validationCode":"SHOW SESSION LIKE '%multimap%'; -- confirm implementation property is 'new' or 'legacy'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pin the multimap implementation property in config.properties to a valid value.","Keep all cluster nodes on the same version.","Validate config bindings at startup to catch null enum injections early."],"tags":["aggregation","multimap","configuration","internal-error"],"backgroundTag":"unexpected-enum-value","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"}