>From Ritik Raj <[email protected]>:
Attention is currently required from: Ritik Raj.
Hello Anon. E. Moose #1000171,
I'd like you to reexamine a change. Please visit
https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/20992?usp=email
to look at the new patch set (#4).
Change subject: [ASTERIXDB-3708][COMP] Fix range-filter pushdown with secondary
index intersection
......................................................................
[ASTERIXDB-3708][COMP] Fix range-filter pushdown with secondary index
intersection
- user model changes: no
- storage format changes: no
- interface changes: no
Details:
When querying a columnar dataset with multiple secondary indexes (causing
an INTERSECT-based intersection plan), range-filter pushdown was silently
skipped, e.g.:
SELECT count(*) FROM A WHERE b = 0 AND a = 1 AND c = 4
with indexes on (a), (b), (c) produced an INTERSECT plan where the
range-filter was not pushed into the primary scan.
Root cause: The ASTERIXDB-3708 fix (46d36883bf) introduced a registration
ordering constraint: registerDatasetIfApplicable must run before visitInputs
so that a pushed-down selectCondition can link its field accesses to the
scan's record variable in the def-use chain. However, this caused a scope
mismatch: the scan was registered before the INTERSECT (a scope-bumping
operator) in its input subtree was visited, so the scan's scope was lower
than the SELECT operator above it, causing canPushSelect to reject the
pushdown.
The two constraints conflict:
- Def-use correctness: register BEFORE processing the scan's own expressions
- Scope correctness: register AFTER visiting the input subtree (so all
scope-bumping operators have already advanced the counter)
Fix: Split visitInputs into visitChildren + processOperator, exposing
the boundary between the two phases. The three scan visitors
(DataSourceScan, UnnestMap, LeftOuterUnnestMap) now explicitly do:
visitChildren → registerDatasetIfApplicable → processOperator
This satisfies both constraints: the scope counter is fully advanced
before registration, and registration precedes expression processing.
Ext-ref: MB-70725
Change-Id: I7a06aa40f43358a6ef3e5773c8d02c5928eb8007
---
M
asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/pushdown/visitor/PushdownOperatorVisitor.java
A
asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/column/secondary-index/range-filter-intersect/range-filter-intersect.001.ddl.sqlpp
A
asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/column/secondary-index/range-filter-intersect/range-filter-intersect.002.update.sqlpp
A
asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/column/secondary-index/range-filter-intersect/range-filter-intersect.003.query.sqlpp
A
asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/column/secondary-index/range-filter-intersect/range-filter-intersect.004.query.sqlpp
A
asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/column/secondary-index/range-filter-intersect/range-filter-intersect.005.ddl.sqlpp
A
asterixdb/asterix-app/src/test/resources/runtimets/results/column/secondary-index/range-filter-intersect/range-filter-intersect.003.plan
A
asterixdb/asterix-app/src/test/resources/runtimets/results/column/secondary-index/range-filter-intersect/range-filter-intersect.004.adm
M
asterixdb/asterix-app/src/test/resources/runtimets/results_column/index-selection/btree-index-range-02/btree-index-range-02.16.plan
M
asterixdb/asterix-app/src/test/resources/runtimets/results_column/index-selection/btree-index-range-02/btree-index-range-02.18.plan
M
asterixdb/asterix-app/src/test/resources/runtimets/testsuite_single_partition_sqlpp.xml
11 files changed, 274 insertions(+), 5 deletions(-)
git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb
refs/changes/92/20992/4
--
To view, visit https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/20992?usp=email
To unsubscribe, or for help writing mail filters, visit
https://asterix-gerrit.ics.uci.edu/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: asterixdb
Gerrit-Branch: phoenix
Gerrit-Change-Id: I7a06aa40f43358a6ef3e5773c8d02c5928eb8007
Gerrit-Change-Number: 20992
Gerrit-PatchSet: 4
Gerrit-Owner: Ritik Raj <[email protected]>
Gerrit-Reviewer: Anon. E. Moose #1000171
Gerrit-CC: Jenkins <[email protected]>
Gerrit-Attention: Ritik Raj <[email protected]>