You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by "neoremind (via GitHub)" <gi...@apache.org> on 2026/07/01 10:25:50 UTC
Re: [PR] Apply GCD bound transform to sorted numeric rangeIntoBitSet [lucene]
neoremind commented on code in PR #16285:
URL: https://github.com/apache/lucene/pull/16285#discussion_r3505093968
##########
lucene/core/src/test/org/apache/lucene/search/TestSkipBlockRangeIteratorIntoBitSet.java:
##########
@@ -694,4 +694,151 @@ private void doTestSortedNumericRangeIntoBitSet(boolean dense, boolean fixedCard
}
}
}
+
+ /** Tests rangeIntoBitSet on GCD-encoded sorted numeric doc values with fixed cardinality. */
+ public void testSortedNumericGcdEncodedRangeIntoBitSet() throws Exception {
+ doTestSortedNumericGcdRangeIntoBitSet(true, 3, 7, 1_000_000L);
+ }
+
+ /** Tests rangeIntoBitSet on delta-only encoded sorted numeric doc values. */
+ public void testSortedNumericDeltaOnlyRangeIntoBitSet() throws Exception {
+ doTestSortedNumericGcdRangeIntoBitSet(true, 2, 1, 1_700_000_000_000L);
+ }
+
+ /** Tests rangeIntoBitSet on GCD-encoded sparse sorted numeric doc values. */
+ public void testSortedNumericGcdEncodedSparseRangeIntoBitSet() throws Exception {
+ doTestSortedNumericGcdRangeIntoBitSet(false, 4, 100, 500_000L);
+ }
+
+ /** Tests rangeIntoBitSet with negative values to exercise saturating shift overflow paths. */
+ public void testSortedNumericGcdNegativeValuesRangeIntoBitSet() throws Exception {
+ doTestSortedNumericGcdRangeIntoBitSet(true, 3, 7, -1_000_000_000L);
+ }
+
+ private void doTestSortedNumericGcdRangeIntoBitSet(
+ boolean dense, int cardinality, long gcd, long offset) throws Exception {
+ int numDocs = 4096 * 2;
+ try (Directory dir = newDirectory()) {
+ IndexWriterConfig iwc = new IndexWriterConfig().setCodec(new Lucene104Codec());
+ try (IndexWriter w = new IndexWriter(dir, iwc)) {
+ for (int docID = 0; docID < numDocs; docID++) {
+ Document doc = new Document();
+ if (dense || docID % 3 != 0) {
+ long base = ((docID * 13L) % 100) * gcd + offset;
+ for (int i = 0; i < cardinality; i++) {
Review Comment:
Looks like a fixed cardinality (> 1) is used here. Would it be better to add a randomized variable here? In dense case, if rawValues != null with denseFixedCardinality == 1 or -1 lacks test coverage for fallback loop.
--
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: issues-unsubscribe@lucene.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org