@@ -649,9 +649,6 @@ public Runnable merge(
649
649
return oneDimWriter .finish ();
650
650
}
651
651
652
- // Reused when writing leaf blocks
653
- private final ByteBuffersDataOutput scratchOut = ByteBuffersDataOutput .newResettableInstance ();
654
-
655
652
private class OneDimensionBKDWriter {
656
653
657
654
final IndexOutput metaOut , indexOut , dataOut ;
@@ -820,9 +817,8 @@ private void writeLeafBlock(int leafCardinality) throws IOException {
820
817
821
818
commonPrefixLengths [0 ] = prefix ;
822
819
823
- assert scratchOut .size () == 0 ;
824
- writeLeafBlockDocs (scratchOut , leafDocs , 0 , leafCount );
825
- writeCommonPrefixes (scratchOut , commonPrefixLengths , leafValues );
820
+ writeLeafBlockDocs (dataOut , leafDocs , 0 , leafCount );
821
+ writeCommonPrefixes (dataOut , commonPrefixLengths , leafValues );
826
822
827
823
scratchBytesRef1 .length = config .packedBytesLength ;
828
824
scratchBytesRef1 .bytes = leafValues ;
@@ -848,9 +844,7 @@ assert valuesInOrderAndBounds(
848
844
leafDocs ,
849
845
0 );
850
846
writeLeafBlockPackedValues (
851
- scratchOut , commonPrefixLengths , leafCount , 0 , packedValues , leafCardinality );
852
- scratchOut .copyTo (dataOut );
853
- scratchOut .reset ();
847
+ dataOut , commonPrefixLengths , leafCount , 0 , packedValues , leafCardinality );
854
848
}
855
849
}
856
850
@@ -1728,21 +1722,19 @@ private void build(
1728
1722
// Save the block file pointer:
1729
1723
leafBlockFPs [leavesOffset ] = out .getFilePointer ();
1730
1724
1731
- assert scratchOut .size () == 0 ;
1732
-
1733
1725
// Write doc IDs
1734
1726
int [] docIDs = spareDocIds ;
1735
1727
for (int i = from ; i < to ; ++i ) {
1736
1728
docIDs [i - from ] = reader .getDocID (i );
1737
1729
}
1738
1730
// System.out.println("writeLeafBlock pos=" + out.getFilePointer());
1739
- writeLeafBlockDocs (scratchOut , docIDs , 0 , count );
1731
+ writeLeafBlockDocs (out , docIDs , 0 , count );
1740
1732
1741
1733
// Write the common prefixes:
1742
1734
reader .getValue (from , scratchBytesRef1 );
1743
1735
System .arraycopy (
1744
1736
scratchBytesRef1 .bytes , scratchBytesRef1 .offset , scratch1 , 0 , config .packedBytesLength );
1745
- writeCommonPrefixes (scratchOut , commonPrefixLengths , scratch1 );
1737
+ writeCommonPrefixes (out , commonPrefixLengths , scratch1 );
1746
1738
1747
1739
// Write the full values:
1748
1740
IntFunction <BytesRef > packedValues =
@@ -1756,9 +1748,7 @@ public BytesRef apply(int i) {
1756
1748
assert valuesInOrderAndBounds (
1757
1749
config , count , sortedDim , minPackedValue , maxPackedValue , packedValues , docIDs , 0 );
1758
1750
writeLeafBlockPackedValues (
1759
- scratchOut , commonPrefixLengths , count , sortedDim , packedValues , leafCardinality );
1760
- scratchOut .copyTo (out );
1761
- scratchOut .reset ();
1751
+ out , commonPrefixLengths , count , sortedDim , packedValues , leafCardinality );
1762
1752
} else {
1763
1753
// inner node
1764
1754
0 commit comments