private static InternalAggregationFunction generateAggregation(Type valueType, Type keyType)
{
DynamicClassLoader classLoader = new DynamicClassLoader(MaxByAggregations.class.getClassLoader());
MaxByStateSerializer stateSerializer = new MaxByStateSerializer();
Type intermediateType = stateSerializer.getSerializedType();
List<Type> inputTypes = ImmutableList.of(valueType, keyType);
MaxByStateFactory stateFactory = new MaxByStateFactory(valueType, keyType);
AggregationMetadata metadata = new AggregationMetadata(