use of io.airlift.stats.cardinality.HyperLogLog in project presto by prestodb.
the class CreateHll method createHll.
@ScalarFunction
@SqlType(StandardTypes.HYPER_LOG_LOG)
public static Slice createHll(@SqlType(StandardTypes.BIGINT) long value) {
HyperLogLog hll = HyperLogLog.newInstance(4096);
hll.add(value);
return hll.serialize();
}
use of io.airlift.stats.cardinality.HyperLogLog 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 io.airlift.stats.cardinality.HyperLogLog 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 io.airlift.stats.cardinality.HyperLogLog 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 io.airlift.stats.cardinality.HyperLogLog 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