jainankitk commented on code in PR #14397: URL: https://github.com/apache/lucene/pull/14397#discussion_r2021748068
########## 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: Yes, looks so much cleaner now. Thanks for the refactoring! -- 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: issues-unsubscr...@lucene.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org