use of com.facebook.presto.operator.aggregation.state.KeyValuePairsStateFactory in project presto by prestodb.
the class MapUnionAggregation method generateAggregation.
private static InternalAggregationFunction generateAggregation(Type keyType, Type valueType) {
DynamicClassLoader classLoader = new DynamicClassLoader(MapUnionAggregation.class.getClassLoader());
Type outputType = new MapType(keyType, valueType);
List<Type> inputTypes = ImmutableList.of(outputType);
KeyValuePairStateSerializer stateSerializer = new KeyValuePairStateSerializer(keyType, valueType);
Type intermediateType = stateSerializer.getSerializedType();
AggregationMetadata metadata = new AggregationMetadata(generateAggregationName(NAME, outputType.getTypeSignature(), inputTypes.stream().map(Type::getTypeSignature).collect(toImmutableList())), createInputParameterMetadata(outputType), INPUT_FUNCTION.bindTo(keyType).bindTo(valueType), COMBINE_FUNCTION, OUTPUT_FUNCTION, KeyValuePairsState.class, stateSerializer, new KeyValuePairsStateFactory(keyType, valueType), outputType);
GenericAccumulatorFactoryBinder factory = AccumulatorCompiler.generateAccumulatorFactoryBinder(metadata, classLoader);
return new InternalAggregationFunction(NAME, inputTypes, intermediateType, outputType, true, factory);
}
use of com.facebook.presto.operator.aggregation.state.KeyValuePairsStateFactory in project presto by prestodb.
the class MapAggregationFunction method generateAggregation.
private static InternalAggregationFunction generateAggregation(Type keyType, Type valueType) {
DynamicClassLoader classLoader = new DynamicClassLoader(MapAggregationFunction.class.getClassLoader());
List<Type> inputTypes = ImmutableList.of(keyType, valueType);
Type outputType = new MapType(keyType, valueType);
KeyValuePairStateSerializer stateSerializer = new KeyValuePairStateSerializer(keyType, valueType);
Type intermediateType = stateSerializer.getSerializedType();
AggregationMetadata metadata = new AggregationMetadata(generateAggregationName(NAME, outputType.getTypeSignature(), inputTypes.stream().map(Type::getTypeSignature).collect(toImmutableList())), createInputParameterMetadata(keyType, valueType), INPUT_FUNCTION.bindTo(keyType).bindTo(valueType), COMBINE_FUNCTION, OUTPUT_FUNCTION, KeyValuePairsState.class, stateSerializer, new KeyValuePairsStateFactory(keyType, valueType), outputType);
GenericAccumulatorFactoryBinder factory = AccumulatorCompiler.generateAccumulatorFactoryBinder(metadata, classLoader);
return new InternalAggregationFunction(NAME, inputTypes, intermediateType, outputType, true, factory);
}
use of com.facebook.presto.operator.aggregation.state.KeyValuePairsStateFactory in project presto by prestodb.
the class MapUnionAggregation method generateAggregation.
private static InternalAggregationFunction generateAggregation(Type keyType, Type valueType, MapType outputType) {
DynamicClassLoader classLoader = new DynamicClassLoader(MapUnionAggregation.class.getClassLoader());
List<Type> inputTypes = ImmutableList.of(outputType);
KeyValuePairStateSerializer stateSerializer = new KeyValuePairStateSerializer(outputType);
Type intermediateType = stateSerializer.getSerializedType();
AggregationMetadata metadata = new AggregationMetadata(generateAggregationName(NAME, outputType.getTypeSignature(), inputTypes.stream().map(Type::getTypeSignature).collect(toImmutableList())), createInputParameterMetadata(outputType), INPUT_FUNCTION.bindTo(keyType).bindTo(valueType), COMBINE_FUNCTION, OUTPUT_FUNCTION, ImmutableList.of(new AccumulatorStateDescriptor(KeyValuePairsState.class, stateSerializer, new KeyValuePairsStateFactory(keyType, valueType))), outputType);
GenericAccumulatorFactoryBinder factory = AccumulatorCompiler.generateAccumulatorFactoryBinder(metadata, classLoader);
return new InternalAggregationFunction(NAME, inputTypes, ImmutableList.of(intermediateType), outputType, true, true, factory);
}
use of com.facebook.presto.operator.aggregation.state.KeyValuePairsStateFactory in project presto by prestodb.
the class MapAggregationFunction method generateAggregation.
private static InternalAggregationFunction generateAggregation(Type keyType, Type valueType, MapType outputType) {
DynamicClassLoader classLoader = new DynamicClassLoader(MapAggregationFunction.class.getClassLoader());
List<Type> inputTypes = ImmutableList.of(keyType, valueType);
KeyValuePairStateSerializer stateSerializer = new KeyValuePairStateSerializer(outputType);
Type intermediateType = stateSerializer.getSerializedType();
AggregationMetadata metadata = new AggregationMetadata(generateAggregationName(NAME, outputType.getTypeSignature(), inputTypes.stream().map(Type::getTypeSignature).collect(toImmutableList())), createInputParameterMetadata(keyType, valueType), INPUT_FUNCTION.bindTo(keyType).bindTo(valueType), COMBINE_FUNCTION, OUTPUT_FUNCTION, ImmutableList.of(new AccumulatorStateDescriptor(KeyValuePairsState.class, stateSerializer, new KeyValuePairsStateFactory(keyType, valueType))), outputType);
GenericAccumulatorFactoryBinder factory = AccumulatorCompiler.generateAccumulatorFactoryBinder(metadata, classLoader);
return new InternalAggregationFunction(NAME, inputTypes, ImmutableList.of(intermediateType), outputType, true, true, factory);
}
Aggregations