This is an automated email from the ASF dual-hosted git repository.
richardstartin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pinot.git
The following commit(s) were added to refs/heads/master by this push:
new d047e7b optimise iteration (#8213)
d047e7b is described below
commit d047e7b8ce27d45a9444f9dd857b1e865e8659a3
Author: Richard Startin <[email protected]>
AuthorDate: Thu Feb 17 07:27:52 2022 +0000
optimise iteration (#8213)
---
.../local/indexsegment/mutable/MutableSegmentImpl.java | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git
a/pinot-segment-local/src/main/java/org/apache/pinot/segment/local/indexsegment/mutable/MutableSegmentImpl.java
b/pinot-segment-local/src/main/java/org/apache/pinot/segment/local/indexsegment/mutable/MutableSegmentImpl.java
index 47479a8..f66e76b 100644
---
a/pinot-segment-local/src/main/java/org/apache/pinot/segment/local/indexsegment/mutable/MutableSegmentImpl.java
+++
b/pinot-segment-local/src/main/java/org/apache/pinot/segment/local/indexsegment/mutable/MutableSegmentImpl.java
@@ -88,7 +88,8 @@ import org.apache.pinot.spi.stream.RowMetadata;
import org.apache.pinot.spi.utils.ByteArray;
import org.apache.pinot.spi.utils.FixedIntArray;
import org.apache.pinot.spi.utils.builder.TableNameBuilder;
-import org.roaringbitmap.IntIterator;
+import org.roaringbitmap.BatchIterator;
+import org.roaringbitmap.buffer.MutableRoaringBitmap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -911,11 +912,15 @@ public class MutableSegmentImpl implements MutableSegment
{
// Re-order documents using the inverted index
RealtimeInvertedIndexReader invertedIndex = indexContainer._invertedIndex;
int[] docIds = new int[_numDocsIndexed];
+ int[] batch = new int[256];
int docIdIndex = 0;
for (int dictId : dictIds) {
- IntIterator intIterator =
invertedIndex.getDocIds(dictId).getIntIterator();
- while (intIterator.hasNext()) {
- docIds[docIdIndex++] = intIterator.next();
+ MutableRoaringBitmap bitmap = invertedIndex.getDocIds(dictId);
+ BatchIterator iterator = bitmap.getBatchIterator();
+ while (iterator.hasNext()) {
+ int limit = iterator.nextBatch(batch);
+ System.arraycopy(batch, 0, docIds, docIdIndex, limit);
+ docIdIndex += limit;
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]