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


##########
src/java/org/apache/cassandra/index/sai/plan/QueryController.java:
##########
@@ -409,21 +414,29 @@ private KeyRangeIterator 
createRowIdIterator(Pair<Expression, Collection<SSTable
 
     // Note: This method assumes that the selects method has already been 
called for the
     // key to avoid having to (potentially) call selects twice
-    private ClusteringIndexFilter makeFilter(PrimaryKey key)
+    private ClusteringIndexFilter makeFilter(List<PrimaryKey> keys)
     {
-        ClusteringIndexFilter clusteringIndexFilter = 
command.clusteringIndexFilter(key.partitionKey());
+        PrimaryKey firstKey = keys.get(0);
 
-        assert cfs.metadata().comparator.size() == 0 && 
!key.kind().hasClustering ||
-               cfs.metadata().comparator.size() > 0 && 
key.kind().hasClustering :
-               "PrimaryKey " + key + " clustering does not match table. There 
should be a clustering of size " + cfs.metadata().comparator.size();
+        assert cfs.metadata().comparator.size() == 0 && 
!firstKey.kind().hasClustering ||
+               cfs.metadata().comparator.size() > 0 && 
firstKey.kind().hasClustering :
+               "PrimaryKey " + firstKey + " clustering does not match table. 
There should be a clustering of size " + cfs.metadata().comparator.size();
 
+        ClusteringIndexFilter clusteringIndexFilter = 
command.clusteringIndexFilter(firstKey.partitionKey());
+        
         // If we have skinny partitions or the key is for a static row then we 
need to get the partition as
         // requested by the original query.
-        if (cfs.metadata().comparator.size() == 0 || key.kind() == 
PrimaryKey.Kind.STATIC)
+        if (cfs.metadata().comparator.size() == 0 || firstKey.kind() == 
PrimaryKey.Kind.STATIC)
+        {
             return clusteringIndexFilter;
+        }
         else
-            return new 
ClusteringIndexNamesFilter(FBUtilities.singleton(key.clustering(), 
cfs.metadata().comparator),
-                                                  
clusteringIndexFilter.isReversed());
+        {
+            nextClusterings.clear();

Review Comment:
   I think I'm going to test with and without the allocation, but we create a 
new `QueryController` for every query. I only didn't use a thread-local here 
because I wouldn't know the comparator in a static context. Does that make 
sense?



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