use of com.facebook.presto.spi.function.InputFunction in project presto by prestodb.
the class MergeHyperLogLogAggregation method input.
@InputFunction
public static void input(@AggregationState HyperLogLogState state, @SqlType(StandardTypes.HYPER_LOG_LOG) Slice value) {
HyperLogLog input = HyperLogLog.newInstance(value);
merge(state, input);
}
use of com.facebook.presto.spi.function.InputFunction in project presto by prestodb.
the class ApproximateLongPercentileArrayAggregations method weightedInput.
@InputFunction
public static void weightedInput(@AggregationState DigestAndPercentileArrayState state, @SqlType(StandardTypes.BIGINT) long value, @SqlType(StandardTypes.BIGINT) long weight, @SqlType("array(double)") Block percentilesArrayBlock) {
initializePercentilesArray(state, percentilesArrayBlock);
initializeDigest(state);
QuantileDigest digest = state.getDigest();
state.addMemoryUsage(-digest.estimatedInMemorySizeInBytes());
digest.add(value, weight);
state.addMemoryUsage(digest.estimatedInMemorySizeInBytes());
}
use of com.facebook.presto.spi.function.InputFunction in project presto by prestodb.
the class ApproximateSetAggregation method input.
@InputFunction
public static void input(@AggregationState HyperLogLogState state, @SqlType(StandardTypes.BIGINT) long value) {
HyperLogLog hll = getOrCreateHyperLogLog(state);
state.addMemoryUsage(-hll.estimatedInMemorySize());
hll.add(value);
state.addMemoryUsage(hll.estimatedInMemorySize());
}
use of com.facebook.presto.spi.function.InputFunction in project presto by prestodb.
the class ApproximateSetAggregation method input.
@InputFunction
@LiteralParameters("x")
public static void input(@AggregationState HyperLogLogState state, @SqlType("varchar(x)") Slice value) {
HyperLogLog hll = getOrCreateHyperLogLog(state);
state.addMemoryUsage(-hll.estimatedInMemorySize());
hll.add(value);
state.addMemoryUsage(hll.estimatedInMemorySize());
}
use of com.facebook.presto.spi.function.InputFunction in project presto by prestodb.
the class ApproximateSetAggregation method input.
@InputFunction
public static void input(@AggregationState HyperLogLogState state, @SqlType(StandardTypes.DOUBLE) double value) {
HyperLogLog hll = getOrCreateHyperLogLog(state);
state.addMemoryUsage(-hll.estimatedInMemorySize());
hll.add(Double.doubleToLongBits(value));
state.addMemoryUsage(hll.estimatedInMemorySize());
}
Aggregations