maedhroz commented on code in PR #3825:
URL: https://github.com/apache/cassandra/pull/3825#discussion_r1927910711
##########
src/java/org/apache/cassandra/index/sai/utils/PrimaryKey.java:
##########
@@ -395,25 +395,25 @@ public ByteSource
asComparableBytes(ByteComparable.Version version)
}
@Override
- public int compareTo(PrimaryKey o)
+ public int compareTo(PrimaryKey o, boolean strict)
{
int cmp = super.compareTo(o);
if (cmp != 0 || o.kind() == Kind.TOKEN || o.kind() ==
Kind.SKINNY)
return cmp;
- // At this point this key is in the same partition as the
other key so if the other key is a static
- // key then it must be equal to it. See comment in the
compareTo for static keys above.
+
if (o.kind() == Kind.STATIC)
- return 0;
+ // If we're comparing strictly, order this WIDE key after
the STATIC key, as this corresponds to the
+ // order of the corresponding row IDs in an on-disk
postings list. If we're not being strict, treat
+ // the keys as being equal, given they are in the same
partition.
+ return strict ? 1 : 0;
+
return clusteringComparator.compare(clustering(),
o.clustering());
}
@Override
- public int compareToStrict(PrimaryKey o)
+ public int compareTo(PrimaryKey o)
{
- int cmp = compareTo(o);
- // Always order this WIDE key before a STATIC key in the same
partition, as this corresponds to the
- // order of the corresponding row IDs in an on-disk postings
list.
- return o.kind() == Kind.STATIC && cmp == 0 ? 1 : cmp;
+ return compareTo(o, true);
Review Comment:
Using non-strict filtering here should fail
`testIntersectionWithStaticOverlap()`
--
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]