ChrisHegarty commented on code in PR #13872:
URL: https://github.com/apache/lucene/pull/13872#discussion_r1816669062


##########
lucene/core/src/java21/org/apache/lucene/internal/vectorization/Lucene99MemorySegmentByteVectorScorerSupplier.java:
##########
@@ -112,20 +96,20 @@ static final class CosineSupplier extends 
Lucene99MemorySegmentByteVectorScorerS
     @Override
     public RandomVectorScorer scorer(int ord) {
       checkOrdinal(ord);
+      MemorySegmentAccessInput slice = input.clone();
+      byte[] scratch1 = new byte[vectorByteSize];
+      byte[] scratch2 = new byte[vectorByteSize];

Review Comment:
   We don't know during construction whether or not access to the vector data 
in backing segment will *always* be available. The main reason is that a vector 
may span across multiple memory segments. (one MSIndexInput can be made up of 
several memory segments)
   
   This change is not right. The scratch buffers are created per supplier, 
since we know with the threading model that that is safe. Creating scratch 
buffers per scorer will be too expensive.
   



-- 
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-unsubscr...@lucene.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to