Search in sources :

Example 1 with InputFunction

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);
}
Also used : HyperLogLog(io.airlift.stats.cardinality.HyperLogLog) InputFunction(com.facebook.presto.spi.function.InputFunction)

Example 2 with InputFunction

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());
}
Also used : QuantileDigest(io.airlift.stats.QuantileDigest) InputFunction(com.facebook.presto.spi.function.InputFunction)

Example 3 with InputFunction

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());
}
Also used : HyperLogLog(io.airlift.stats.cardinality.HyperLogLog) InputFunction(com.facebook.presto.spi.function.InputFunction)

Example 4 with InputFunction

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());
}
Also used : HyperLogLog(io.airlift.stats.cardinality.HyperLogLog) LiteralParameters(com.facebook.presto.spi.function.LiteralParameters) InputFunction(com.facebook.presto.spi.function.InputFunction)

Example 5 with InputFunction

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());
}
Also used : HyperLogLog(io.airlift.stats.cardinality.HyperLogLog) InputFunction(com.facebook.presto.spi.function.InputFunction)

Aggregations

InputFunction (com.facebook.presto.spi.function.InputFunction)10 HyperLogLog (io.airlift.stats.cardinality.HyperLogLog)6 QuantileDigest (io.airlift.stats.QuantileDigest)4 LiteralParameters (com.facebook.presto.spi.function.LiteralParameters)1