bereng commented on a change in pull request #1380:
URL: https://github.com/apache/cassandra/pull/1380#discussion_r785734417



##########
File path: src/java/org/apache/cassandra/cql3/conditions/ColumnCondition.java
##########
@@ -819,15 +841,26 @@ public ColumnCondition prepare(String keyspace, 
ColumnMetadata receiver, TableMe
 
         private Terms prepareTerms(String keyspace, ColumnSpecification 
receiver)
         {
+            checkFalse(operator.isContainsKey() && !(receiver.type instanceof 
MapType), "Cannot use CONTAINS KEY on non-map column %s", receiver.name);
+            checkFalse(operator.isContains() && 
!(receiver.type.isCollection()), "Cannot use CONTAINS on non-collection column 
%s", receiver.name);
+
             if (operator.isIN())
             {
                 return inValues == null ? 
Terms.ofListMarker(inMarker.prepare(keyspace, receiver), receiver.type)
                                         : Terms.of(prepareTerms(keyspace, 
receiver, inValues));
             }
 
+            if (operator.isContains() || operator.isContainsKey())
+                receiver = makeCollectionReceiver(receiver, 
operator.isContainsKey());
+            
             return Terms.of(value.prepare(keyspace, receiver));
         }
 
+        private static ColumnSpecification 
makeCollectionReceiver(ColumnSpecification receiver, boolean forKey)

Review comment:
       This could be just an inlined 1loc instead of a separate method?




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