jpountz commented on code in PR #12064: URL: https://github.com/apache/lucene/pull/12064#discussion_r1061739690
########## lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene94/Lucene94HnswVectorsReader.java: ########## @@ -233,12 +234,19 @@ public void checkIntegrity() throws IOException { @Override public VectorValues getVectorValues(String field) throws IOException { FieldEntry fieldEntry = fields.get(field); - VectorValues values = OffHeapVectorValues.load(fieldEntry, vectorData); - if (fieldEntry.vectorEncoding == VectorEncoding.BYTE) { - return new ExpandingVectorValues(values); - } else { - return values; + if (fieldEntry.vectorEncoding != VectorEncoding.FLOAT32) { + return null; } + return OffHeapVectorValues.load(fieldEntry, vectorData); + } + + @Override + public ByteVectorValues getByteVectorValues(String field) throws IOException { + FieldEntry fieldEntry = fields.get(field); + if (fieldEntry.vectorEncoding != VectorEncoding.BYTE) { + return null; + } Review Comment: this `if` statement should be unnecessary since CodecReader already checks field infos? Can we fail hard if the encoding is not right instead of returning null? -- 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