From 087b14fa25fa05cbb78fed59b45ef9f12ea0fdfe Mon Sep 17 00:00:00 2001 From: Jonathan Ellis Date: Mon, 2 Dec 2024 10:38:32 -0600 Subject: [PATCH] add back isMultiExpression --- .../cassandra/index/sai/plan/Operation.java | 27 ++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/src/java/org/apache/cassandra/index/sai/plan/Operation.java b/src/java/org/apache/cassandra/index/sai/plan/Operation.java index 111c014946c8..71cd781def91 100644 --- a/src/java/org/apache/cassandra/index/sai/plan/Operation.java +++ b/src/java/org/apache/cassandra/index/sai/plan/Operation.java @@ -99,7 +99,32 @@ protected static ListMultimap analyzeGroup(QueryCont // if there is no EQ operations and NOT_EQ is met or a single NOT_EQ expression present, // in such case we know exactly that there would be no more EQ/RANGE expressions for given column // since NOT_EQ has the lowest priority. - boolean isMultiExpression = false; + boolean isMultiExpression = columnIsMultiExpression.getOrDefault(e.column(), Boolean.FALSE); + switch (e.operator()) + { + // case BM25: leave it at the default of `false` + case EQ: + // EQ operator will always be a multiple expression because it is being used by map entries + isMultiExpression = indexContext.isNonFrozenCollection(); + + // EQ wil behave like ANALYZER_MATCHES for analyzed columns if the analyzer supports EQ queries + isMultiExpression |= indexContext.isAnalyzed() && analyzerFactory.supportsEquals(); + break; + case CONTAINS: + case CONTAINS_KEY: + case NOT_CONTAINS: + case NOT_CONTAINS_KEY: + case LIKE_PREFIX: + case LIKE_MATCHES: + case ANALYZER_MATCHES: + isMultiExpression = true; + break; + case NEQ: + // NEQ operator will always be a multiple expression if it is the only operator + // (e.g. multiple NEQ expressions) + isMultiExpression = isMultiExpression || perColumn.isEmpty(); + break; + } columnIsMultiExpression.put(e.column(), isMultiExpression); if (isMultiExpression)