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


##########
src/java/org/apache/cassandra/index/sai/disk/IndexSearchResultIterator.java:
##########
@@ -51,22 +53,39 @@ private IndexSearchResultIterator(KeyRangeIterator union, 
Runnable onClose)
 
     /**
      * Builds a new {@link IndexSearchResultIterator} that wraps a {@link 
KeyRangeUnionIterator} over the
-     * results of searching the {@link 
org.apache.cassandra.index.sai.memory.MemtableIndex} and the {@link 
SSTableIndex}es.
+     * results of searching the {@link QueryViewBuilder.QueryExpressionView}.
+     */
+    public static IndexSearchResultIterator 
build(QueryViewBuilder.QueryExpressionView queryView,
+                                                  
AbstractBounds<PartitionPosition> keyRange,
+                                                  QueryContext queryContext,
+                                                  boolean includeMemtables,
+                                                  Runnable onClose)
+    {
+        return build(queryView.expression, queryView.memtableIndexes, 
queryView.sstableIndexes, keyRange, queryContext, includeMemtables, onClose);
+    }
+
+    /**
+     * Builds a new {@link IndexSearchResultIterator} that wraps a {@link 
KeyRangeUnionIterator} over the
+     * results of searching the {@link 
org.apache.cassandra.index.sai.memory.MemtableIndex}es and the {@link 
SSTableIndex}es.
      */
     public static IndexSearchResultIterator build(Expression expression,
+                                                  Collection<MemtableIndex> 
memtableIndexes,
                                                   Collection<SSTableIndex> 
sstableIndexes,
                                                   
AbstractBounds<PartitionPosition> keyRange,
                                                   QueryContext queryContext,
                                                   boolean includeMemtables,
                                                   Runnable onClose)
     {
-        List<KeyRangeIterator> subIterators = new 
ArrayList<>(sstableIndexes.size() + (includeMemtables ? 1 : 0));
+        int size = sstableIndexes.size() + (includeMemtables ? 
memtableIndexes.size() : 0);
+        List<KeyRangeIterator> subIterators = new ArrayList<>(size);
 
         if (includeMemtables)
         {
-            KeyRangeIterator memtableIterator = 
expression.getIndex().memtableIndexManager().searchMemtableIndexes(queryContext,
 expression, keyRange);

Review Comment:
   We previously created another union inside `searchMemtableIndexes()`, but I 
guess this is no longer necessary, since we're just adding to the union here 
that we create from the `subIterators` anyway. Looks good.



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