Skip to content

Commit ba0a6b9

Browse files
committed
Avoid doing checks on dense vectors as we can't cast to BlockBuilder
1 parent c951ee7 commit ba0a6b9

File tree

1 file changed

+1
-40
lines changed

1 file changed

+1
-40
lines changed

x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/lucene/ValuesSourceReaderOperator.java

Lines changed: 1 addition & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import org.elasticsearch.compute.data.DocBlock;
2222
import org.elasticsearch.compute.data.DocVector;
2323
import org.elasticsearch.compute.data.ElementType;
24-
import org.elasticsearch.compute.data.FloatBlock;
2524
import org.elasticsearch.compute.data.IntVector;
2625
import org.elasticsearch.compute.data.Page;
2726
import org.elasticsearch.compute.data.SingletonOrdinalsBuilder;
@@ -657,45 +656,7 @@ public BlockLoader.DoubleBuilder doubles(int expectedCount) {
657656

658657
@Override
659658
public BlockLoader.FloatBuilder denseVectors(int expectedVectorsCount, int dimensions) {
660-
FloatBlock.Builder builder = factory.newFloatBlockBuilder(expectedVectorsCount * dimensions);
661-
662-
return new BlockLoader.FloatBuilder() {
663-
int numElements = 0;
664-
665-
@Override
666-
public BlockLoader.FloatBuilder appendFloat(float value) {
667-
numElements++;
668-
return builder.appendFloat(value);
669-
}
670-
671-
@Override
672-
public BlockLoader.Block build() {
673-
assert numElements == 0 : "endPositionEntry() was not called before build()";
674-
return builder.build();
675-
}
676-
677-
@Override
678-
public BlockLoader.Builder appendNull() {
679-
throw new IllegalArgumentException("null values are not expected for dense vectors");
680-
}
681-
682-
@Override
683-
public BlockLoader.Builder beginPositionEntry() {
684-
return builder.beginPositionEntry();
685-
}
686-
687-
@Override
688-
public BlockLoader.Builder endPositionEntry() {
689-
assert numElements == dimensions : "expected " + dimensions + " dimensions, but got " + numElements + " elements";
690-
numElements = 0;
691-
return builder.endPositionEntry();
692-
}
693-
694-
@Override
695-
public void close() {
696-
builder.close();
697-
}
698-
};
659+
return factory.newFloatBlockBuilder(expectedVectorsCount * dimensions);
699660
}
700661

701662
@Override

0 commit comments

Comments
 (0)