mike-tr-adamson commented on code in PR #2645:
URL: https://github.com/apache/cassandra/pull/2645#discussion_r1312834117


##########
src/java/org/apache/cassandra/index/sai/utils/PrimaryKey.java:
##########
@@ -145,172 +208,226 @@ public boolean equals(Object obj)
             }
 
             @Override
-            @SuppressWarnings("ConstantConditions")
             public String toString()
             {
-                return isTokenOnly() ? String.format("PrimaryKey: { token: %s 
}", token())
-                                     : String.format("PrimaryKey: { token: %s, 
partition: %s, clustering: %s:%s } ",
-                                                     token(),
-                                                     partitionKey(),
-                                                     clustering() == null ? 
null : clustering().kind(),
-                                                     clustering() == null ? 
null : Arrays.stream(clustering().getBufferArray())
-                                                                               
          .map(ByteBufferUtil::bytesToHex)
-                                                                               
          .collect(Collectors.joining(", ")));
+                return String.format("PrimaryKey: { token: %s }", token());
             }
         }
 
-        class TokenOnlyPrimaryKey extends AbstractPrimaryKey
+        class SkinnyPrimaryKey extends TokenOnlyPrimaryKey
         {
-            private final Token token;
+            protected final DecoratedKey partitionKey;
 
-            TokenOnlyPrimaryKey(Token token)
+            SkinnyPrimaryKey(DecoratedKey partitionKey)
             {
-                this.token = token;
+                super(partitionKey.getToken());
+                this.partitionKey = partitionKey;
             }
 
             @Override
-            public boolean isTokenOnly()
+            public Kind kind()
             {
-                return true;
+                return Kind.Skinny;
             }
 
             @Override
-            public Token token()
+            public DecoratedKey partitionKey()
             {
-                return token;
+                return partitionKey;
             }
 
             @Override
-            public DecoratedKey partitionKey()
+            public ByteSource asComparableBytes(Version version)
             {
-                throw new UnsupportedOperationException();
+                return ByteSource.of(partitionKey().getKey(), version);
             }
 
             @Override
-            public Clustering<?> clustering()
+            public int compareTo(PrimaryKey o)
             {
-                throw new UnsupportedOperationException();
+                int cmp = super.compareTo(o);
+
+                // If the tokens don't match then we don't need to compare any 
more of the key.
+                // Otherwise, if the other key is token only we can only 
compare tokens

Review Comment:
   I've been more specific because it is only used by the `ResultRetriever` to 
skip to key range start positions.



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