dcapwell commented on code in PR #3825:
URL: https://github.com/apache/cassandra/pull/3825#discussion_r1929178539


##########
src/java/org/apache/cassandra/index/sai/iterators/KeyRangeIterator.java:
##########
@@ -229,14 +229,21 @@ protected static PrimaryKey nullSafeMin(PrimaryKey a, 
PrimaryKey b)
         if (a == null) return b;
         if (b == null) return a;
 
-        return a.compareToStrict(b) > 0 ? b : a;
+        return a.compareTo(b) > 0 ? b : a;

Review Comment:
   why is this one not `b, true`?  That is the default but not following the 
pattern of this patch/file?



##########
src/java/org/apache/cassandra/index/sai/iterators/KeyRangeIterator.java:
##########
@@ -229,14 +229,21 @@ protected static PrimaryKey nullSafeMin(PrimaryKey a, 
PrimaryKey b)
         if (a == null) return b;
         if (b == null) return a;
 
-        return a.compareToStrict(b) > 0 ? b : a;
+        return a.compareTo(b) > 0 ? b : a;
     }
 
     protected static PrimaryKey nullSafeMax(PrimaryKey a, PrimaryKey b)
     {
         if (a == null) return b;
         if (b == null) return a;
 
-        return a.compareToStrict(b) > 0 ? a : b;
+        // The STATIC key sorts before WIDE keys in its partition, but to 
avoid missing rows while 
+        // intersecting, the STATIC key must override any WIDE key.
+        if (a.kind() == PrimaryKey.Kind.STATIC && b.kind() == 
PrimaryKey.Kind.WIDE)

Review Comment:
   are there any other cases to worry about here?  this feels very specific...
   
   ```
   enum Kind
       {
           TOKEN(false),
           SKINNY(false),
           WIDE(true),
           STATIC(true);
   ```
   
   i don't see these documented really so i have to rely on the boolean... but 
`org.apache.cassandra.index.sai.utils.PrimaryKey.Factory.TokenOnlyPrimaryKey#TokenOnlyPrimaryKey`
 doesn't mean the partition doesn't have a clustering in the schema... doesn't 
this just mean we have a token?  Looking at the usage i see range expressions 
using this... 



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