maedhroz commented on code in PR #2935:
URL: https://github.com/apache/cassandra/pull/2935#discussion_r1449253776
##########
src/java/org/apache/cassandra/index/sai/plan/QueryController.java:
##########
@@ -171,33 +179,70 @@ public UnfilteredRowIterator queryStorage(PrimaryKey key,
ReadExecutionControlle
* the {@link SSTableIndex}s that will satisfy the expression.
* <p>
* Each (expression, SSTable indexes) pair is then passed to
- * {@link IndexSearchResultIterator#build(Expression, Collection,
AbstractBounds, QueryContext)}
+ * {@link IndexSearchResultIterator#build(Expression, Collection,
AbstractBounds, QueryContext, boolean)}
* to search the in-memory index associated with the expression and the
SSTable indexes, the results of
* which are unioned and returned.
* <p>
- * The results from each call to {@link
IndexSearchResultIterator#build(Expression, Collection, AbstractBounds,
QueryContext)}
- * are added to a {@link KeyRangeIntersectionIterator} and returned.
+ * The results from each call to {@link
IndexSearchResultIterator#build(Expression, Collection, AbstractBounds,
QueryContext, boolean)}
+ * are added to a {@link KeyRangeIntersectionIterator} and returned if
strict filtering is allowed.
+ * <p>
+ * If strict filtering is not allowed, indexes are split into two groups
according to the repaired status of their
+ * backing SSTables. Results from searches over the repaired group are
added to a
+ * {@link KeyRangeIntersectionIterator}, which is then added, along with
results from searches on the unrepaired
+ * set, to a top-level {@link KeyRangeUnionIterator}, and returned. This
is done to ensure that AND queries do not
+ * prematurely filter out matches on un-repaired partial updates.
Post-filtering must also take this into
+ * account. (see {@link FilterTree#isSatisfiedBy(DecoratedKey, Unfiltered,
Row)})
*/
public KeyRangeIterator.Builder
getIndexQueryResults(Collection<Expression> expressions)
{
// VSTODO move ANN out of expressions and into its own abstraction?
That will help get generic ORDER BY support
expressions = expressions.stream().filter(e -> e.getIndexOperator() !=
Expression.IndexOperator.ANN).collect(Collectors.toList());
- KeyRangeIterator.Builder builder =
KeyRangeIntersectionIterator.builder(expressions.size());
-
- QueryViewBuilder queryViewBuilder = new QueryViewBuilder(expressions,
mergeRange);
-
- QueryViewBuilder.QueryView queryView = queryViewBuilder.build();
+ KeyRangeIterator.Builder builder = command.rowFilter().isStrict()
+ ?
KeyRangeIntersectionIterator.builder(expressions.size())
+ :
KeyRangeUnionIterator.builder(expressions.size());
+ QueryViewBuilder.QueryView queryView = new
QueryViewBuilder(expressions, mergeRange).build();
try
{
maybeTriggerGuardrails(queryView);
- for (Pair<Expression, Collection<SSTableIndex>> queryViewPair :
queryView.view)
+ if (command.rowFilter().isStrict())
Review Comment:
Possibly. It might also be interesting to have some concept of column
groups, where we make it illegal to update columns in a group separately.
--
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]