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

   ### Description
   `LeafReader#getXXXVectorValues` may return null value.
   
   **Reproduction**:
   ```
   public class TestKnnByteVectorQuery extends BaseKnnVectorQueryTestCase {
     public void testVectorEncodingMismatch() throws IOException {
       try (Directory indexStore =
           getIndexStore("field", new float[] {0, 1}, new float[] {1, 2}, new 
float[] {0, 0});
           IndexReader reader = DirectoryReader.open(indexStore)) {
         AbstractKnnVectorQuery query =
             new KnnFloatVectorQuery("field", new float[] {0, 1}, 10);
         IndexSearcher searcher = newSearcher(reader);
         searcher.search(query, 10);
       }
     }
   }
   ```
   **Output**:
   ```
   java.lang.NullPointerException: Cannot invoke 
"org.apache.lucene.index.FloatVectorValues.size()" because the return value of 
"org.apache.lucene.index.LeafReader.getFloatVectorValues(String)" is null
        at 
__randomizedtesting.SeedInfo.seed([A63D89233AB7E539:F77A9739A165CB8D]:0)
        at 
org.apache.lucene.search.KnnFloatVectorQuery.approximateSearch(KnnFloatVectorQuery.java:92)
        at 
org.apache.lucene.search.AbstractKnnVectorQuery.getLeafResults(AbstractKnnVectorQuery.java:120)
        at 
org.apache.lucene.search.AbstractKnnVectorQuery.searchLeaf(AbstractKnnVectorQuery.java:104)
        at 
org.apache.lucene.search.AbstractKnnVectorQuery.lambda$rewrite$0(AbstractKnnVectorQuery.java:89)
        at 
org.apache.lucene.search.TaskExecutor$TaskGroup.lambda$createTask$0(TaskExecutor.java:117)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
        at 
org.apache.lucene.search.TaskExecutor$TaskGroup.invokeAll(TaskExecutor.java:152)
        at org.apache.lucene.search.TaskExecutor.invokeAll(TaskExecutor.java:76)
        at 
org.apache.lucene.search.AbstractKnnVectorQuery.rewrite(AbstractKnnVectorQuery.java:91)
        at 
org.apache.lucene.search.KnnFloatVectorQuery.rewrite(KnnFloatVectorQuery.java:45)
        at 
org.apache.lucene.search.IndexSearcher.rewrite(IndexSearcher.java:731)
        at 
org.apache.lucene.tests.search.AssertingIndexSearcher.rewrite(AssertingIndexSearcher.java:69)
        at 
org.apache.lucene.search.IndexSearcher.rewrite(IndexSearcher.java:742)
        at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:626)
        at 
org.apache.lucene.search.IndexSearcher.searchAfter(IndexSearcher.java:483)
        at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:498)
        at 
org.apache.lucene.search.TestKnnByteVectorQuery.testVectorEncodingMismatch(TestKnnByteVectorQuery.java:47)
        at 
java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
        at java.base/java.lang.reflect.Method.invoke(Method.java:580)
   ```
   <!--
   If this is your first contribution to Lucene, please make sure you have 
reviewed the contribution guide.
   https://github.com/apache/lucene/blob/main/CONTRIBUTING.md
   -->
   


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