use of io.prestosql.operator.aggregation.state.QuantileDigestStateSerializer in project hetu-core by openlookeng.
the class QuantileDigestAggregationFunction method generateAggregation.
private static InternalAggregationFunction generateAggregation(Type valueType, QuantileDigestType outputType, int arity) {
DynamicClassLoader classLoader = new DynamicClassLoader(QuantileDigestAggregationFunction.class.getClassLoader());
List<Type> inputTypes = getInputTypes(valueType, arity);
QuantileDigestStateSerializer stateSerializer = new QuantileDigestStateSerializer(valueType);
Type intermediateType = stateSerializer.getSerializedType();
AggregationMetadata metadata = new AggregationMetadata(generateAggregationName(NAME, outputType.getTypeSignature(), inputTypes.stream().map(Type::getTypeSignature).collect(toImmutableList())), createInputParameterMetadata(inputTypes), getMethodHandle(valueType, arity), COMBINE_FUNCTION, OUTPUT_FUNCTION.bindTo(stateSerializer), ImmutableList.of(new AccumulatorStateDescriptor(QuantileDigestState.class, stateSerializer, new QuantileDigestStateFactory())), outputType);
GenericAccumulatorFactoryBinder factory = AccumulatorCompiler.generateAccumulatorFactoryBinder(metadata, classLoader);
return new InternalAggregationFunction(NAME, inputTypes, ImmutableList.of(intermediateType), outputType, true, true, factory);
}
use of io.prestosql.operator.aggregation.state.QuantileDigestStateSerializer in project hetu-core by openlookeng.
the class MergeQuantileDigestFunction method generateAggregation.
private static InternalAggregationFunction generateAggregation(Type valueType, QuantileDigestType type) {
DynamicClassLoader classLoader = new DynamicClassLoader(MapAggregationFunction.class.getClassLoader());
QuantileDigestStateSerializer stateSerializer = new QuantileDigestStateSerializer(valueType);
Type intermediateType = stateSerializer.getSerializedType();
AggregationMetadata metadata = new AggregationMetadata(generateAggregationName(NAME, type.getTypeSignature(), ImmutableList.of(type.getTypeSignature())), createInputParameterMetadata(type), INPUT_FUNCTION.bindTo(type), COMBINE_FUNCTION, OUTPUT_FUNCTION.bindTo(stateSerializer), ImmutableList.of(new AccumulatorStateDescriptor(QuantileDigestState.class, stateSerializer, new QuantileDigestStateFactory())), type);
GenericAccumulatorFactoryBinder factory = AccumulatorCompiler.generateAccumulatorFactoryBinder(metadata, classLoader);
return new InternalAggregationFunction(NAME, ImmutableList.of(type), ImmutableList.of(intermediateType), type, true, true, factory);
}
Aggregations