maedhroz commented on code in PR #3433:
URL: https://github.com/apache/cassandra/pull/3433#discussion_r1688400931
##########
src/java/org/apache/cassandra/index/sai/plan/Expression.java:
##########
@@ -208,6 +211,27 @@ public Expression add(Operator op, ByteBuffer value)
else
lower = new Bound(value, indexTermType, lowerInclusive);
break;
+
+ case BETWEEN:
+ ListType<?> type =
ListType.getInstance(indexTermType.columnMetadata().type, false);
+ List<? extends ByteBuffer> buffers = type.unpack(value);
+
+ operator = IndexOperator.RANGE;
+ this.upperInclusive = true;
+ this.lowerInclusive = true;
+
+ if (indexTermType.isReversed())
+ {
+ upper = new Bound(buffers.get(0), indexTermType, true);
+ lower = new Bound(buffers.get(1), indexTermType, true);
+ }
+ else
+ {
+ lower = new Bound(buffers.get(0), indexTermType, true);
+ upper = new Bound(buffers.get(1), indexTermType, true);
+ }
Review Comment:
An alternate way to express this, if you think it reads better (not binding
by any means) is...
```
int lowerIndex = indexTermType.isReversed() ? 1 : 0;
int upperIndex = indexTermType.isReversed() ? 0 : 1;
lower = new Bound(buffers.get(lowerIndex), indexTermType, true);
upper = new Bound(buffers.get(upperIndex), indexTermType, true);
```
--
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]