maedhroz commented on code in PR #3702:
URL: https://github.com/apache/cassandra/pull/3702#discussion_r1851270113
##########
src/java/org/apache/cassandra/index/sai/utils/IndexTermType.java:
##########
@@ -491,7 +497,9 @@ public int comparePostFilter(Expression.Value
requestedValue, Expression.Value c
{
if (isInetAddress())
return compareInet(requestedValue.encoded, columnValue.encoded);
- // Override comparisons for frozen collections and composite types
(map entries)
+ else if (isLong() || isBigDecimal() || isBigInteger())
+ return indexType.unwrap().compare(requestedValue.raw,
columnValue.raw);
+ // Override comparisons for frozen collections and composite types
(map entries)
else if (isComposite() || isFrozen())
return FastByteOperations.compareUnsigned(requestedValue.raw,
columnValue.raw);
Review Comment:
The question I would have as a reviewer here is why, since we're just
post-filtering, we don't unwrap on the next line, when we've fallen through the
other cases. The bounds from `Expression` are used to generate queries for the
memtable index, the on-disk indexes, and _also_ to do post-filtering. Because
of the first two, and the fact that we currently index reversed byte-comparable
for most reversed types, we reverse the bounds on `Expression` as well. In
those cases, post-filtering uses the reversed `compare()` to "undo" that.
Ultimately, we should fix this, especially if we want to change the on-disk
format and memtable-adjacent index to always use the base type byte-comparable,
but it would be more invasive (i.e. require making changes to query generation
for both of those if we don't change the disk format).
I think _for now_ what I'd like to do is simply comment this next line to
explain ^
--
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]