From 8e68427409518e9f9096f4f3a26a2617de35dbc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xavier=20L=C3=A9aut=C3=A9?= Date: Mon, 18 Sep 2023 11:43:32 -0700 Subject: [PATCH] implement workaround for BatchIterator interface change --- .../collections/bitmap/BatchIteratorAdapter.java | 12 +++++++++--- .../druid/collections/bitmap/ImmutableBitmap.java | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) 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()); } /**