use of com.facebook.presto.operator.aggregation.state.StatisticalDigestStateSerializer in project presto by prestodb.
the class StatisticalDigestAggregationFunction method generateAggregation.
private InternalAggregationFunction generateAggregation(String name, Type valueType, Type outputType, int arity) {
DynamicClassLoader classLoader = new DynamicClassLoader(StatisticalDigestAggregationFunction.class.getClassLoader());
List<Type> inputTypes = getInputTypes(valueType, arity);
StatisticalDigestStateSerializer stateSerializer = new StatisticalDigestStateSerializer();
Type intermediateType = stateSerializer.getSerializedType();
AggregationMetadata metadata = new AggregationMetadata(generateAggregationName(name, outputType.getTypeSignature(), inputTypes.stream().map(Type::getTypeSignature).collect(toImmutableList())), createInputParameterMetadata(inputTypes), getInputMethodHandle(valueType, arity), COMBINE_FUNCTION, OUTPUT_FUNCTION.bindTo(stateSerializer), ImmutableList.of(new AccumulatorStateDescriptor(StatisticalDigestState.class, stateSerializer, factory)), 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.StatisticalDigestStateSerializer in project presto by prestodb.
the class MergeStatisticalDigestFunction method generateAggregation.
private InternalAggregationFunction generateAggregation(Type type) {
DynamicClassLoader classLoader = new DynamicClassLoader(MapAggregationFunction.class.getClassLoader());
StatisticalDigestStateSerializer stateSerializer = new StatisticalDigestStateSerializer();
Type intermediateType = stateSerializer.getSerializedType();
AggregationMetadata metadata = new AggregationMetadata(generateAggregationName(name, type.getTypeSignature(), ImmutableList.of(type.getTypeSignature())), createInputParameterMetadata(type), getInputFunction().bindTo(type), COMBINE_FUNCTION, OUTPUT_FUNCTION.bindTo(stateSerializer), ImmutableList.of(new AccumulatorStateDescriptor(StatisticalDigestState.class, stateSerializer, factory)), type);
GenericAccumulatorFactoryBinder factory = AccumulatorCompiler.generateAccumulatorFactoryBinder(metadata, classLoader);
return new InternalAggregationFunction(name, ImmutableList.of(type), ImmutableList.of(intermediateType), type, true, true, factory);
}
Aggregations