Skip to content

Commit 6bef1f0

Browse files
committed
Add assert for an interface it shouldn't implement yet
1 parent 7b36722 commit 6bef1f0

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

server/src/main/java/org/elasticsearch/index/codec/vectors/es93/OffHeapBFloat16VectorValues.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
import org.apache.lucene.codecs.hnsw.FlatVectorsScorer;
2323
import org.apache.lucene.codecs.lucene90.IndexedDISI;
24+
import org.apache.lucene.codecs.lucene95.HasIndexSlice;
2425
import org.apache.lucene.codecs.lucene95.OrdToDocDISIReaderConfiguration;
2526
import org.apache.lucene.index.FloatVectorValues;
2627
import org.apache.lucene.index.VectorEncoding;
@@ -63,6 +64,10 @@ abstract class OffHeapBFloat16VectorValues extends FloatVectorValues {
6364
this.flatVectorsScorer = flatVectorsScorer;
6465
bfloatBytes = new byte[dimension * BFloat16.BYTES];
6566
value = new float[dimension];
67+
68+
assert (this instanceof HasIndexSlice) == false
69+
: "BFloat16 should not implement HasIndexSlice until a bfloat16 scorer is created,"
70+
+ " else Lucene99MemorySegmentFlatVectorsScorer will try to access 4-byte floats here";
6671
}
6772

6873
@Override

0 commit comments

Comments
 (0)