prestodb/presto · error · PrestoException

FUNCTION_IMPLEMENTATION_ERROR

FUNCTION_IMPLEMENTATION_ERROR

Error message

Unexpected group enum type %s

What it means

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.

Source

Thrown at presto-main-base/src/main/java/com/facebook/presto/operator/aggregation/multimapagg/MultimapAggregationStateFactory.java:59

        return new SingleMultimapAggregationState(keyType, valueType);
    }

    @Override
    public Class<? extends MultimapAggregationState> getSingleStateClass()
    {
        return SingleMultimapAggregationState.class;
    }

    @Override
    public MultimapAggregationState createGroupedState()
    {
        switch (implementation) {
            case NEW:
                return new GroupedMultimapAggregationState(keyType, valueType);
            case LEGACY:
                return new LegacyGroupedMultimapAggregationState(keyType, valueType);
            default:
                throw new PrestoException(FUNCTION_IMPLEMENTATION_ERROR, format("Unexpected group enum type %s", implementation));
        }
    }

    @Override
    public Class<? extends MultimapAggregationState> getGroupedStateClass()
    {
        switch (implementation) {
            case NEW:
                return GroupedMultimapAggregationState.class;
            case LEGACY:
                return LegacyGroupedMultimapAggregationState.class;
            default:
                throw new PrestoException(FUNCTION_IMPLEMENTATION_ERROR, format("Unexpected group enum type %s", implementation));
        }
    }
}

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Set the multimap aggregation implementation config/session property to a valid value (NEW or LEGACY).
  2. Restart the coordinator/workers to rebind configuration cleanly after an upgrade.
  3. Verify all nodes run the same Presto version — mixed-version clusters can carry unknown enum constants.
  4. If this persists, file a bug; hitting the default branch indicates an engine bug, not a query problem.

Example fix

// config.properties
// before
// (missing or invalid multimap implementation setting)
// after
multimap-aggregation-implementation=NEW
Defensive patterns

Strategy: validation

Validate before calling

SHOW SESSION LIKE '%multimap%'; -- confirm implementation property is 'new' or 'legacy'

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Related errors


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