adelapena commented on code in PR #2989:
URL: https://github.com/apache/cassandra/pull/2989#discussion_r1426648741


##########
src/java/org/apache/cassandra/index/sai/disk/v1/segment/SegmentBuilder.java:
##########
@@ -78,31 +75,36 @@ public abstract class SegmentBuilder
     int rowCount = 0;
     int maxSegmentRowId = -1;
 
-    public static class BlockBalancedTreeSegmentBuilder extends SegmentBuilder
+    public static abstract class RamBufferSegmentBuilder extends SegmentBuilder
     {
-        private final byte[] scratch;
-        private final BlockBalancedTreeRamBuffer trieBuffer;
+        protected final SegmentRamBuffer segmentRamBuffer;
 
-        public BlockBalancedTreeSegmentBuilder(IndexTermType indexTermType, 
NamedMemoryLimiter limiter)
+        protected RamBufferSegmentBuilder(IndexTermType indexTermType, 
NamedMemoryLimiter namedMemoryLimiter)
         {
-            super(indexTermType, limiter);
+            super(indexTermType,namedMemoryLimiter);
 
-            scratch = new byte[indexTermType.fixedSizeOf()];
-            trieBuffer = new 
BlockBalancedTreeRamBuffer(indexTermType.fixedSizeOf());
-            totalBytesAllocated = this.trieBuffer.memoryUsed();
+            segmentRamBuffer = new SegmentRamBuffer();
+            totalBytesAllocated = this.segmentRamBuffer.memoryUsed();
         }
 
         @Override
         public boolean isEmpty()
         {
-            return trieBuffer.numRows() == 0;
+            return segmentRamBuffer.numRows() == 0;
+        }
+    }
+
+    public static class BlockBalancedTreeSegmentBuilder extends 
RamBufferSegmentBuilder

Review Comment:
   The same way we have `LiteralSegmentBuilder` and `NumericIndexWriter`, 
perhaps this could be named `NumericSegmentBuilder`.



-- 
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]

Reply via email to