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


##########
src/java/org/apache/cassandra/cql3/Operator.java:
##########
@@ -359,20 +723,43 @@ public boolean isIN()
     }
 
     /**
-     * Checks if this operator is CONTAINS operator.
-     * @return {@code true} if this operator is a CONTAINS operator, {@code 
false} otherwise.
+     * Reverse this operator.
+     * @return the reverse operator from this operator.
+     */
+    public Operator negate()
+    {
+        throw new UnsupportedOperationException(this + " does not support 
negation");
+    }
+
+    /**
+     * Some operators are not supported by the read path because we never 
fully implemented support for them.
+     * It is the case for {@code IS_NOT} and {@code !=}
+     * @return {@code true} for the operators supported by the read path, 
{@code false} otherwise.
+     */
+    protected boolean isSupportedByReadPath()
+    {
+        return true;
+    }
+
+    /**
+     * The "LIKE_" operators are not real CQL operators and are simply a hack 
that should be removed at some point.
+     * Therefore, we want to ignore them for some operations.
+     * @return {@code true} for the "LIKE_" operators
      */
-    public boolean isContains()
+    private boolean isLikeXxx()
     {
-        return this == CONTAINS;
+        return name().startsWith("LIKE_");
     }
 
     /**
-     * Checks if this operator is CONTAINS KEY operator.
-     * @return {@code true} if this operator is a CONTAINS operator, {@code 
false} otherwise.
+     * Returns the operators that require an index or filtering for the 
specified column kind
+     * @param columnKind the column kind
+     * @return the operators that require an index or filtering for the 
specified column kind
      */
-    public boolean isContainsKey()
+    public static List<Operator> 
operatorsRequiringFilteringOrIndexingFor(ColumnMetadata.Kind columnKind)
     {
-        return this == CONTAINS_KEY;
+        return Arrays.stream(values())
+                     .filter(o -> o.isSupportedByReadPath() && !o.isLikeXxx() 
&& o.requiresFilteringOrIndexingFor(columnKind))

Review Comment:
   I thought `CONTAINS` **and** `LIKE` always required indexing or filtering. 
Why `LIKE` was filtered out?
   If it is a special case method, then maybe change the name as it is 
confusing now. 



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