romseygeek commented on code in PR #16077:
URL: https://github.com/apache/lucene/pull/16077#discussion_r3257138645
##########
lucene/CHANGES.txt:
##########
@@ -383,6 +383,9 @@ Optimizations
* GITHUB#16072: Added efficient implementations for
BitSetIterator#docIDRunEnd. (Ignacio Vera)
+* GITHUB#16077: Added efficient implementations if the method #docIDRunEnd for
the iteerators used
Review Comment:
```suggestion
* GITHUB#16077: Added efficient implementations if the method #docIDRunEnd
for the iterators used
```
##########
lucene/core/src/test/org/apache/lucene/util/TestRoaringDocIdSet.java:
##########
@@ -36,4 +37,75 @@ public void assertEquals(int numBits, BitSet ds1,
RoaringDocIdSet ds2) throws IO
super.assertEquals(numBits, ds1, ds2);
assertEquals(ds1.cardinality(), ds2.cardinality());
}
+
+ public void testDocIDRunEndContiguousWithinBlock() throws IOException {
+ final int maxDoc = 50_000;
+ BitSet bs = new BitSet();
+ for (int d = 12_345; d < 12_360; d++) {
+ bs.set(d);
+ }
+ RoaringDocIdSet set = copyOf(bs, maxDoc);
+ assertDocIDRunEndMatches(bs, maxDoc, set);
+ }
+
+ public void testDocIDRunEndAcross64KBoundary() throws IOException {
+ final int boundary = 1 << 16;
+ final int maxDoc = boundary + 100;
+ BitSet bs = new BitSet();
+ for (int d = boundary - 3; d < boundary + 7; d++) {
+ bs.set(d);
+ }
+ RoaringDocIdSet set = copyOf(bs, maxDoc);
+ assertDocIDRunEndMatches(bs, maxDoc, set);
+ }
+
Review Comment:
Let's add a test where the run end occurs directly on a boundary?
##########
lucene/core/src/test/org/apache/lucene/util/TestRoaringDocIdSet.java:
##########
@@ -36,4 +37,75 @@ public void assertEquals(int numBits, BitSet ds1,
RoaringDocIdSet ds2) throws IO
super.assertEquals(numBits, ds1, ds2);
assertEquals(ds1.cardinality(), ds2.cardinality());
}
+
+ public void testDocIDRunEndContiguousWithinBlock() throws IOException {
+ final int maxDoc = 50_000;
+ BitSet bs = new BitSet();
+ for (int d = 12_345; d < 12_360; d++) {
Review Comment:
Maybe add a comment explaining why we're using these numbers?
##########
lucene/core/src/java/org/apache/lucene/util/NotDocIdSet.java:
##########
@@ -77,6 +77,16 @@ public int advance(int target) throws IOException {
}
}
+ @Override
+ public int docIDRunEnd() throws IOException {
+ assert doc != NO_MORE_DOCS;
+ int skipped = nextSkippedDoc;
+ if (doc > skipped) {
+ skipped = inIterator.advance(doc);
Review Comment:
Doesn't this break the contract that calling docIDRunEnd() doesn't change
the current state of the iterator?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]