File tree Expand file tree Collapse file tree 2 files changed +8
-6
lines changed
server/src/main/java/org/elasticsearch/index/codec/tsdb/es819
x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/lucene/read Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -1566,7 +1566,8 @@ public BlockLoader.Block tryRead(
15661566 }
15671567 try (var doubles = factory .singletonDoubles (valueCount )) {
15681568 var longs = new SingletonLongToDoubleDelegate (doubles , toDouble );
1569- for (int index = firstIndex ; index < lastIndex ;) {
1569+ for (int i = 0 ; i < valueCount ; ) {
1570+ final int index = firstIndex + i ;
15701571 final int blockIndex = index >>> ES819TSDBDocValuesFormat .NUMERIC_BLOCK_SHIFT ;
15711572 final int blockStartIndex = index & ES819TSDBDocValuesFormat .NUMERIC_BLOCK_MASK ;
15721573 if (blockIndex != currentBlockIndex ) {
@@ -1577,12 +1578,10 @@ public BlockLoader.Block tryRead(
15771578 currentBlockIndex = blockIndex ;
15781579 decoder .decode (valuesData , currentBlock );
15791580 }
1580- final int count = Math .min (
1581- ES819TSDBDocValuesFormat .NUMERIC_BLOCK_SIZE - blockStartIndex ,
1582- valueCount - (lastIndex - index )
1583- );
1581+ // bulk convert from the
1582+ final int count = Math .min (ES819TSDBDocValuesFormat .NUMERIC_BLOCK_SIZE - blockStartIndex , valueCount - i );
15841583 longs .appendLongs (currentBlock , blockStartIndex , count );
1585- index += count ;
1584+ i += count ;
15861585 }
15871586 return doubles .build ();
15881587 }
Original file line number Diff line number Diff line change @@ -65,6 +65,9 @@ public long estimatedBytes() {
6565
6666 @ Override
6767 public Block build () {
68+ if (values .length != count ) {
69+ throw new IllegalStateException ("expected " + values .length + " values but got " + count );
70+ }
6871 return blockFactory .newDoubleArrayVector (values , count ).asBlock ();
6972 }
7073
You can’t perform that action at this time.
0 commit comments