presto-main/src/main/java/io/prestosql/operator/aggregation/histogram/HistogramStateFactory.java/HistogramStateFactory/getGroupedStateClass
class HistogramStateFactory:    @Override
    public Class<? extends HistogramState> getGroupedStateClass()
    {
        if (mode == NEW) {
            return GroupedHistogramState.class;
        }

        if (mode == LEGACY) {
            return LegacyHistogramGroupState.class;
        }

        throw new PrestoException(FUNCTION_IMPLEMENTATION_ERROR, format("expected group enum type %s", mode));
    }