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


##########
src/java/org/apache/cassandra/index/sai/plan/StorageAttachedIndexSearcher.java:
##########
@@ -222,45 +236,57 @@ public UnfilteredRowIterator computeNext()
         /**
          * Returns the next available key contained by one of the keyRanges 
and selected by the queryController.
          * If the next key falls out of the current key range, it skips to the 
next key range, and so on.
-         * If no more keys acceptd by the controller are available, returns 
null.
+         * If no more keys acceptd by the controller are available, returns an 
empty list.
          */
-        private @Nullable PrimaryKey nextSelectedKeyInRange()
+        private List<PrimaryKey> nextSelectedKeyInRange()
         {
+            List<PrimaryKey> threadLocalNextKeys = nextKeys.get();
+            threadLocalNextKeys.clear();
             PrimaryKey key;
+
             do
             {
                 key = nextKeyInRange();
+
+                if (key == null)
+                    return Collections.emptyList();
             }
-            while (key != null && queryController.doesNotSelect(key));
-            return key;
+            while (queryController.doesNotSelect(key) || key.equals(lastKey));

Review Comment:
   when entering the loop for the 1st time, `lastKey` is null. It will exist 
the loop. `threadLocalNextKeys` will only have one element. Is it expected?



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