adelapena commented on code in PR #2556:
URL: https://github.com/apache/cassandra/pull/2556#discussion_r1383271862


##########
src/java/org/apache/cassandra/cql3/restrictions/SingleColumnRestriction.java:
##########
@@ -403,49 +381,80 @@ public void addToRowFilter(RowFilter filter, 
IndexRegistry indexRegistry, QueryO
             for (Bound b : Bound.values())
                 if (hasBound(b))
                     filter.add(columnDef, slice.getIndexOperator(b), 
slice.bound(b).bindAndGet(options));
+
+            for (MarkerOrTerms markerOrTerms : skippedValues)
+            {
+                for (ByteBuffer value : markerOrTerms.bindAndGet(options, 
columnDef.name))
+                   filter.add(columnDef, Operator.NEQ, value);
+            }
         }
 
         @Override
         protected boolean isSupportedBy(Index index)
         {
-            return slice.isSupportedBy(columnDef, index);
+            boolean supportsSlice = slice.isSupportedBy(columnDef, index);
+            boolean supportsNeq = index.supportsExpression(columnDef, 
Operator.NEQ);
+            return  supportsSlice || !skippedValues.isEmpty() && supportsNeq;

Review Comment:
   The implementations of 
`SingleColumnRestriction.SliceRestriction#isSupportedBy` and 
`MultiColumnRestriction.SliceRestriction#isSupportedBy` are identical. Also, 
both implementations are the only callers of 
`TermSlice#isSupportedBy(ColumnMetadata, Index)`. 
   
   Maybe we could pass the list of skipped values to `TermSlice#isSupportedBy` 
and delegate the NEQ check to it, putting similar things together and 
preventing some duplication:
   ```java
   public boolean isSupportedBy(ColumnMetadata column, Index index, 
List<MarkerOrTerms> skippedValues)
   {
       boolean supported = false;
   
       if (hasBound(Bound.START))
           supported |= isInclusive(Bound.START) ? 
index.supportsExpression(column, Operator.GTE)
                   : index.supportsExpression(column, Operator.GT);
       if (hasBound(Bound.END))
           supported |= isInclusive(Bound.END) ? 
index.supportsExpression(column, Operator.LTE)
                   : index.supportsExpression(column, Operator.LT);
   
       supported |= !skippedValues.isEmpty() && 
index.supportsExpression(column, Operator.NEQ);
   
       return supported;
   }
   ```



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