jainankitk commented on code in PR #14397:
URL: https://github.com/apache/lucene/pull/14397#discussion_r2019666086
##########
lucene/core/src/java/org/apache/lucene/codecs/lucene90/compressing/Lucene90CompressingStoredFieldsReader.java:
##########
@@ -512,6 +512,7 @@ private void doReset(int docID) throws IOException {
bytes.offset = bytes.length = 0;
for (int decompressed = 0; decompressed < totalLength; ) {
final int toDecompress = Math.min(totalLength - decompressed,
chunkSize);
+ decompressor.reset();
decompressor.decompress(fieldsStream, toDecompress, 0,
toDecompress, spare);
Review Comment:
I am wondering if reset should be the default behavior. We can pass another
flag to indicate reuse if possible.
##########
lucene/core/src/java/org/apache/lucene/codecs/lucene90/LZ4WithPresetDictCompressionMode.java:
##########
@@ -144,10 +148,85 @@ public void decompress(DataInput in, int originalLength,
int offset, int length,
assert bytes.isValid();
}
+ @Override
+ public void decompress(
+ IndexInput in, int originalLength, int offset, int length, BytesRef
bytes)
+ throws IOException {
+ assert offset + length <= originalLength;
+
+ if (length == 0) {
+ bytes.length = 0;
+ return;
+ }
+
+ final int dictLength = in.readVInt();
+ final int blockLength = in.readVInt();
+
+ final int numBlocks = readCompressedLengths(in, originalLength,
dictLength, blockLength);
+
+ buffer = ArrayUtil.grow(buffer, dictLength + blockLength);
+ long startPointer = in.getFilePointer();
+ bytes.length = 0;
+ if (cachedDictFilPointer == startPointer) {
+ assert cachedDictLength == dictLength && dictEndFilePointer > 0;
+ in.seek(dictEndFilePointer);
Review Comment:
I am wondering if we can reuse the common code across this and other
decompress method?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]