use of io.trino.spi.type.QuantileDigestType in project trino by trinodb.
the class MergeQuantileDigestFunction method specialize.
@Override
public AggregationMetadata specialize(BoundSignature boundSignature) {
QuantileDigestType outputType = (QuantileDigestType) boundSignature.getReturnType();
Type valueType = outputType.getValueType();
QuantileDigestStateSerializer stateSerializer = new QuantileDigestStateSerializer(valueType);
return new AggregationMetadata(INPUT_FUNCTION.bindTo(outputType), Optional.empty(), Optional.of(COMBINE_FUNCTION), OUTPUT_FUNCTION.bindTo(stateSerializer), ImmutableList.of(new AccumulatorStateDescriptor<>(QuantileDigestState.class, stateSerializer, new QuantileDigestStateFactory())));
}
use of io.trino.spi.type.QuantileDigestType in project trino by trinodb.
the class QuantileDigestAggregationFunction method specialize.
@Override
public AggregationMetadata specialize(BoundSignature boundSignature) {
QuantileDigestType outputType = (QuantileDigestType) boundSignature.getReturnType();
Type valueType = outputType.getValueType();
int arity = boundSignature.getArity();
QuantileDigestStateSerializer stateSerializer = new QuantileDigestStateSerializer(valueType);
MethodHandle inputFunction = getMethodHandle(valueType, arity);
inputFunction = normalizeInputMethod(inputFunction, boundSignature, ImmutableList.<AggregationParameterKind>builder().add(STATE).addAll(getInputTypes(valueType, arity).stream().map(ignored -> INPUT_CHANNEL).collect(Collectors.toList())).build());
return new AggregationMetadata(inputFunction, Optional.empty(), Optional.of(COMBINE_FUNCTION), OUTPUT_FUNCTION.bindTo(stateSerializer), ImmutableList.of(new AccumulatorStateDescriptor<>(QuantileDigestState.class, stateSerializer, new QuantileDigestStateFactory())));
}
Aggregations