raghavyadav01 commented on code in PR #20071:
URL: https://github.com/apache/pinot/pull/20071#discussion_r4463466985
##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/segment/index/readers/text/PinotBufferLuceneDirectory.java:
##########
@@ -109,7 +114,14 @@ public IndexInput openInput(String name, IOContext context)
if (fileInfo == null) {
throw new IOException("File not found: " + name);
}
- return new PinotBufferIndexInput(name, _indexBuffer, fileInfo.getOffset(),
fileInfo.getSize());
+ long size = fileInfo.getSize();
+ if (size <= Integer.MAX_VALUE) {
+ // A direct view of the buffer: Lucene reads vectors and postings with
bulk, zero-copy accessors instead of
+ // refilling a small heap buffer for every read
+ ByteBuffer view = _indexBuffer.toDirectByteBuffer(fileInfo.getOffset(),
(int) size, ByteOrder.LITTLE_ENDIAN);
+ return new ByteBuffersIndexInput(new
ByteBuffersDataInput(List.of(view)), name);
+ }
+ return new PinotBufferIndexInput(name, _indexBuffer, fileInfo.getOffset(),
size);
Review Comment:
Good idea. I'll do the 1 GB block split as a follow-up, which also lets us
drop PinotBufferIndexInput. It needs a >2 GB fixture to test, so I'd keep it
out of this PR.
--
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]