blerer commented on code in PR #3095:
URL: https://github.com/apache/cassandra/pull/3095#discussion_r1567115581


##########
src/java/org/apache/cassandra/cql3/Operator.java:
##########
@@ -100,49 +238,108 @@ public boolean isSatisfiedBy(AbstractType<?> type, 
ByteBuffer leftOperand, ByteB
         {
             return type.compareForCQL(leftOperand, rightOperand) > 0;
         }
-    },
-    IN(7)
-    {
+
         @Override
-        public String toString()
+        public boolean requiresFilteringOrIndexingFor(ColumnMetadata.Kind 
columnKind)
         {
-            return "IN";
+            return columnKind != ColumnMetadata.Kind.CLUSTERING;
         }
 
+        @Override
+        public RangeSet<ClusteringElements> 
restrict(RangeSet<ClusteringElements> rangeSet, List<ClusteringElements> args)
+        {
+            assert args.size() == 1;
+            rangeSet.removeAll(ClusteringElements.atMost(args.get(0)));
+            return rangeSet;
+        }
+
+        @Override
+        public Operator negate()
+        {
+            return LTE;
+        }
+
+        @Override
+        public boolean isSlice()
+        {
+            return true;
+        }
+
+        @Override
+        public boolean canBeUsedWith(ColumnsExpression.Kind kind)
+        {
+            return kind != ColumnsExpression.Kind.MAP_ELEMENT;
+        }
+    },
+    IN(7)
+    {
         public boolean isSatisfiedBy(AbstractType<?> type, ByteBuffer 
leftOperand, ByteBuffer rightOperand)
         {
             ListSerializer<?> serializer = ListType.getInstance(type, 
false).getSerializer();
             return serializer.anyMatch(rightOperand, r -> 
type.compareForCQL(leftOperand, r) == 0);
         }
-    },
-    CONTAINS(5)
-    {
+
         @Override
-        public String toString()
+        public boolean requiresFilteringOrIndexingFor(ColumnMetadata.Kind 
columnKind)
         {
-            return "CONTAINS";
+            return !columnKind.isPrimaryKeyKind();
         }
 
+        @Override
+        public boolean canBeUsedWith(ColumnsExpression.Kind kind)
+        {
+            return kind == ColumnsExpression.Kind.SINGLE_COLUMN || kind == 
ColumnsExpression.Kind.MULTI_COLUMN;
+        }
+    },
+    CONTAINS(5)
+    {

Review Comment:
   By default an enum `toString` return the name of the enum which in this case 
match the output we want.
   



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