maedhroz commented on code in PR #2916:
URL: https://github.com/apache/cassandra/pull/2916#discussion_r1402665399
##########
src/java/org/apache/cassandra/index/sai/plan/QueryController.java:
##########
@@ -133,22 +133,16 @@ public List<DataRange> dataRanges()
return ranges;
}
- /**
- * @return indexed {@code IndexContext} if index is found; otherwise
return non-indexed {@code IndexContext}.
- */
- public IndexContext getContext(RowFilter.Expression expression)
+ public StorageAttachedIndex indexFor(RowFilter.Expression expression)
{
Set<StorageAttachedIndex> indexes =
cfs.indexManager.getBestIndexFor(expression, StorageAttachedIndex.class);
+ return indexes.isEmpty() ? null : indexes.iterator().next();
+ }
- return indexes.isEmpty() ? new IndexContext(cfs.getKeyspaceName(),
- cfs.getTableName(),
-
cfs.metadata().partitionKeyType,
- cfs.getPartitioner(),
- cfs.getComparator(),
- expression.column(),
- IndexTarget.Type.VALUES,
- null)
- : indexes.iterator().next().getIndexContext();
+ public AbstractAnalyzer analyzerFor(RowFilter.Expression expression)
+ {
+ StorageAttachedIndex index = indexFor(expression);
+ return index == null ? new NoOpAnalyzer() : index.analyzer();
Review Comment:
I know the `NoOpAnalyzer` makes some other parts of the code simpler
perhaps, but the object creations are still kind of bothersome when we don't
transform the value.
--
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]