[ASTERIXDB-2892][IDX] Fixing bug w/ range queries for array indexes.
- user mode changes: no
- storage format changes: no
- interface changes: no
Given some range queries where the range is on the lower end of the
index sort order and extremely selective, queries were still taking as
long as a full dataset scan.
Cause was discovered: the sidx-search was always assuming that the
upper-bound was not defined, and the primary-index validation would
remove an excessive amount of false positives.
Change-Id: I0c2c821e7005d821056324d5736bea904dd9ad7a
Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/11205
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Dmitry Lychagin <dmitry.lychagin@couchbase.com>
diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/AccessMethodUtils.java b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/AccessMethodUtils.java
index 09f9e41..c78e89f 100644
--- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/AccessMethodUtils.java
+++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/AccessMethodUtils.java
@@ -2992,11 +2992,6 @@
ArrayIndexUtil.getFlattenedKeyFieldNames(e.getUnnestList(), project);
List<Integer> arrayIndicator = ArrayIndexUtil.getArrayDepthIndicator(e.getUnnestList(), project);
- // Do not match a variable that we have previously matched.
- if (matchedFuncExprs.stream().anyMatch(f -> f.findFieldName(flattenedFieldName) != -1)) {
- continue;
- }
-
Triple<Integer, List<String>, IAType> fieldTriplet =
matchAssignFieldInUnnestAssignStack(assignOp.getVariables().get(assignVarIndex),
assignVarIndex, optFuncExpr, subTree, datasetMetaVar, context, arrayIndicator,