@@ -1719,6 +1719,7 @@ private static class TermsDictEntry {
1719
1719
1720
1720
static final class SingletonLongToSingletonOrdinalDelegate implements BlockLoader .SingletonLongBuilder {
1721
1721
private final BlockLoader .SingletonOrdinalsBuilder builder ;
1722
+ private final int [] buffer = new int [ES819TSDBDocValuesFormat .NUMERIC_BLOCK_SIZE ];
1722
1723
1723
1724
SingletonLongToSingletonOrdinalDelegate (BlockLoader .SingletonOrdinalsBuilder builder ) {
1724
1725
this .builder = builder ;
@@ -1731,20 +1732,21 @@ public BlockLoader.SingletonLongBuilder appendLong(long value) {
1731
1732
1732
1733
@ Override
1733
1734
public BlockLoader .SingletonLongBuilder appendLongs (long [] values , int from , int length ) {
1735
+ assert length <= buffer .length ;
1734
1736
// Unfortunately, no array copy here...
1735
1737
// Since we need to loop here, let's also keep track of min/max.
1736
1738
int minOrd = Integer .MAX_VALUE ;
1737
1739
int maxOrd = Integer .MIN_VALUE ;
1738
1740
int counter = 0 ;
1739
- int [] convertedOrds = new int [length ];
1740
1741
int end = from + length ;
1741
1742
for (int j = from ; j < end ; j ++) {
1742
1743
int ord = Math .toIntExact (values [j ]);
1743
- convertedOrds [counter ++] = ord ;
1744
+ buffer [counter ++] = ord ;
1744
1745
minOrd = Math .min (minOrd , ord );
1745
1746
maxOrd = Math .max (maxOrd , ord );
1746
1747
}
1747
- builder .appendOrds (convertedOrds , 0 , length , minOrd , maxOrd );
1748
+ assert counter == length ;
1749
+ builder .appendOrds (buffer , 0 , length , minOrd , maxOrd );
1748
1750
return this ;
1749
1751
}
1750
1752
0 commit comments