presto-main/src/main/java/io/prestosql/operator/aggregation/AggregationMetadata.java/AggregationMetadata/verifyCombineFunction
class AggregationMetadata:    private static void verifyCombineFunction(MethodHandle method, List<Class<?>> lambdaInterfaces, List<AccumulatorStateDescriptor> stateDescriptors)
    {
        Class<?>[] parameterTypes = method.type().parameterArray();
        checkArgument(
                parameterTypes.length == stateDescriptors.size() * 2 + lambdaInterfaces.size(),
                "Number of arguments for combine function must be 2 times the size of states plus number of lambda channels.");

        for (int i = 0; i < stateDescriptors.size() * 2; i++) {
            checkArgument(
                    parameterTypes[i].equals(stateDescriptors.get(i % stateDescriptors.size()).getStateInterface()),
                    "Type for Parameter index %s is unexpected. Arguments for combine function must appear in the order of state1, state2, ..., otherState1, otherState2, ...",
                    i);
        }

        for (int i = 0; i < lambdaInterfaces.size(); i++) {
            verifyMethodParameterType(method, i + stateDescriptors.size() * 2, lambdaInterfaces.get(i), "function");
        }
    }