dungba88 commented on code in PR #12738:
URL: https://github.com/apache/lucene/pull/12738#discussion_r1377348991
##########
lucene/core/src/java/org/apache/lucene/util/fst/FSTCompiler.java:
##########
@@ -461,9 +457,14 @@ long addNode(FSTCompiler.UnCompiledNode<T> nodeIn) throws
IOException {
final long thisNodeAddress = bytes.getPosition() - 1;
bytes.reverse(startAddress, thisNodeAddress);
nodeCount++;
- return thisNodeAddress;
+ // nocommit: this is non-optimal, we should write the BytesStore to the
ByteBlockPool directly
+ byte[] buf = new byte[Math.toIntExact(thisNodeAddress - startAddress + 1)];
+ bytes.copyBytes(startAddress, buf, 0, buf.length);
+ return new NodeAndBuffer(thisNodeAddress, buf);
}
+ record NodeAndBuffer(long nodeAddress, byte[] bytes) {}
Review Comment:
Ah yeah I put up some quick way to create the class, basically just a class
with 2 properties. And if we are to copy the bytes from BytesStore directly to
ByteBlockPool then will be no need for this. I'm thinking of having the
ByteBlockPool as argument of this 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]