use of org.apache.druid.query.aggregation.histogram.FixedBucketsHistogram in project druid by druid-io.
the class FixedHistogramAddBenchmark method addFixedHisto.
@Benchmark
public void addFixedHisto(Blackhole bh) {
fixedHistogramForAdds = new FixedBucketsHistogram(LOWER_LIMIT, UPPER_LIMIT, numBuckets, FixedBucketsHistogram.OutlierHandlingMode.OVERFLOW);
for (int i = 0; i < numEvents; i++) {
fixedHistogramForAdds.add(randomValues[i]);
}
bh.consume(fixedHistogramForAdds);
}
use of org.apache.druid.query.aggregation.histogram.FixedBucketsHistogram in project druid by druid-io.
the class FixedHistogramBenchmark method deserializeFixedSparseLower.
@Benchmark
public void deserializeFixedSparseLower(Blackhole bh) {
FixedBucketsHistogram fixedBucketsHistogram = FixedBucketsHistogram.fromBytes(fixedSparseLowerSerialized);
bh.consume(fixedBucketsHistogram);
}
use of org.apache.druid.query.aggregation.histogram.FixedBucketsHistogram in project druid by druid-io.
the class FixedHistogramBenchmark method mergeFixedDifferentBuckets.
@Benchmark
public void mergeFixedDifferentBuckets(Blackhole bh) {
FixedBucketsHistogram copy = fixedHistogram.getCopy();
copy.combineHistogram(fixedHistogram2);
bh.consume(copy);
}
use of org.apache.druid.query.aggregation.histogram.FixedBucketsHistogram in project druid by druid-io.
the class FixedHistogramBenchmark method setup.
@Setup
public void setup() {
fixedHistogram = new FixedBucketsHistogram(LOWER_LIMIT, UPPER_LIMIT, numBuckets, FixedBucketsHistogram.OutlierHandlingMode.OVERFLOW);
fixedHistogram2 = new FixedBucketsHistogram(LOWER_LIMIT, UPPER_LIMIT, (int) Math.round(numBuckets * 1.5), FixedBucketsHistogram.OutlierHandlingMode.OVERFLOW);
fixedHistogram3 = new FixedBucketsHistogram(LOWER_LIMIT, UPPER_LIMIT, numBuckets, FixedBucketsHistogram.OutlierHandlingMode.OVERFLOW);
fixedHistogramForSparseLower = new FixedBucketsHistogram(LOWER_LIMIT, UPPER_LIMIT, numBuckets, FixedBucketsHistogram.OutlierHandlingMode.OVERFLOW);
fixedHistogramForSparseUpper = new FixedBucketsHistogram(LOWER_LIMIT, UPPER_LIMIT, numBuckets, FixedBucketsHistogram.OutlierHandlingMode.OVERFLOW);
randomValues = new int[numEvents];
Random r = ThreadLocalRandom.current();
for (int i = 0; i < numEvents; i++) {
randomValues[i] = r.nextInt(UPPER_LIMIT);
fixedHistogram.add(randomValues[i]);
fixedHistogram2.add(randomValues[i]);
fixedHistogram3.add(randomValues[i]);
if (randomValues[i] < UPPER_LIMIT * 0.4) {
fixedHistogramForSparseLower.add(randomValues[i]);
}
if (randomValues[i] > UPPER_LIMIT * 0.6) {
fixedHistogramForSparseUpper.add(randomValues[i]);
}
}
fixedFullSerializedAlready = fixedHistogram.toBytesFull(true);
fixedSparseLowerSerialized = fixedHistogramForSparseLower.toBytesSparse(fixedHistogram.getNonEmptyBucketCount());
fixedSparseUpperSerialized = fixedHistogramForSparseUpper.toBytesSparse(fixedHistogram.getNonEmptyBucketCount());
}
Aggregations