maedhroz commented on code in PR #4290:
URL: https://github.com/apache/cassandra/pull/4290#discussion_r2334968282


##########
src/java/org/apache/cassandra/cql3/restrictions/SimpleRestriction.java:
##########
@@ -345,11 +352,14 @@ public void addToRowFilter(RowFilter filter, 
IndexRegistry indexRegistry, QueryO
                 else if (operator == Operator.LIKE)
                 {
                     LikePattern pattern = LikePattern.parse(buffers.get(0));
-                    // there must be a suitable INDEX for LIKE_XXX expressions
+                    
                     RowFilter.SimpleExpression expression = filter.add(column, 
pattern.kind().operator(), pattern.value());
-                    indexRegistry.getBestIndexFor(expression, indexHints)
-                                 .orElseThrow(() -> invalidRequest("%s is only 
supported on properly indexed columns",
-                                                                   
expression));
+                    Optional<Index> index = 
indexRegistry.getBestIndexFor(expression, indexHints);
+                    if(!index.isPresent() && !allowFiltering)
+                    {
+                        throw invalidRequest("%s is only supported on properly 
indexed columns or with ALLOW FILTERING",
+                                            expression);
+                    }

Review Comment:
   nit: I might just go single-line `if` here. It probably won't ever be 
multi-line...
   
   ```
   if (!index.isPresent() && !allowFiltering)
       throw invalidRequest("%s is only supported on properly indexed columns 
or with ALLOW FILTERING", expression);
   ```



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