Skip to content

Commit 430a5ce

Browse files
committed
Nits
1 parent d9ab7ba commit 430a5ce

File tree

4 files changed

+10
-2
lines changed

4 files changed

+10
-2
lines changed

benchmarks/src/test/java/org/apache/druid/benchmark/SpectatorHistogramAggregatorBenchmark.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ public static void main(String[] args) throws RunnerException
321321
.include(SpectatorHistogramAggregatorBenchmark.class.getSimpleName())
322322
.forks(1)
323323
.warmupIterations(1)
324-
.measurementIterations(2)
324+
.measurementIterations(10)
325325
.build();
326326
new Runner(opt).run();
327327
}

extensions-contrib/spectator-histogram/src/main/java/org/apache/druid/spectator/histogram/SpectatorHistogram.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ byte[] toBytes()
278278

279279
public void insert(Number num)
280280
{
281-
this.add(PercentileBuckets.indexOf(num.longValue()), 1L);
281+
this.insert(num.longValue());
282282
}
283283

284284
public void insert(long num)

extensions-contrib/spectator-histogram/src/main/java/org/apache/druid/spectator/histogram/SpectatorHistogramNumericVectorizedAggregator.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ public void aggregate(ByteBuffer buffer, int numRows, int[] positions, @Nullable
7474
boolean hasNulls = isNull != null;
7575

7676
final Int2ObjectMap<SpectatorHistogram> histMap = innerAggregator.get(buffer);
77+
if (histMap == null) {
78+
return;
79+
}
80+
7781
for (int i = 0; i < numRows; ++i) {
7882
int rowIndex = rows != null ? rows[i] : i;
7983
boolean rowIsNull = hasNulls && isNull[rowIndex];

extensions-contrib/spectator-histogram/src/main/java/org/apache/druid/spectator/histogram/SpectatorHistogramVectorizedAggregator.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@ public void aggregate(ByteBuffer buffer, int numRows, int[] positions, @Nullable
7575
}
7676

7777
final Int2ObjectMap<SpectatorHistogram> histMap = innerAggregator.get(buffer);
78+
if (histMap == null) {
79+
return;
80+
}
81+
7882
for (int i = 0; i < numRows; ++i) {
7983
int rowIndex = rows != null ? rows[i] : i;
8084
Object other = vector[rowIndex];

0 commit comments

Comments
 (0)