maedhroz commented on code in PR #1723:
URL: https://github.com/apache/cassandra/pull/1723#discussion_r984074313


##########
src/java/org/apache/cassandra/db/AbstractBufferClusteringPrefix.java:
##########
@@ -42,10 +42,18 @@ public ByteBuffer[] getBufferArray()
         return getRawValues();
     }
 
-    public ClusteringPrefix<ByteBuffer> minimize()
+    public ClusteringPrefix<ByteBuffer> retainable()
     {
         if (!ByteBufferUtil.canMinimize(values))
             return this;
-        return new BufferClustering(ByteBufferUtil.minimizeBuffers(values));
+
+        ByteBuffer[] minimizedValues = 
ByteBufferUtil.minimizeBuffers(this.values);
+        if (kind.isBoundary())
+            return accessor().factory().boundary(kind, minimizedValues);
+        if (kind.isBound())
+            return accessor().factory().bound(kind, minimizedValues);
+
+        assert kind() != Kind.STATIC_CLUSTERING;    // not minimizable
+        return accessor().factory().clustering(minimizedValues);

Review Comment:
   This is equivalent to `return new BufferClustering(values);` right? 
Wondering what the indirection buys us...



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