blerer commented on a change in pull request #1159:
URL: https://github.com/apache/cassandra/pull/1159#discussion_r702888348



##########
File path: 
src/java/org/apache/cassandra/cql3/restrictions/MultiColumnRestriction.java
##########
@@ -247,7 +249,22 @@ public final void addRowFilterTo(RowFilter filter,
                                          IndexRegistry indexRegistry,
                                          QueryOptions options)
         {
-            throw  invalidRequest("IN restrictions are not supported on 
indexed columns");
+            // If the relation is of the type (c) IN ((x),(y),(z)) then it is 
equivalent to
+            // c IN (x, y, z) and we can perform filtering
+            if (getColumnDefs().size() == 1)
+            {
+                List<List<ByteBuffer>> splitValues = splitValues(options);
+                List<ByteBuffer> values = new ArrayList<>(splitValues.size());
+                for (List<ByteBuffer> splitValue : splitValues)
+                    values.add(splitValue.get(0));
+
+                ByteBuffer buffer = ListSerializer.pack(values, values.size(), 
ProtocolVersion.V3);
+                filter.add(getFirstColumn(), Operator.IN, buffer);
+            }
+            else
+            {
+                throw invalidRequest("IN restrictions are not supported on 
indexed columns");

Review comment:
       I added a test to trigger the Exception.
   Good catch for the SASI index. I added a test to reproduce the problem and 
modified `ColumnIndex#supports(Operator)` to ignore the operator.




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