Fixed ASTERIXDB-1249 and ASTERIXDB-1250: self index-nested-loop join correctly identifies the outer and the inner branch.
The first dataset becomes the outer branch.
The second dataset becomes the inner branch.
The optimizer for index-nested-loop join now only try to use an index from the inner branch.
Change-Id: I0d4291197c2bcfbcdcde998c5952af41960c4ad7
Reviewed-on: https://asterix-gerrit.ics.uci.edu/576
Reviewed-by: Yingyi Bu <buyingyi@gmail.com>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
diff --git a/asterix-app/src/test/resources/optimizerts/queries/btree-index-join/primary-equi-join-multipred.aql b/asterix-app/src/test/resources/optimizerts/queries/btree-index-join/primary-equi-join-multipred.aql
index 9e8a987..8a78d40 100644
--- a/asterix-app/src/test/resources/optimizerts/queries/btree-index-join/primary-equi-join-multipred.aql
+++ b/asterix-app/src/test/resources/optimizerts/queries/btree-index-join/primary-equi-join-multipred.aql
@@ -20,7 +20,7 @@
* Description : Equi joins two datasets, Customers and Orders, based on the customer id.
* Given the 'indexnl' hint we expect the join to be transformed
* into an indexed nested-loop join using Customers' primary index.
- * We expect the additional predicates to be put into a select above the
+ * We expect the additional predicates to be put into a select above the
* primary index search.
* Success : Yes
*/
@@ -30,13 +30,13 @@
use dataverse test;
create type AddressType as closed {
- number: int32,
+ number: int32,
street: string,
city: string
}
create type CustomerType as closed {
- cid: int32,
+ cid: int32,
name: string,
age: int32?,
address: AddressType?,
@@ -60,7 +60,7 @@
write output to asterix_nc1:"rttest/btree-index-join_primary-equi-join-multipred.adm";
-for $c in dataset('Customers')
for $o in dataset('Orders')
+for $c in dataset('Customers')
where $c.cid /*+ indexnl */ = $o.cid and $c.name < $o.orderstatus and $c.age < $o.cid
-return {"customer":$c, "order": $o}
+return {"customer":$c, "order": $o}