adelapena commented on code in PR #2989:
URL: https://github.com/apache/cassandra/pull/2989#discussion_r1426661183
##########
src/java/org/apache/cassandra/index/sai/disk/v1/segment/SegmentBuilder.java:
##########
@@ -112,54 +114,31 @@ protected SegmentMetadata.ComponentMetadataMap
flushInternal(IndexDescriptor ind
indexIdentifier,
indexTermType.fixedSizeOf(),
maxSegmentRowId);
- return writer.writeCompleteSegment(trieBuffer.iterator());
+ return writer.writeCompleteSegment(segmentRamBuffer.iterator());
}
}
- public static class RAMStringSegmentBuilder extends SegmentBuilder
+ public static class LiteralSegmentBuilder extends RamBufferSegmentBuilder
{
- final RAMStringIndexer ramIndexer;
-
- final BytesRefBuilder stringBuffer = new BytesRefBuilder();
-
- public RAMStringSegmentBuilder(IndexTermType indexTermType,
NamedMemoryLimiter limiter)
+ public LiteralSegmentBuilder(IndexTermType indexTermType,
NamedMemoryLimiter limiter)
{
super(indexTermType, limiter);
-
- ramIndexer = new RAMStringIndexer();
- totalBytesAllocated = ramIndexer.estimatedBytesUsed();
- }
-
- @Override
- public boolean isEmpty()
- {
- return ramIndexer.isEmpty();
}
@Override
protected long addInternal(ByteBuffer term, int segmentRowId)
{
- copyBufferToBytesRef(term, stringBuffer);
- return ramIndexer.add(stringBuffer.get(), segmentRowId);
+ return segmentRamBuffer.add(v -> ByteSource.fixedLength(term),
term.limit(), segmentRowId);
Review Comment:
Do all literal terms have fixed length?
--
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]