diff --git a/processing/src/main/java/org/apache/druid/collections/bitmap/BatchIteratorAdapter.java b/processing/src/main/java/org/apache/druid/collections/bitmap/BatchIteratorAdapter.java index 225999f02c07..056acfea2b24 100644 --- a/processing/src/main/java/org/apache/druid/collections/bitmap/BatchIteratorAdapter.java +++ b/processing/src/main/java/org/apache/druid/collections/bitmap/BatchIteratorAdapter.java @@ -21,13 +21,13 @@ import com.google.common.base.Preconditions; import org.roaringbitmap.BatchIterator; -import org.roaringbitmap.IntIterator; +import org.roaringbitmap.PeekableIntIterator; public final class BatchIteratorAdapter implements BatchIterator { - private final IntIterator iterator; + private final PeekableIntIterator iterator; - public BatchIteratorAdapter(IntIterator iterator) + public BatchIteratorAdapter(PeekableIntIterator iterator) { this.iterator = Preconditions.checkNotNull(iterator, "iterator"); } @@ -49,6 +49,12 @@ public boolean hasNext() return iterator.hasNext(); } + @Override + public void advanceIfNeeded(int target) + { + iterator.advanceIfNeeded(target); + } + @Override public BatchIterator clone() { diff --git a/processing/src/main/java/org/apache/druid/collections/bitmap/ImmutableBitmap.java b/processing/src/main/java/org/apache/druid/collections/bitmap/ImmutableBitmap.java index c73a48c0ae4c..5dbdad93de57 100644 --- a/processing/src/main/java/org/apache/druid/collections/bitmap/ImmutableBitmap.java +++ b/processing/src/main/java/org/apache/druid/collections/bitmap/ImmutableBitmap.java @@ -47,7 +47,7 @@ default PeekableIntIterator peekableIterator() */ default BatchIterator batchIterator() { - return new BatchIteratorAdapter(iterator()); + return new BatchIteratorAdapter(peekableIterator()); } /**