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


##########
src/java/org/apache/cassandra/index/sai/plan/QueryViewBuilder.java:
##########
@@ -105,82 +99,18 @@ private Collection<Pair<Expression, 
Collection<SSTableIndex>>> getQueryView(Coll
             if (expression.isNotIndexed())
                 continue;
 
-            // If we didn't get a most selective expression then none of the
-            // expressions select anything so, add an empty entry for the
-            // expression. We need the empty entry because we may have 
in-memory
-            // data for the expression
-            if (mostSelective == null)
-            {
-                queryView.add(Pair.create(expression, 
Collections.emptyList()));
-                continue;
-            }
-
-            // If this expression is the most selective then just add it to the
-            // query view
-            if (expression.equals(mostSelective.left))
-            {
-                queryView.add(mostSelective);
-                continue;
-            }
-
-            // Finally, we select all the sstable indexes for this expression 
that
-            // have overlapping keys with the sstable indexes of the most 
selective
-            // and have a term range that is satisfied by the expression.
+            // Select all the sstable indexes that have a term range that is 
satisfied by this expression and 
+            // overlap with the key range being queried.
             View view = expression.getIndex().view();
-            Set<SSTableIndex> indexes = new TreeSet<>(SSTableIndex.COMPARATOR);
-            indexes.addAll(view.match(expression)
-                               .stream()
-                               .filter(index -> sstableIndexOverlaps(index, 
mostSelective.right))
-                               .collect(Collectors.toList()));
-            queryView.add(Pair.create(expression, indexes));
+            queryView.add(Pair.create(expression, 
selectIndexesInRange(view.match(expression))));
         }
 
         return queryView;
     }
 
-    private boolean sstableIndexOverlaps(SSTableIndex sstableIndex, 
Collection<SSTableIndex> sstableIndexes)
-    {
-        return sstableIndexes.stream().anyMatch(index -> 
index.bounds().contains(sstableIndex.bounds().left) ||
-                                                         
index.bounds().contains(sstableIndex.bounds().right));
-    }
-
-    // The purpose of this method is to calculate the most selective 
expression. This is the
-    // expression with the most sstable indexes that match the expression by 
term and lie
-    // within the key range being queried.
-    //
-    // The result can be null. This indicates that none of the expressions 
select any
-    // sstable indexes.
-    private Pair<Expression, Collection<SSTableIndex>> 
calculateMostSelective(Collection<Expression> expressions)

Review Comment:
   Removal mentioned here: 
https://issues.apache.org/jira/browse/CASSANDRA-19018?focusedCommentId=17799154&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-17799154



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