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(
generateAggregationName(NAME, valueType, inputTypes),
createInputParameterMetadata(valueType, keyType),
lookupInputFunction(),
null,