vigyasharma commented on code in PR #14929:
URL: https://github.com/apache/lucene/pull/14929#discussion_r2196391581


##########
lucene/core/src/test/org/apache/lucene/document/TestLateInteractionField.java:
##########
@@ -64,7 +64,7 @@ public void testInputValidation() {
     expectThrows(IllegalArgumentException.class, () -> 
LateInteractionField.encode(emptyTokens));
 
     final int dim = 128;
-    float[][] value = new float[random().nextInt(3, 12)][];
+    float[][] value = new float[random().nextInt(20, 30)][];

Review Comment:
   It happens if `random().nextBoolean()` in the test always returns the same 
value, thus generating all token vectors with the same dimensions. Instead of 
increasing the number of vectors this way, let's make the test more 
deterministic by ensuring that the last vector has different dimensions. 
Something like:
   
   ```java
       final int dim = 128;
       final int numVectors = random().nextInt(3, 12);
       float[][] value = new float[numVectors][];
       for (int i = 0; i < numVectors - 1; i++) {
         if (random().nextBoolean()) {
           value[i] = TestVectorUtil.randomVector(dim);
         } else {
           value[i] = TestVectorUtil.randomVector(dim + 1);
         }
       }
       value[numVectors - 1] = TestVectorUtil.randomVector(dim + 2);
       expectThrows(IllegalArgumentException.class, () -> 
LateInteractionField.encode(value));
   ```



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