maedhroz commented on code in PR #3649:
URL: https://github.com/apache/cassandra/pull/3649#discussion_r1833127194
##########
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:
So we don't _need_ `threadLocalNextKeys`, but I wanted to keep the return
type of both suppliers (`nextSelectedKeyInRange()` and
`nextSelectedKeysInPartition()`) the same to simplify `nextRowIterator()`, and
using the thread-local avoids having to create a singleton collection for the
one key.
--
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]