You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by "vignesh9727 (via GitHub)" <gi...@apache.org> on 2026/06/01 07:34:30 UTC

[PR] Fix OffHeapFloatVectorValues#prefetch to use bounded ord count [lucene]

vignesh9727 opened a new pull request, #16156:
URL: https://github.com/apache/lucene/pull/16156

   `OffHeapFloatVectorValues#prefetch` computes `finalNumOrds = Math.min(numOrds, ordsToPrefetch.length)` and uses it for the early-return guard, but then loops over `numOrds` instead of `finalNumOrds`. The byte counterpart `OffHeapByteVectorValues#prefetch` correctly loops over `finalNumOrds`.
   
   Since callers (e.g. `PrefetchableFlatVectorScorer`) pass a reused scratch array, `numOrds` can be smaller than the array length — the float path then prefetches stale ordinals from previous calls. If `numOrds` ever exceeded the array length, the loop would also go out of bounds (which `finalNumOrds` exists to prevent).
   
   One-line fix to match the byte implementation.
   
   Introduced in #15722.
   
   ---
   This is a trivial fix — a `skip-changelog` label may be appropriate.


-- 
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


Re: [PR] Fix OffHeapFloatVectorValues#prefetch to use bounded ord count [lucene]

Posted by "vignesh9727 (via GitHub)" <gi...@apache.org>.
vignesh9727 commented on PR #16156:
URL: https://github.com/apache/lucene/pull/16156#issuecomment-4599483278

   Hi @mikemccand The changelog entry is added and CI is fully green. Could you take a look when you have a moment?


-- 
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


Re: [PR] Fix OffHeapFloatVectorValues#prefetch to use bounded ord count [lucene]

Posted by "vignesh9727 (via GitHub)" <gi...@apache.org>.
vignesh9727 commented on PR #16156:
URL: https://github.com/apache/lucene/pull/16156#issuecomment-4604016471

   @benwtrent  Added testPrefetchBoundedByArrayLength in `TestOffHeapVectorValues.java`. Passes an array of length 2 with numOrds=5 and asserts only 2 prefetches happen — this would throw ArrayIndexOutOfBoundsException on the old code. All three test pass locally.. 


-- 
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


Re: [PR] Fix OffHeapFloatVectorValues#prefetch to use bounded ord count [lucene]

Posted by "benwtrent (via GitHub)" <gi...@apache.org>.
benwtrent commented on PR #16156:
URL: https://github.com/apache/lucene/pull/16156#issuecomment-4603146569

   @vignesh9727 please add a test to lucene/core/src/test/org/apache/lucene/codecs/lucene95/TestOffHeapVectorValues.java
   
   Obviously something was missed, it seems we need a test that ensures only `numOrds` is prefetched instead of the entire array every time.


-- 
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


Re: [PR] Fix OffHeapFloatVectorValues#prefetch to use bounded ord count [lucene]

Posted by "benwtrent (via GitHub)" <gi...@apache.org>.
benwtrent merged PR #16156:
URL: https://github.com/apache/lucene/pull/16156


-- 
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