use of io.prestosql.spi.type.QuantileDigestType 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.spi.type.QuantileDigestType in project hetu-core by openlookeng.
the class MergeQuantileDigestFunction method specialize.
@Override
public InternalAggregationFunction specialize(BoundVariables boundVariables, int arity, FunctionAndTypeManager functionAndTypeManager) {
Type valueType = boundVariables.getTypeVariable("T");
QuantileDigestType outputType = (QuantileDigestType) functionAndTypeManager.getParameterizedType(StandardTypes.QDIGEST, ImmutableList.of(TypeSignatureParameter.of(valueType.getTypeSignature())));
return generateAggregation(valueType, outputType);
}
use of io.prestosql.spi.type.QuantileDigestType 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);
}
use of io.prestosql.spi.type.QuantileDigestType in project hetu-core by openlookeng.
the class QuantileDigestAggregationFunction method specialize.
@Override
public InternalAggregationFunction specialize(BoundVariables boundVariables, int arity, FunctionAndTypeManager functionAndTypeManager) {
Type valueType = boundVariables.getTypeVariable("V");
QuantileDigestType outputType = (QuantileDigestType) functionAndTypeManager.getParameterizedType(StandardTypes.QDIGEST, ImmutableList.of(TypeSignatureParameter.of(valueType.getTypeSignature())));
return generateAggregation(valueType, outputType, arity);
}
Aggregations