asterixdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wangs...@apache.org
Subject [5/6] incubator-asterixdb git commit: Fixed ASTERIXDB-1249 and ASTERIXDB-1250: self index-nested-loop join correctly identifies the outer and the inner branch.
Date Sat, 06 Feb 2016 01:25:22 GMT
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/d185e8ea/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/olist-jaccard-check_01.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/olist-jaccard-check_01.aql b/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/olist-jaccard-check_01.aql
index 0459a4b..14e3dc5 100644
--- a/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/olist-jaccard-check_01.aql
+++ b/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/olist-jaccard-check_01.aql
@@ -27,13 +27,13 @@ create dataverse test;
 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?,
@@ -42,14 +42,14 @@ create type CustomerType as closed {
 }
 
 create dataset Customers(CustomerType) primary key cid;
-  
+
 create dataset Customers2(CustomerType) primary key cid;
 
 create index interests_index on Customers(interests) type keyword;
 
 write output to asterix_nc1:"rttest/inverted-index-join_olist-jaccard-check_01.adm";
 
-for $a in dataset('Customers')
 for $b in dataset('Customers2')
+for $a in dataset('Customers')
 where /*+ indexnl */ similarity-jaccard-check($a.interests, $b.interests, 0.7f)[0] and $a.cid < $b.cid
 return {"arec": $a, "brec": $b }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/d185e8ea/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/olist-jaccard_01.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/olist-jaccard_01.aql b/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/olist-jaccard_01.aql
index c76880d..4c865f6 100644
--- a/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/olist-jaccard_01.aql
+++ b/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/olist-jaccard_01.aql
@@ -27,13 +27,13 @@ create dataverse test;
 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?,
@@ -42,14 +42,14 @@ create type CustomerType as closed {
 }
 
 create dataset Customers(CustomerType) primary key cid;
-  
+
 create dataset Customers2(CustomerType) primary key cid;
 
 create index interests_index on Customers(interests) type keyword;
 
 write output to asterix_nc1:"rttest/inverted-index-join_olist-jaccard_01.adm";
 
-for $a in dataset('Customers')
 for $b in dataset('Customers2')
+for $a in dataset('Customers')
 where /*+ indexnl */ similarity-jaccard($a.interests, $b.interests) >= 0.7f and $a.cid < $b.cid
 return {"arec": $a, "brec": $b }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/d185e8ea/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/ulist-fuzzyeq-jaccard_01.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/ulist-fuzzyeq-jaccard_01.aql b/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/ulist-fuzzyeq-jaccard_01.aql
index aacd110..edd1e94 100644
--- a/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/ulist-fuzzyeq-jaccard_01.aql
+++ b/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/ulist-fuzzyeq-jaccard_01.aql
@@ -27,13 +27,13 @@ create dataverse test;
 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?,
@@ -42,7 +42,7 @@ create type CustomerType as closed {
 }
 
 create dataset Customers(CustomerType) primary key cid;
-  
+
 create dataset Customers2(CustomerType) primary key cid;
 
 create index interests_index on Customers(interests) type keyword;
@@ -52,7 +52,7 @@ write output to asterix_nc1:"rttest/inverted-index-join_ulist-fuzzyeq-jaccard_01
 set simfunction 'jaccard';
 set simthreshold '0.7f';
 
-for $a in dataset('Customers')
 for $b in dataset('Customers2')
+for $a in dataset('Customers')
 where $a.interests /*+ indexnl */ ~= $b.interests and $a.cid < $b.cid
 return {"arec": $a, "brec": $b }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/d185e8ea/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/ulist-jaccard-check_01.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/ulist-jaccard-check_01.aql b/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/ulist-jaccard-check_01.aql
index 9560995..53ff785 100644
--- a/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/ulist-jaccard-check_01.aql
+++ b/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/ulist-jaccard-check_01.aql
@@ -27,13 +27,13 @@ create dataverse test;
 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?,
@@ -42,14 +42,14 @@ create type CustomerType as closed {
 }
 
 create dataset Customers(CustomerType) primary key cid;
-  
+
 create dataset Customers2(CustomerType) primary key cid;
 
 create index interests_index on Customers(interests) type keyword;
 
 write output to asterix_nc1:"rttest/inverted-index-join_ulist-jaccard-check_01.adm";
 
-for $a in dataset('Customers')
 for $b in dataset('Customers2')
+for $a in dataset('Customers')
 where /*+ indexnl */ similarity-jaccard-check($a.interests, $b.interests, 0.7f)[0] and $a.cid < $b.cid
 return {"arec": $a, "brec": $b }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/d185e8ea/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/ulist-jaccard_01.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/ulist-jaccard_01.aql b/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/ulist-jaccard_01.aql
index 887ac20..e23334f 100644
--- a/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/ulist-jaccard_01.aql
+++ b/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/ulist-jaccard_01.aql
@@ -27,13 +27,13 @@ create dataverse test;
 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?,
@@ -42,14 +42,14 @@ create type CustomerType as closed {
 }
 
 create dataset Customers(CustomerType) primary key cid;
-  
+
 create dataset Customers2(CustomerType) primary key cid;
 
 create index interests_index on Customers(interests) type keyword;
 
 write output to asterix_nc1:"rttest/inverted-index-join_ulist-jaccard_01.adm";
 
-for $a in dataset('Customers')
 for $b in dataset('Customers2')
+for $a in dataset('Customers')
 where /*+ indexnl */ similarity-jaccard($a.interests, $b.interests) >= 0.7f and $a.cid < $b.cid
 return {"arec": $a, "brec": $b }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/d185e8ea/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/word-fuzzyeq-jaccard_01.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/word-fuzzyeq-jaccard_01.aql b/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/word-fuzzyeq-jaccard_01.aql
index d9a5afa..29bd3d0 100644
--- a/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/word-fuzzyeq-jaccard_01.aql
+++ b/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/word-fuzzyeq-jaccard_01.aql
@@ -27,7 +27,7 @@ create dataverse test;
 use dataverse test;
 
 create type DBLPType as closed {
-  id: int32, 
+  id: int32,
   dblpid: string,
   title: string,
   authors: string,
@@ -35,7 +35,7 @@ create type DBLPType as closed {
 }
 
 create type CSXType as closed {
-  id: int32, 
+  id: int32,
   csxid: string,
   title: string,
   authors: string,
@@ -53,7 +53,7 @@ write output to asterix_nc1:"rttest/inverted-index-join_word-fuzzyeq-jaccard_01.
 set simfunction 'jaccard';
 set simthreshold '0.5f';
 
-for $a in dataset('DBLP')
 for $b in dataset('CSX')
+for $a in dataset('DBLP')
 where word-tokens($a.title) ~= word-tokens($b.title) and $a.id < $b.id
 return {"arec": $a, "brec": $b }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/d185e8ea/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/word-jaccard-check_01.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/word-jaccard-check_01.aql b/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/word-jaccard-check_01.aql
index 78be4fe..989f250 100644
--- a/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/word-jaccard-check_01.aql
+++ b/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/word-jaccard-check_01.aql
@@ -27,7 +27,7 @@ create dataverse test;
 use dataverse test;
 
 create type DBLPType as closed {
-  id: int32, 
+  id: int32,
   dblpid: string,
   title: string,
   authors: string,
@@ -35,7 +35,7 @@ create type DBLPType as closed {
 }
 
 create type CSXType as closed {
-  id: int32, 
+  id: int32,
   csxid: string,
   title: string,
   authors: string,
@@ -50,8 +50,8 @@ create index keyword_index on DBLP(title) type keyword;
 
 write output to asterix_nc1:"rttest/inverted-index-join_word-jaccard-check_01.adm";
 
-for $a in dataset('DBLP')
 for $b in dataset('CSX')
+for $a in dataset('DBLP')
 where similarity-jaccard-check(word-tokens($a.title), word-tokens($b.title), 0.5f)[0]
       and $a.id < $b.id
 return {"arec": $a, "brec": $b }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/d185e8ea/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/word-jaccard_01.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/word-jaccard_01.aql b/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/word-jaccard_01.aql
index 21d5c3e..e2c373a 100644
--- a/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/word-jaccard_01.aql
+++ b/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join/word-jaccard_01.aql
@@ -27,7 +27,7 @@ create dataverse test;
 use dataverse test;
 
 create type DBLPType as closed {
-  id: int32, 
+  id: int32,
   dblpid: string,
   title: string,
   authors: string,
@@ -35,7 +35,7 @@ create type DBLPType as closed {
 }
 
 create type CSXType as closed {
-  id: int32, 
+  id: int32,
   csxid: string,
   title: string,
   authors: string,
@@ -50,8 +50,8 @@ create index keyword_index on DBLP(title) type keyword;
 
 write output to asterix_nc1:"rttest/inverted-index-join_word-jaccard_01.adm";
 
-for $a in dataset('DBLP')
 for $b in dataset('CSX')
+for $a in dataset('DBLP')
 where similarity-jaccard(word-tokens($a.title), word-tokens($b.title)) >= 0.5f
       and $a.id < $b.id
 return {"arec": $a, "brec": $b }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/d185e8ea/asterix-app/src/test/resources/optimizerts/queries/nested-index/btree-index-join/primary-equi-join-multipred.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries/nested-index/btree-index-join/primary-equi-join-multipred.aql b/asterix-app/src/test/resources/optimizerts/queries/nested-index/btree-index-join/primary-equi-join-multipred.aql
index 3662074..c681194 100644
--- a/asterix-app/src/test/resources/optimizerts/queries/nested-index/btree-index-join/primary-equi-join-multipred.aql
+++ b/asterix-app/src/test/resources/optimizerts/queries/nested-index/btree-index-join/primary-equi-join-multipred.aql
@@ -68,7 +68,7 @@ create dataset Orders(OrderType) primary key nested.oid;
 
 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.nested.cid /*+ indexnl */ = $o.nested.cid and $c.nested.name < $o.nested.orderstatus and $c.nested.age < $o.nested.cid
 return {"customer":$c.nested, "order": $o.nested}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/d185e8ea/asterix-app/src/test/resources/optimizerts/queries/nested-index/btree-index-join/primary-equi-join_01.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries/nested-index/btree-index-join/primary-equi-join_01.aql b/asterix-app/src/test/resources/optimizerts/queries/nested-index/btree-index-join/primary-equi-join_01.aql
index 1f6ff8f..2794abc 100644
--- a/asterix-app/src/test/resources/optimizerts/queries/nested-index/btree-index-join/primary-equi-join_01.aql
+++ b/asterix-app/src/test/resources/optimizerts/queries/nested-index/btree-index-join/primary-equi-join_01.aql
@@ -44,8 +44,8 @@ create dataset test1.DsTwo(TestType) primary key nested.key1;
 
 write output to asterix_nc1:"rttest/btree-index-join_primary-equi-join_01.adm";
 
-for $x in dataset('test1.DsOne')
 for $y in dataset('test1.DsTwo')
+for $x in dataset('test1.DsOne')
 where $x.nested.key1 /*+ indexnl */ = $y.nested.key2
 return $x
 

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/d185e8ea/asterix-app/src/test/resources/optimizerts/queries/nested-index/btree-index-join/primary-equi-join_03.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries/nested-index/btree-index-join/primary-equi-join_03.aql b/asterix-app/src/test/resources/optimizerts/queries/nested-index/btree-index-join/primary-equi-join_03.aql
index 0b9df82..08042d6 100644
--- a/asterix-app/src/test/resources/optimizerts/queries/nested-index/btree-index-join/primary-equi-join_03.aql
+++ b/asterix-app/src/test/resources/optimizerts/queries/nested-index/btree-index-join/primary-equi-join_03.aql
@@ -66,7 +66,7 @@ create dataset Orders(OrderType) primary key nested.oid;
 
 write output to asterix_nc1:"rttest/btree-index-join_primary-equi-join_04.adm";
 
-for $c in dataset('Customers')
 for $o in dataset('Orders')
+for $c in dataset('Customers')
 where $c.nested.cid /*+ indexnl */ = $o.nested.cid
 return {"customer":$c.nested, "order": $o.nested}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/d185e8ea/asterix-app/src/test/resources/optimizerts/queries/nested-index/btree-index-join/primary-ge-join_01.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries/nested-index/btree-index-join/primary-ge-join_01.aql b/asterix-app/src/test/resources/optimizerts/queries/nested-index/btree-index-join/primary-ge-join_01.aql
index c230ee7..86887b9 100644
--- a/asterix-app/src/test/resources/optimizerts/queries/nested-index/btree-index-join/primary-ge-join_01.aql
+++ b/asterix-app/src/test/resources/optimizerts/queries/nested-index/btree-index-join/primary-ge-join_01.aql
@@ -44,8 +44,8 @@ create dataset test1.DsTwo(TestType) primary key nested.key1;
 
 write output to asterix_nc1:"rttest/btree-index-join_primary-ge-join_01.adm";
 
-for $x in dataset('test1.DsOne')
 for $y in dataset('test1.DsTwo')
+for $x in dataset('test1.DsOne')
 where $x.nested.key1 /*+ indexnl */ >= $y.nested.key2
 return $x
 

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/d185e8ea/asterix-app/src/test/resources/optimizerts/queries/nested-index/btree-index-join/primary-gt-join_01.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries/nested-index/btree-index-join/primary-gt-join_01.aql b/asterix-app/src/test/resources/optimizerts/queries/nested-index/btree-index-join/primary-gt-join_01.aql
index 1d50be7..d72c87c 100644
--- a/asterix-app/src/test/resources/optimizerts/queries/nested-index/btree-index-join/primary-gt-join_01.aql
+++ b/asterix-app/src/test/resources/optimizerts/queries/nested-index/btree-index-join/primary-gt-join_01.aql
@@ -44,8 +44,8 @@ create dataset test1.DsTwo(TestType) primary key nested.key1;
 
 write output to asterix_nc1:"rttest/btree-index-join_primary-gt-join_01.adm";
 
-for $x in dataset('test1.DsOne')
 for $y in dataset('test1.DsTwo')
+for $x in dataset('test1.DsOne')
 where $x.nested.key1 /*+ indexnl */ > $y.nested.key2
 return $x
 

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/d185e8ea/asterix-app/src/test/resources/optimizerts/queries/nested-index/btree-index-join/primary-le-join_01.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries/nested-index/btree-index-join/primary-le-join_01.aql b/asterix-app/src/test/resources/optimizerts/queries/nested-index/btree-index-join/primary-le-join_01.aql
index e66f0b8..f5fa9ed 100644
--- a/asterix-app/src/test/resources/optimizerts/queries/nested-index/btree-index-join/primary-le-join_01.aql
+++ b/asterix-app/src/test/resources/optimizerts/queries/nested-index/btree-index-join/primary-le-join_01.aql
@@ -44,8 +44,8 @@ create dataset test1.DsTwo(TestType) primary key nested.key1;
 
 write output to asterix_nc1:"rttest/btree-index-join_primary-le-join_01.adm";
 
-for $x in dataset('test1.DsOne')
 for $y in dataset('test1.DsTwo')
+for $x in dataset('test1.DsOne')
 where $x.nested.key1 /*+ indexnl */ <= $y.nested.key2
 return $x
 

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/d185e8ea/asterix-app/src/test/resources/optimizerts/queries/nested-index/btree-index-join/primary-lt-join_01.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries/nested-index/btree-index-join/primary-lt-join_01.aql b/asterix-app/src/test/resources/optimizerts/queries/nested-index/btree-index-join/primary-lt-join_01.aql
index a0d32a0..b623032 100644
--- a/asterix-app/src/test/resources/optimizerts/queries/nested-index/btree-index-join/primary-lt-join_01.aql
+++ b/asterix-app/src/test/resources/optimizerts/queries/nested-index/btree-index-join/primary-lt-join_01.aql
@@ -44,8 +44,8 @@ create dataset test1.DsTwo(TestType) primary key nested.key1;
 
 write output to asterix_nc1:"rttest/btree-index-join_primary-lt-join_01.adm";
 
-for $x in dataset('test1.DsOne')
 for $y in dataset('test1.DsTwo')
+for $x in dataset('test1.DsOne')
 where $x.nested.key1 /*+ indexnl */ < $y.nested.key2
 return $x
 

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/d185e8ea/asterix-app/src/test/resources/optimizerts/queries/nested-index/btree-index-join/secondary-equi-join-multipred.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries/nested-index/btree-index-join/secondary-equi-join-multipred.aql b/asterix-app/src/test/resources/optimizerts/queries/nested-index/btree-index-join/secondary-equi-join-multipred.aql
index d3dacd3..ecad56d 100644
--- a/asterix-app/src/test/resources/optimizerts/queries/nested-index/btree-index-join/secondary-equi-join-multipred.aql
+++ b/asterix-app/src/test/resources/optimizerts/queries/nested-index/btree-index-join/secondary-equi-join-multipred.aql
@@ -61,7 +61,7 @@ create index title_index on DBLP(nested.title);
 
 write output to asterix_nc1:"rttest/btree-index-join_title-secondary-equi-join-multipred.adm";
 
-for $a in dataset('DBLP')
 for $b in dataset('CSX')
+for $a in dataset('DBLP')
 where $a.nested.title /*+ indexnl */ = $b.nested.title and $a.nested.authors < $b.nested.authors and $a.nested.misc > $b.nested.misc
 return {"arec": $a, "brec": $b}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/d185e8ea/asterix-app/src/test/resources/optimizerts/queries/nested-index/btree-index-join/secondary-equi-join_01.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries/nested-index/btree-index-join/secondary-equi-join_01.aql b/asterix-app/src/test/resources/optimizerts/queries/nested-index/btree-index-join/secondary-equi-join_01.aql
index 5e6e852..d0d2d57 100644
--- a/asterix-app/src/test/resources/optimizerts/queries/nested-index/btree-index-join/secondary-equi-join_01.aql
+++ b/asterix-app/src/test/resources/optimizerts/queries/nested-index/btree-index-join/secondary-equi-join_01.aql
@@ -59,7 +59,7 @@ create index title_index on DBLP(nested.title);
 
 write output to asterix_nc1:"rttest/btree-index-join_title-secondary-equi-join_01.adm";
 
-for $a in dataset('DBLP')
 for $b in dataset('CSX')
+for $a in dataset('DBLP')
 where $a.nested.title /*+ indexnl */ = $b.nested.title
 return {"arec": $a, "brec": $b}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/d185e8ea/asterix-app/src/test/resources/optimizerts/queries/nested-index/inverted-index-join/ngram-edit-distance-check_01.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries/nested-index/inverted-index-join/ngram-edit-distance-check_01.aql b/asterix-app/src/test/resources/optimizerts/queries/nested-index/inverted-index-join/ngram-edit-distance-check_01.aql
index d17f352..defd28d 100644
--- a/asterix-app/src/test/resources/optimizerts/queries/nested-index/inverted-index-join/ngram-edit-distance-check_01.aql
+++ b/asterix-app/src/test/resources/optimizerts/queries/nested-index/inverted-index-join/ngram-edit-distance-check_01.aql
@@ -58,7 +58,7 @@ create index ngram_index on DBLP(nested.authors) type ngram(3);
 
 write output to asterix_nc1:"rttest/inverted-index-join_ngram-edit-distance-check_01.adm";
 
-for $a in dataset('DBLP')
 for $b in dataset('CSX')
+for $a in dataset('DBLP')
 where edit-distance-check($a.nested.authors, $b.nested.authors, 3)[0] and $a.nested.id < $b.nested.id
 return {"arec": $a, "brec": $b }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/d185e8ea/asterix-app/src/test/resources/optimizerts/queries/nested-index/inverted-index-join/ngram-edit-distance-contains.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries/nested-index/inverted-index-join/ngram-edit-distance-contains.aql b/asterix-app/src/test/resources/optimizerts/queries/nested-index/inverted-index-join/ngram-edit-distance-contains.aql
index a18fd38..3190e66 100644
--- a/asterix-app/src/test/resources/optimizerts/queries/nested-index/inverted-index-join/ngram-edit-distance-contains.aql
+++ b/asterix-app/src/test/resources/optimizerts/queries/nested-index/inverted-index-join/ngram-edit-distance-contains.aql
@@ -58,7 +58,7 @@ create index ngram_index on DBLP(nested.authors) type ngram(3);
 
 write output to asterix_nc1:"rttest/inverted-index-join_ngram-edit-distance-contains.adm";
 
-for $a in dataset('DBLP')
 for $b in dataset('CSX')
+for $a in dataset('DBLP')
 where edit-distance-contains($a.nested.authors, $b.nested.authors, 3)[0] and $a.nested.id < $b.nested.id
 return {"arec": $a, "brec": $b }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/d185e8ea/asterix-app/src/test/resources/optimizerts/queries/nested-index/inverted-index-join/ngram-edit-distance_01.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries/nested-index/inverted-index-join/ngram-edit-distance_01.aql b/asterix-app/src/test/resources/optimizerts/queries/nested-index/inverted-index-join/ngram-edit-distance_01.aql
index 3a1bcbc..e7e6dc7 100644
--- a/asterix-app/src/test/resources/optimizerts/queries/nested-index/inverted-index-join/ngram-edit-distance_01.aql
+++ b/asterix-app/src/test/resources/optimizerts/queries/nested-index/inverted-index-join/ngram-edit-distance_01.aql
@@ -58,7 +58,7 @@ create index ngram_index on DBLP(nested.authors) type ngram(3);
 
 write output to asterix_nc1:"rttest/inverted-index-join_ngram-edit-distance_01.adm";
 
-for $a in dataset('DBLP')
 for $b in dataset('CSX')
+for $a in dataset('DBLP')
 where edit-distance($a.nested.authors, $b.nested.authors) < 3 and $a.nested.id < $b.nested.id
 return {"arec": $a, "brec": $b }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/d185e8ea/asterix-app/src/test/resources/optimizerts/queries/nested-index/inverted-index-join/olist-edit-distance-check_01.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries/nested-index/inverted-index-join/olist-edit-distance-check_01.aql b/asterix-app/src/test/resources/optimizerts/queries/nested-index/inverted-index-join/olist-edit-distance-check_01.aql
index 3a8a273..354b943 100644
--- a/asterix-app/src/test/resources/optimizerts/queries/nested-index/inverted-index-join/olist-edit-distance-check_01.aql
+++ b/asterix-app/src/test/resources/optimizerts/queries/nested-index/inverted-index-join/olist-edit-distance-check_01.aql
@@ -48,14 +48,14 @@ create type CustomerType as closed {
 }
 
 create dataset Customers(CustomerType) primary key nested.cid;
- 
+
 create dataset Customers2(CustomerType) primary key nested.cid;
 
 create index interests_index on Customers(nested.interests) type keyword;
 
 write output to asterix_nc1:"rttest/inverted-index-join_olist-edit-distance-check_01.adm";
 
-for $a in dataset('Customers')
 for $b in dataset('Customers2')
+for $a in dataset('Customers')
 where edit-distance-check($a.nested.interests, $b.nested.interests, 3)[0] and $a.nested.cid < $b.nested.cid
 return {"arec": $a, "brec": $b }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/d185e8ea/asterix-app/src/test/resources/optimizerts/queries/nested-index/inverted-index-join/olist-edit-distance_01.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries/nested-index/inverted-index-join/olist-edit-distance_01.aql b/asterix-app/src/test/resources/optimizerts/queries/nested-index/inverted-index-join/olist-edit-distance_01.aql
index 28214c9..2b375fd 100644
--- a/asterix-app/src/test/resources/optimizerts/queries/nested-index/inverted-index-join/olist-edit-distance_01.aql
+++ b/asterix-app/src/test/resources/optimizerts/queries/nested-index/inverted-index-join/olist-edit-distance_01.aql
@@ -47,14 +47,14 @@ create type CustomerType as closed {
 }
 
 create dataset Customers(CustomerType) primary key nested.cid;
- 
+
 create dataset Customers2(CustomerType) primary key nested.cid;
 
 create index interests_index on Customers(nested.interests) type keyword;
 
 write output to asterix_nc1:"rttest/inverted-index-join_olist-edit-distance_01.adm";
 
-for $a in dataset('Customers')
 for $b in dataset('Customers2')
+for $a in dataset('Customers')
 where edit-distance($a.nested.interests, $b.nested.interests) <= 2 and $a.nested.cid < $b.nested.cid
 return {"arec": $a, "brec": $b }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/d185e8ea/asterix-app/src/test/resources/optimizerts/queries/nested-index/inverted-index-join/olist-fuzzyeq-edit-distance_01.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries/nested-index/inverted-index-join/olist-fuzzyeq-edit-distance_01.aql b/asterix-app/src/test/resources/optimizerts/queries/nested-index/inverted-index-join/olist-fuzzyeq-edit-distance_01.aql
index f2d633e..a235f67 100644
--- a/asterix-app/src/test/resources/optimizerts/queries/nested-index/inverted-index-join/olist-fuzzyeq-edit-distance_01.aql
+++ b/asterix-app/src/test/resources/optimizerts/queries/nested-index/inverted-index-join/olist-fuzzyeq-edit-distance_01.aql
@@ -46,7 +46,7 @@ create type CustomerType as closed {
 }
 
 create dataset Customers(CustomerType) primary key nested.cid;
- 
+
 create dataset Customers2(CustomerType) primary key nested.cid;
 
 create index interests_index on Customers(nested.interests) type keyword;
@@ -56,7 +56,7 @@ write output to asterix_nc1:"rttest/inverted-index-join_olist-fuzzyeq-jaccard_01
 set simfunction 'edit-distance';
 set simthreshold '3';
 
-for $a in dataset('Customers')
 for $b in dataset('Customers2')
+for $a in dataset('Customers')
 where $a.nested.interests ~= $b.nested.interests and $a.nested.cid < $b.nested.cid
 return {"arec": $a, "brec": $b }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/d185e8ea/asterix-app/src/test/resources/optimizerts/queries/nested-index/inverted-index-join/olist-fuzzyeq-jaccard_01.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries/nested-index/inverted-index-join/olist-fuzzyeq-jaccard_01.aql b/asterix-app/src/test/resources/optimizerts/queries/nested-index/inverted-index-join/olist-fuzzyeq-jaccard_01.aql
index d44dbbe..06ade10 100644
--- a/asterix-app/src/test/resources/optimizerts/queries/nested-index/inverted-index-join/olist-fuzzyeq-jaccard_01.aql
+++ b/asterix-app/src/test/resources/optimizerts/queries/nested-index/inverted-index-join/olist-fuzzyeq-jaccard_01.aql
@@ -46,7 +46,7 @@ create type CustomerType as closed {
 }
 
 create dataset Customers(CustomerType) primary key nested.cid;
- 
+
 create dataset Customers2(CustomerType) primary key nested.cid;
 
 create index interests_index on Customers(nested.interests) type keyword;
@@ -56,7 +56,7 @@ write output to asterix_nc1:"rttest/inverted-index-join_olist-fuzzyeq-jaccard_01
 set simfunction 'jaccard';
 set simthreshold '0.7f';
 
-for $a in dataset('Customers')
 for $b in dataset('Customers2')
+for $a in dataset('Customers')
 where $a.nested.interests /*+ indexnl */ ~= $b.nested.interests and $a.nested.cid < $b.nested.cid
 return {"arec": $a, "brec": $b }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/d185e8ea/asterix-app/src/test/resources/optimizerts/queries/nested-index/inverted-index-join/olist-jaccard-check_01.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries/nested-index/inverted-index-join/olist-jaccard-check_01.aql b/asterix-app/src/test/resources/optimizerts/queries/nested-index/inverted-index-join/olist-jaccard-check_01.aql
index 2adaea5..153ea02 100644
--- a/asterix-app/src/test/resources/optimizerts/queries/nested-index/inverted-index-join/olist-jaccard-check_01.aql
+++ b/asterix-app/src/test/resources/optimizerts/queries/nested-index/inverted-index-join/olist-jaccard-check_01.aql
@@ -46,14 +46,14 @@ create type CustomerType as closed {
 }
 
 create dataset Customers(CustomerType) primary key nested.cid;
- 
+
 create dataset Customers2(CustomerType) primary key nested.cid;
 
 create index interests_index on Customers(nested.interests) type keyword;
 
 write output to asterix_nc1:"rttest/inverted-index-join_olist-jaccard-check_01.adm";
 
-for $a in dataset('Customers')
 for $b in dataset('Customers2')
+for $a in dataset('Customers')
 where /*+ indexnl */ similarity-jaccard-check($a.nested.interests, $b.nested.interests, 0.7f)[0] and $a.nested.cid < $b.nested.cid
 return {"arec": $a, "brec": $b }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/d185e8ea/asterix-app/src/test/resources/optimizerts/queries/nested-index/inverted-index-join/olist-jaccard_01.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries/nested-index/inverted-index-join/olist-jaccard_01.aql b/asterix-app/src/test/resources/optimizerts/queries/nested-index/inverted-index-join/olist-jaccard_01.aql
index 825e3fa..fb51eff 100644
--- a/asterix-app/src/test/resources/optimizerts/queries/nested-index/inverted-index-join/olist-jaccard_01.aql
+++ b/asterix-app/src/test/resources/optimizerts/queries/nested-index/inverted-index-join/olist-jaccard_01.aql
@@ -46,14 +46,14 @@ create type CustomerType as closed {
 }
 
 create dataset Customers(CustomerType) primary key nested.cid;
- 
+
 create dataset Customers2(CustomerType) primary key nested.cid;
 
 create index interests_index on Customers(nested.interests) type keyword;
 
 write output to asterix_nc1:"rttest/inverted-index-join_olist-jaccard_01.adm";
 
-for $a in dataset('Customers')
 for $b in dataset('Customers2')
+for $a in dataset('Customers')
 where /*+ indexnl */ similarity-jaccard($a.nested.interests, $b.nested.interests) >= 0.7f and $a.nested.cid < $b.nested.cid
 return {"arec": $a, "brec": $b }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/d185e8ea/asterix-app/src/test/resources/optimizerts/queries/nested-index/inverted-index-join/ulist-fuzzyeq-jaccard_01.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries/nested-index/inverted-index-join/ulist-fuzzyeq-jaccard_01.aql b/asterix-app/src/test/resources/optimizerts/queries/nested-index/inverted-index-join/ulist-fuzzyeq-jaccard_01.aql
index 234fb6f..998e29c 100644
--- a/asterix-app/src/test/resources/optimizerts/queries/nested-index/inverted-index-join/ulist-fuzzyeq-jaccard_01.aql
+++ b/asterix-app/src/test/resources/optimizerts/queries/nested-index/inverted-index-join/ulist-fuzzyeq-jaccard_01.aql
@@ -46,7 +46,7 @@ create type CustomerType as closed {
 }
 
 create dataset Customers(CustomerType) primary key nested.cid;
- 
+
 create dataset Customers2(CustomerType) primary key nested.cid;
 
 create index interests_index on Customers(nested.interests) type keyword;
@@ -56,7 +56,7 @@ write output to asterix_nc1:"rttest/inverted-index-join_ulist-fuzzyeq-jaccard_01
 set simfunction 'jaccard';
 set simthreshold '0.7f';
 
-for $a in dataset('Customers')
 for $b in dataset('Customers2')
+for $a in dataset('Customers')
 where $a.nested.interests /*+ indexnl */ ~= $b.nested.interests and $a.nested.cid < $b.nested.cid
 return {"arec": $a, "brec": $b }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/d185e8ea/asterix-app/src/test/resources/optimizerts/queries/nested-index/inverted-index-join/ulist-jaccard-check_01.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries/nested-index/inverted-index-join/ulist-jaccard-check_01.aql b/asterix-app/src/test/resources/optimizerts/queries/nested-index/inverted-index-join/ulist-jaccard-check_01.aql
index 1d483a1..4493a40 100644
--- a/asterix-app/src/test/resources/optimizerts/queries/nested-index/inverted-index-join/ulist-jaccard-check_01.aql
+++ b/asterix-app/src/test/resources/optimizerts/queries/nested-index/inverted-index-join/ulist-jaccard-check_01.aql
@@ -46,14 +46,14 @@ create type CustomerType as closed {
 }
 
 create dataset Customers(CustomerType) primary key nested.cid;
- 
+
 create dataset Customers2(CustomerType) primary key nested.cid;
 
 create index interests_index on Customers(nested.interests) type keyword;
 
 write output to asterix_nc1:"rttest/inverted-index-join_ulist-jaccard-check_01.adm";
 
-for $a in dataset('Customers')
 for $b in dataset('Customers2')
+for $a in dataset('Customers')
 where /*+ indexnl */ similarity-jaccard-check($a.nested.interests, $b.nested.interests, 0.7f)[0] and $a.nested.cid < $b.nested.cid
 return {"arec": $a, "brec": $b }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/d185e8ea/asterix-app/src/test/resources/optimizerts/queries/nested-index/inverted-index-join/ulist-jaccard_01.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries/nested-index/inverted-index-join/ulist-jaccard_01.aql b/asterix-app/src/test/resources/optimizerts/queries/nested-index/inverted-index-join/ulist-jaccard_01.aql
index bb95661..b39409e 100644
--- a/asterix-app/src/test/resources/optimizerts/queries/nested-index/inverted-index-join/ulist-jaccard_01.aql
+++ b/asterix-app/src/test/resources/optimizerts/queries/nested-index/inverted-index-join/ulist-jaccard_01.aql
@@ -46,14 +46,14 @@ create type CustomerType as closed {
 }
 
 create dataset Customers(CustomerType) primary key nested.cid;
- 
+
 create dataset Customers2(CustomerType) primary key nested.cid;
 
 create index interests_index on Customers(nested.interests) type keyword;
 
 write output to asterix_nc1:"rttest/inverted-index-join_ulist-jaccard_01.adm";
 
-for $a in dataset('Customers')
 for $b in dataset('Customers2')
+for $a in dataset('Customers')
 where /*+ indexnl */ similarity-jaccard($a.nested.interests, $b.nested.interests) >= 0.7f and $a.nested.cid < $b.nested.cid
 return {"arec": $a, "brec": $b }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/d185e8ea/asterix-app/src/test/resources/optimizerts/queries/nested-index/inverted-index-join/word-fuzzyeq-jaccard_01.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries/nested-index/inverted-index-join/word-fuzzyeq-jaccard_01.aql b/asterix-app/src/test/resources/optimizerts/queries/nested-index/inverted-index-join/word-fuzzyeq-jaccard_01.aql
index a66b7b3..e45b02d 100644
--- a/asterix-app/src/test/resources/optimizerts/queries/nested-index/inverted-index-join/word-fuzzyeq-jaccard_01.aql
+++ b/asterix-app/src/test/resources/optimizerts/queries/nested-index/inverted-index-join/word-fuzzyeq-jaccard_01.aql
@@ -61,7 +61,7 @@ write output to asterix_nc1:"rttest/inverted-index-join_word-fuzzyeq-jaccard_01.
 set simfunction 'jaccard';
 set simthreshold '0.5f';
 
-for $a in dataset('DBLP')
 for $b in dataset('CSX')
+for $a in dataset('DBLP')
 where word-tokens($a.nested.title) ~= word-tokens($b.nested.title) and $a.nested.id < $b.nested.id
 return {"arec": $a, "brec": $b }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/d185e8ea/asterix-app/src/test/resources/optimizerts/queries/nested-index/inverted-index-join/word-jaccard-check_01.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries/nested-index/inverted-index-join/word-jaccard-check_01.aql b/asterix-app/src/test/resources/optimizerts/queries/nested-index/inverted-index-join/word-jaccard-check_01.aql
index 376ecec..55c2ff4 100644
--- a/asterix-app/src/test/resources/optimizerts/queries/nested-index/inverted-index-join/word-jaccard-check_01.aql
+++ b/asterix-app/src/test/resources/optimizerts/queries/nested-index/inverted-index-join/word-jaccard-check_01.aql
@@ -58,8 +58,8 @@ create index keyword_index on DBLP(nested.title) type keyword;
 
 write output to asterix_nc1:"rttest/inverted-index-join_word-jaccard-check_01.adm";
 
-for $a in dataset('DBLP')
 for $b in dataset('CSX')
+for $a in dataset('DBLP')
 where similarity-jaccard-check(word-tokens($a.nested.title), word-tokens($b.nested.title), 0.5f)[0]
       and $a.nested.id < $b.nested.id
 return {"arec": $a, "brec": $b }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/d185e8ea/asterix-app/src/test/resources/optimizerts/queries/nested-index/inverted-index-join/word-jaccard_01.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries/nested-index/inverted-index-join/word-jaccard_01.aql b/asterix-app/src/test/resources/optimizerts/queries/nested-index/inverted-index-join/word-jaccard_01.aql
index e374a44..acbe3db 100644
--- a/asterix-app/src/test/resources/optimizerts/queries/nested-index/inverted-index-join/word-jaccard_01.aql
+++ b/asterix-app/src/test/resources/optimizerts/queries/nested-index/inverted-index-join/word-jaccard_01.aql
@@ -58,8 +58,8 @@ create index keyword_index on DBLP(nested.title) type keyword;
 
 write output to asterix_nc1:"rttest/inverted-index-join_word-jaccard_01.adm";
 
-for $a in dataset('DBLP')
 for $b in dataset('CSX')
+for $a in dataset('DBLP')
 where similarity-jaccard(word-tokens($a.nested.title), word-tokens($b.nested.title)) >= 0.5f
       and $a.nested.id < $b.nested.id
 return {"arec": $a, "brec": $b }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/d185e8ea/asterix-app/src/test/resources/optimizerts/queries/nested-index/rtree-index-join/spatial-intersect-point_01.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries/nested-index/rtree-index-join/spatial-intersect-point_01.aql b/asterix-app/src/test/resources/optimizerts/queries/nested-index/rtree-index-join/spatial-intersect-point_01.aql
index c2a8711..b5f36e7 100644
--- a/asterix-app/src/test/resources/optimizerts/queries/nested-index/rtree-index-join/spatial-intersect-point_01.aql
+++ b/asterix-app/src/test/resources/optimizerts/queries/nested-index/rtree-index-join/spatial-intersect-point_01.aql
@@ -49,7 +49,7 @@ create index rtree_index on MyData1(nested.point) type rtree;
 
 write output to asterix_nc1:"rttest/index-join_rtree-spatial-intersect-point.adm";
 
-for $a in dataset('MyData1')
 for $b in dataset('MyData2')
+for $a in dataset('MyData1')
 where spatial-intersect($a.nested.point, $b.point)
 return {"a": $a, "b": $b}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/d185e8ea/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/btree-index-join/secondary-equi-join-multipred.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/btree-index-join/secondary-equi-join-multipred.aql b/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/btree-index-join/secondary-equi-join-multipred.aql
index 378f6bb..b4e7e78 100644
--- a/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/btree-index-join/secondary-equi-join-multipred.aql
+++ b/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/btree-index-join/secondary-equi-join-multipred.aql
@@ -60,7 +60,7 @@ create index title_index on DBLP(nested.title:string) enforced;
 
 write output to asterix_nc1:"rttest/btree-index-join_title-secondary-equi-join-multipred.adm";
 
-for $a in dataset('DBLP')
 for $b in dataset('CSX')
+for $a in dataset('DBLP')
 where $a.nested.title /*+ indexnl */ = $b.nested.title and $a.nested.authors < $b.nested.authors and $a.nested.misc > $b.nested.misc
 return {"arec": $a, "brec": $b}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/d185e8ea/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/btree-index-join/secondary-equi-join_01.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/btree-index-join/secondary-equi-join_01.aql b/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/btree-index-join/secondary-equi-join_01.aql
index 518ea36..fca3294 100644
--- a/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/btree-index-join/secondary-equi-join_01.aql
+++ b/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/btree-index-join/secondary-equi-join_01.aql
@@ -58,7 +58,7 @@ create index title_index on DBLP(nested.title: string) enforced;
 
 write output to asterix_nc1:"rttest/btree-index-join_title-secondary-equi-join_01.adm";
 
-for $a in dataset('DBLP')
 for $b in dataset('CSX')
+for $a in dataset('DBLP')
 where $a.nested.title /*+ indexnl */ = $b.nested.title
 return {"arec": $a, "brec": $b}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/d185e8ea/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/ngram-contains_01.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/ngram-contains_01.aql b/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/ngram-contains_01.aql
index 7d63fd1..30b7078 100644
--- a/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/ngram-contains_01.aql
+++ b/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/ngram-contains_01.aql
@@ -48,8 +48,8 @@ create index ngram_index on DBLP(title: string) type ngram(3) enforced;
 
 write output to asterix_nc1:"rttest/inverted-index-join_ngram-contains-01.adm";
 
-for $o1 in dataset('DBLP')
 for $o2 in dataset('CSX')
+for $o1 in dataset('DBLP')
 where contains($o1.title, $o2.title) and $o1.id < $o2.id
 order by $o1.id, $o2.id
 return {"title1":$o1.title, "title2":$o2.title}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/d185e8ea/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/ngram-contains_02.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/ngram-contains_02.aql b/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/ngram-contains_02.aql
index fc3e555..7f48b7a 100644
--- a/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/ngram-contains_02.aql
+++ b/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/ngram-contains_02.aql
@@ -48,8 +48,8 @@ create index ngram_index on CSX(title: string) type ngram(3) enforced;
 
 write output to asterix_nc1:"rttest/inverted-index-join_ngram-contains-02.adm";
 
-for $o1 in dataset('CSX')
 for $o2 in dataset('DBLP')
+for $o1 in dataset('CSX')
 where contains($o1.title, $o2.title) and $o1.id < $o2.id
 order by $o1.id, $o2.id
 return {"title1":$o1.title, "title2":$o2.title}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/d185e8ea/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/ngram-edit-distance-check_01.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/ngram-edit-distance-check_01.aql b/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/ngram-edit-distance-check_01.aql
index 06ab807..ae3f431 100644
--- a/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/ngram-edit-distance-check_01.aql
+++ b/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/ngram-edit-distance-check_01.aql
@@ -57,7 +57,7 @@ create index ngram_index on DBLP(nested.authors: string) type ngram(3) enforced;
 
 write output to asterix_nc1:"rttest/inverted-index-join_ngram-edit-distance-check_01.adm";
 
-for $a in dataset('DBLP')
 for $b in dataset('CSX')
+for $a in dataset('DBLP')
 where edit-distance-check($a.nested.authors, $b.nested.authors, 3)[0] and $a.nested.id < $b.nested.id
 return {"arec": $a, "brec": $b }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/d185e8ea/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/ngram-edit-distance-check_02.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/ngram-edit-distance-check_02.aql b/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/ngram-edit-distance-check_02.aql
index 8147e81..b916550 100644
--- a/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/ngram-edit-distance-check_02.aql
+++ b/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/ngram-edit-distance-check_02.aql
@@ -57,7 +57,7 @@ create index ngram_index on CSX(nested.authors: string) type ngram(3) enforced;
 
 write output to asterix_nc1:"rttest/inverted-index-join_ngram-edit-distance-check_01.adm";
 
-for $a in dataset('CSX')
 for $b in dataset('DBLP')
+for $a in dataset('CSX')
 where edit-distance-check($a.nested.authors, $b.nested.authors, 3)[0] and $a.nested.id < $b.nested.id
 return {"arec": $a, "brec": $b }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/d185e8ea/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/ngram-edit-distance-contains.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/ngram-edit-distance-contains.aql b/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/ngram-edit-distance-contains.aql
index 6319464..62a20f5 100644
--- a/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/ngram-edit-distance-contains.aql
+++ b/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/ngram-edit-distance-contains.aql
@@ -57,7 +57,7 @@ create index ngram_index on DBLP(nested.authors: string) type ngram(3) enforced;
 
 write output to asterix_nc1:"rttest/inverted-index-join_ngram-edit-distance-contains.adm";
 
-for $a in dataset('DBLP')
 for $b in dataset('CSX')
+for $a in dataset('DBLP')
 where edit-distance-contains($a.nested.authors, $b.nested.authors, 3)[0] and $a.nested.id < $b.nested.id
 return {"arec": $a, "brec": $b }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/d185e8ea/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/ngram-edit-distance_01.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/ngram-edit-distance_01.aql b/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/ngram-edit-distance_01.aql
index 7d53c14..c7e0b7e 100644
--- a/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/ngram-edit-distance_01.aql
+++ b/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/ngram-edit-distance_01.aql
@@ -57,7 +57,7 @@ create index ngram_index on DBLP(nested.authors: string) type ngram(3) enforced;
 
 write output to asterix_nc1:"rttest/inverted-index-join_ngram-edit-distance_01.adm";
 
-for $a in dataset('DBLP')
 for $b in dataset('CSX')
+for $a in dataset('DBLP')
 where edit-distance($a.nested.authors, $b.nested.authors) < 3 and $a.nested.id < $b.nested.id
 return {"arec": $a, "brec": $b }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/d185e8ea/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/ngram-edit-distance_02.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/ngram-edit-distance_02.aql b/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/ngram-edit-distance_02.aql
index 9d5317a..cd8dc85 100644
--- a/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/ngram-edit-distance_02.aql
+++ b/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/ngram-edit-distance_02.aql
@@ -57,7 +57,7 @@ create index ngram_index on CSX(nested.authors: string) type ngram(3) enforced;
 
 write output to asterix_nc1:"rttest/inverted-index-join_ngram-edit-distance_01.adm";
 
-for $a in dataset('CSX')
 for $b in dataset('DBLP')
+for $a in dataset('CSX')
 where edit-distance($a.nested.authors, $b.nested.authors) < 3 and $a.nested.id < $b.nested.id
 return {"arec": $a, "brec": $b }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/d185e8ea/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/ngram-fuzzyeq-edit-distance_01.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/ngram-fuzzyeq-edit-distance_01.aql b/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/ngram-fuzzyeq-edit-distance_01.aql
index 30231fb..fba60ad 100644
--- a/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/ngram-fuzzyeq-edit-distance_01.aql
+++ b/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/ngram-fuzzyeq-edit-distance_01.aql
@@ -60,7 +60,7 @@ write output to asterix_nc1:"rttest/inverted-index-join_ngram-fuzzyeq-edit-dista
 set simfunction 'edit-distance';
 set simthreshold '3';
 
-for $a in dataset('DBLP')
 for $b in dataset('CSX')
+for $a in dataset('DBLP')
 where $a.nested.authors ~= $b.nested.authors and $a.nested.id < $b.nested.id
 return {"arec": $a, "brec": $b }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/d185e8ea/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/ngram-fuzzyeq-edit-distance_02.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/ngram-fuzzyeq-edit-distance_02.aql b/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/ngram-fuzzyeq-edit-distance_02.aql
index 38302e9..e89dd53 100644
--- a/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/ngram-fuzzyeq-edit-distance_02.aql
+++ b/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/ngram-fuzzyeq-edit-distance_02.aql
@@ -60,7 +60,7 @@ write output to asterix_nc1:"rttest/inverted-index-join_ngram-fuzzyeq-edit-dista
 set simfunction 'edit-distance';
 set simthreshold '3';
 
-for $a in dataset('CSX')
 for $b in dataset('DBLP')
+for $a in dataset('CSX')
 where $a.nested.authors ~= $b.nested.authors and $a.nested.id < $b.nested.id
 return {"arec": $a, "brec": $b }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/d185e8ea/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/ngram-fuzzyeq-jaccard_01.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/ngram-fuzzyeq-jaccard_01.aql b/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/ngram-fuzzyeq-jaccard_01.aql
index 2756836..8cf3373 100644
--- a/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/ngram-fuzzyeq-jaccard_01.aql
+++ b/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/ngram-fuzzyeq-jaccard_01.aql
@@ -61,7 +61,7 @@ write output to asterix_nc1:"rttest/inverted-index-join_ngram-fuzzyeq-jaccard_01
 set simfunction 'jaccard';
 set simthreshold '0.5f';
 
-for $a in dataset('DBLP')
 for $b in dataset('CSX')
+for $a in dataset('DBLP')
 where gram-tokens($a.nested.title, 3, false) ~= gram-tokens($b.nested.title, 3, false) and $a.nested.id < $b.nested.id
 return {"arec": $a, "brec": $b }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/d185e8ea/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/ngram-fuzzyeq-jaccard_02.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/ngram-fuzzyeq-jaccard_02.aql b/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/ngram-fuzzyeq-jaccard_02.aql
index a930fad..2de6fb3 100644
--- a/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/ngram-fuzzyeq-jaccard_02.aql
+++ b/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/ngram-fuzzyeq-jaccard_02.aql
@@ -61,7 +61,7 @@ write output to asterix_nc1:"rttest/inverted-index-join_ngram-fuzzyeq-jaccard_01
 set simfunction 'jaccard';
 set simthreshold '0.5f';
 
-for $a in dataset('CSX')
 for $b in dataset('DBLP')
+for $a in dataset('CSX')
 where gram-tokens($a.nested.title, 3, false) ~= gram-tokens($b.nested.title, 3, false) and $a.nested.id < $b.nested.id
 return {"arec": $a, "brec": $b }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/d185e8ea/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/ngram-jaccard-check_01.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/ngram-jaccard-check_01.aql b/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/ngram-jaccard-check_01.aql
index 263c5fb..f26b0e9 100644
--- a/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/ngram-jaccard-check_01.aql
+++ b/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/ngram-jaccard-check_01.aql
@@ -58,8 +58,8 @@ create index ngram_index on DBLP(nested.title: string) type ngram(3) enforced;
 
 write output to asterix_nc1:"rttest/inverted-index-join_ngram-jaccard-check_01.adm";
 
-for $a in dataset('DBLP')
 for $b in dataset('CSX')
+for $a in dataset('DBLP')
 where similarity-jaccard-check(gram-tokens($a.nested.title, 3, false), gram-tokens($b.nested.title, 3, false), 0.5f)[0]
       and $a.nested.id < $b.nested.id
 return {"arec": $a, "brec": $b }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/d185e8ea/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/ngram-jaccard-check_02.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/ngram-jaccard-check_02.aql b/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/ngram-jaccard-check_02.aql
index 4fa503d..2a834ce 100644
--- a/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/ngram-jaccard-check_02.aql
+++ b/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/ngram-jaccard-check_02.aql
@@ -58,8 +58,8 @@ create index ngram_index on CSX(nested.title: string) type ngram(3) enforced;
 
 write output to asterix_nc1:"rttest/inverted-index-join_ngram-jaccard-check_01.adm";
 
-for $a in dataset('CSX')
 for $b in dataset('DBLP')
+for $a in dataset('CSX')
 where similarity-jaccard-check(gram-tokens($a.nested.title, 3, false), gram-tokens($b.nested.title, 3, false), 0.5f)[0]
       and $a.nested.id < $b.nested.id
 return {"arec": $a, "brec": $b }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/d185e8ea/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/ngram-jaccard_01.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/ngram-jaccard_01.aql b/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/ngram-jaccard_01.aql
index dd83e2e..14cb1ff 100644
--- a/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/ngram-jaccard_01.aql
+++ b/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/ngram-jaccard_01.aql
@@ -58,8 +58,8 @@ create index ngram_index on DBLP(nested.title: string) type ngram(3) enforced;
 
 write output to asterix_nc1:"rttest/inverted-index-join_ngram-jaccard_01.adm";
 
-for $a in dataset('DBLP')
 for $b in dataset('CSX')
+for $a in dataset('DBLP')
 where similarity-jaccard(gram-tokens($a.nested.title, 3, false), gram-tokens($b.nested.title, 3, false)) >= 0.5f
       and $a.nested.id < $b.nested.id
 return {"arec": $a, "brec": $b }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/d185e8ea/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/ngram-jaccard_02.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/ngram-jaccard_02.aql b/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/ngram-jaccard_02.aql
index 1d77aa7..e85c997 100644
--- a/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/ngram-jaccard_02.aql
+++ b/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/ngram-jaccard_02.aql
@@ -58,8 +58,8 @@ create index ngram_index on CSX(nested.title: string) type ngram(3) enforced;
 
 write output to asterix_nc1:"rttest/inverted-index-join_ngram-jaccard_01.adm";
 
-for $a in dataset('CSX')
 for $b in dataset('DBLP')
+for $a in dataset('CSX')
 where similarity-jaccard(gram-tokens($a.nested.title, 3, false), gram-tokens($b.nested.title, 3, false)) >= 0.5f
       and $a.nested.id < $b.nested.id
 return {"arec": $a, "brec": $b }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/d185e8ea/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/word-fuzzyeq-jaccard_01.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/word-fuzzyeq-jaccard_01.aql b/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/word-fuzzyeq-jaccard_01.aql
index a52deb4..37ee1b4 100644
--- a/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/word-fuzzyeq-jaccard_01.aql
+++ b/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/word-fuzzyeq-jaccard_01.aql
@@ -60,7 +60,7 @@ write output to asterix_nc1:"rttest/inverted-index-join_word-fuzzyeq-jaccard_01.
 set simfunction 'jaccard';
 set simthreshold '0.5f';
 
-for $a in dataset('DBLP')
 for $b in dataset('CSX')
+for $a in dataset('DBLP')
 where word-tokens($a.nested.title) ~= word-tokens($b.nested.title) and $a.nested.id < $b.nested.id
 return {"arec": $a, "brec": $b }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/d185e8ea/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/word-fuzzyeq-jaccard_02.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/word-fuzzyeq-jaccard_02.aql b/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/word-fuzzyeq-jaccard_02.aql
index 7d07d45..7939ca2 100644
--- a/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/word-fuzzyeq-jaccard_02.aql
+++ b/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/word-fuzzyeq-jaccard_02.aql
@@ -60,7 +60,7 @@ write output to asterix_nc1:"rttest/inverted-index-join_word-fuzzyeq-jaccard_01.
 set simfunction 'jaccard';
 set simthreshold '0.5f';
 
-for $a in dataset('CSX')
 for $b in dataset('DBLP')
+for $a in dataset('CSX')
 where word-tokens($a.nested.title) ~= word-tokens($b.nested.title) and $a.nested.id < $b.nested.id
 return {"arec": $a, "brec": $b }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/d185e8ea/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/word-jaccard-check_01.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/word-jaccard-check_01.aql b/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/word-jaccard-check_01.aql
index ab039ed..8bca7b3 100644
--- a/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/word-jaccard-check_01.aql
+++ b/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/word-jaccard-check_01.aql
@@ -57,8 +57,8 @@ create index keyword_index on DBLP(nested.title: string) type keyword enforced;
 
 write output to asterix_nc1:"rttest/inverted-index-join_word-jaccard-check_01.adm";
 
-for $a in dataset('DBLP')
 for $b in dataset('CSX')
+for $a in dataset('DBLP')
 where similarity-jaccard-check(word-tokens($a.nested.title), word-tokens($b.nested.title), 0.5f)[0]
       and $a.nested.id < $b.nested.id
 return {"arec": $a, "brec": $b }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/d185e8ea/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/word-jaccard-check_02.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/word-jaccard-check_02.aql b/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/word-jaccard-check_02.aql
index 401716e..803d4db 100644
--- a/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/word-jaccard-check_02.aql
+++ b/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/word-jaccard-check_02.aql
@@ -57,8 +57,8 @@ create index keyword_index on CSX(nested.title: string) type keyword enforced;
 
 write output to asterix_nc1:"rttest/inverted-index-join_word-jaccard-check_01.adm";
 
-for $a in dataset('CSX')
 for $b in dataset('DBLP')
+for $a in dataset('CSX')
 where similarity-jaccard-check(word-tokens($a.nested.title), word-tokens($b.nested.title), 0.5f)[0]
       and $a.nested.id < $b.nested.id
 return {"arec": $a, "brec": $b }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/d185e8ea/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/word-jaccard_01.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/word-jaccard_01.aql b/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/word-jaccard_01.aql
index 063520a..aeef474 100644
--- a/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/word-jaccard_01.aql
+++ b/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/word-jaccard_01.aql
@@ -57,8 +57,8 @@ create index keyword_index on DBLP(nested.title: string) type keyword enforced;
 
 write output to asterix_nc1:"rttest/inverted-index-join_word-jaccard_01.adm";
 
-for $a in dataset('DBLP')
 for $b in dataset('CSX')
+for $a in dataset('DBLP')
 where similarity-jaccard(word-tokens($a.nested.title), word-tokens($b.nested.title)) >= 0.5f
       and $a.nested.id < $b.nested.id
 return {"arec": $a, "brec": $b }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/d185e8ea/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/word-jaccard_02.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/word-jaccard_02.aql b/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/word-jaccard_02.aql
index 4230533..15a88ca 100644
--- a/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/word-jaccard_02.aql
+++ b/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/inverted-index-join/word-jaccard_02.aql
@@ -57,8 +57,8 @@ create index keyword_index on CSX(nested.title: string) type keyword enforced;
 
 write output to asterix_nc1:"rttest/inverted-index-join_word-jaccard_01.adm";
 
-for $a in dataset('CSX')
 for $b in dataset('DBLP')
+for $a in dataset('CSX')
 where similarity-jaccard(word-tokens($a.nested.title), word-tokens($b.nested.title)) >= 0.5f
       and $a.nested.id < $b.nested.id
 return {"arec": $a, "brec": $b }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/d185e8ea/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/rtree-index-join/spatial-intersect-point_01.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/rtree-index-join/spatial-intersect-point_01.aql b/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/rtree-index-join/spatial-intersect-point_01.aql
index c2a8711..b5f36e7 100644
--- a/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/rtree-index-join/spatial-intersect-point_01.aql
+++ b/asterix-app/src/test/resources/optimizerts/queries/nested-open-index/rtree-index-join/spatial-intersect-point_01.aql
@@ -49,7 +49,7 @@ create index rtree_index on MyData1(nested.point) type rtree;
 
 write output to asterix_nc1:"rttest/index-join_rtree-spatial-intersect-point.adm";
 
-for $a in dataset('MyData1')
 for $b in dataset('MyData2')
+for $a in dataset('MyData1')
 where spatial-intersect($a.nested.point, $b.point)
 return {"a": $a, "b": $b}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/d185e8ea/asterix-app/src/test/resources/optimizerts/queries/open-index-enforced/btree-index-join/secondary-equi-join-multipred.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries/open-index-enforced/btree-index-join/secondary-equi-join-multipred.aql b/asterix-app/src/test/resources/optimizerts/queries/open-index-enforced/btree-index-join/secondary-equi-join-multipred.aql
index e16bf87..4cad8e3 100644
--- a/asterix-app/src/test/resources/optimizerts/queries/open-index-enforced/btree-index-join/secondary-equi-join-multipred.aql
+++ b/asterix-app/src/test/resources/optimizerts/queries/open-index-enforced/btree-index-join/secondary-equi-join-multipred.aql
@@ -52,7 +52,7 @@ create index title_index on DBLP(title:string) enforced;
 
 write output to asterix_nc1:"rttest/btree-index-join_title-secondary-equi-join-multipred.adm";
 
-for $a in dataset('DBLP')
 for $b in dataset('CSX')
+for $a in dataset('DBLP')
 where $a.title /*+ indexnl */ = $b.title and $a.authors < $b.authors and $a.misc > $b.misc
 return {"arec": $a, "brec": $b}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/d185e8ea/asterix-app/src/test/resources/optimizerts/queries/open-index-enforced/btree-index-join/secondary-equi-join_01.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries/open-index-enforced/btree-index-join/secondary-equi-join_01.aql b/asterix-app/src/test/resources/optimizerts/queries/open-index-enforced/btree-index-join/secondary-equi-join_01.aql
index cd801cf..b9a9f59 100644
--- a/asterix-app/src/test/resources/optimizerts/queries/open-index-enforced/btree-index-join/secondary-equi-join_01.aql
+++ b/asterix-app/src/test/resources/optimizerts/queries/open-index-enforced/btree-index-join/secondary-equi-join_01.aql
@@ -50,7 +50,7 @@ create index title_index on DBLP(title:string) enforced;
 
 write output to asterix_nc1:"rttest/btree-index-join_title-secondary-equi-join_01.adm";
 
-for $a in dataset('DBLP')
 for $b in dataset('CSX')
+for $a in dataset('DBLP')
 where $a.title /*+ indexnl */ = $b.title
 return {"arec": $a, "brec": $b}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/d185e8ea/asterix-app/src/test/resources/optimizerts/queries/open-index-enforced/inverted-index-join/ngram-contains_01.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries/open-index-enforced/inverted-index-join/ngram-contains_01.aql b/asterix-app/src/test/resources/optimizerts/queries/open-index-enforced/inverted-index-join/ngram-contains_01.aql
index 7d63fd1..30b7078 100644
--- a/asterix-app/src/test/resources/optimizerts/queries/open-index-enforced/inverted-index-join/ngram-contains_01.aql
+++ b/asterix-app/src/test/resources/optimizerts/queries/open-index-enforced/inverted-index-join/ngram-contains_01.aql
@@ -48,8 +48,8 @@ create index ngram_index on DBLP(title: string) type ngram(3) enforced;
 
 write output to asterix_nc1:"rttest/inverted-index-join_ngram-contains-01.adm";
 
-for $o1 in dataset('DBLP')
 for $o2 in dataset('CSX')
+for $o1 in dataset('DBLP')
 where contains($o1.title, $o2.title) and $o1.id < $o2.id
 order by $o1.id, $o2.id
 return {"title1":$o1.title, "title2":$o2.title}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/d185e8ea/asterix-app/src/test/resources/optimizerts/queries/open-index-enforced/inverted-index-join/ngram-edit-distance-check_01.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries/open-index-enforced/inverted-index-join/ngram-edit-distance-check_01.aql b/asterix-app/src/test/resources/optimizerts/queries/open-index-enforced/inverted-index-join/ngram-edit-distance-check_01.aql
index 533e697..a2a4ba3 100644
--- a/asterix-app/src/test/resources/optimizerts/queries/open-index-enforced/inverted-index-join/ngram-edit-distance-check_01.aql
+++ b/asterix-app/src/test/resources/optimizerts/queries/open-index-enforced/inverted-index-join/ngram-edit-distance-check_01.aql
@@ -49,7 +49,7 @@ create index ngram_index on DBLP(authors:string) type ngram(3) enforced;
 
 write output to asterix_nc1:"rttest/inverted-index-join_ngram-edit-distance-check_01.adm";
 
-for $a in dataset('DBLP')
 for $b in dataset('CSX')
+for $a in dataset('DBLP')
 where edit-distance-check($a.authors, $b.authors, 3)[0] and $a.id < $b.id
 return {"arec": $a, "brec": $b }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/d185e8ea/asterix-app/src/test/resources/optimizerts/queries/open-index-enforced/inverted-index-join/ngram-edit-distance-contains.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries/open-index-enforced/inverted-index-join/ngram-edit-distance-contains.aql b/asterix-app/src/test/resources/optimizerts/queries/open-index-enforced/inverted-index-join/ngram-edit-distance-contains.aql
index 05f90a2..466fb71 100644
--- a/asterix-app/src/test/resources/optimizerts/queries/open-index-enforced/inverted-index-join/ngram-edit-distance-contains.aql
+++ b/asterix-app/src/test/resources/optimizerts/queries/open-index-enforced/inverted-index-join/ngram-edit-distance-contains.aql
@@ -49,7 +49,7 @@ create index ngram_index on DBLP(authors: string) type ngram(3) enforced;
 
 write output to asterix_nc1:"rttest/inverted-index-join_ngram-edit-distance-contains.adm";
 
-for $a in dataset('DBLP')
 for $b in dataset('CSX')
+for $a in dataset('DBLP')
 where edit-distance-contains($a.authors, $b.authors, 3)[0] and $a.id < $b.id
 return {"arec": $a, "brec": $b }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/d185e8ea/asterix-app/src/test/resources/optimizerts/queries/open-index-enforced/inverted-index-join/ngram-edit-distance_01.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries/open-index-enforced/inverted-index-join/ngram-edit-distance_01.aql b/asterix-app/src/test/resources/optimizerts/queries/open-index-enforced/inverted-index-join/ngram-edit-distance_01.aql
index 104c7a3..d3ad9e2 100644
--- a/asterix-app/src/test/resources/optimizerts/queries/open-index-enforced/inverted-index-join/ngram-edit-distance_01.aql
+++ b/asterix-app/src/test/resources/optimizerts/queries/open-index-enforced/inverted-index-join/ngram-edit-distance_01.aql
@@ -49,7 +49,7 @@ create index ngram_index on DBLP(authors:string) type ngram(3) enforced;
 
 write output to asterix_nc1:"rttest/inverted-index-join_ngram-edit-distance_01.adm";
 
-for $a in dataset('DBLP')
 for $b in dataset('CSX')
+for $a in dataset('DBLP')
 where edit-distance($a.authors, $b.authors) < 3 and $a.id < $b.id
 return {"arec": $a, "brec": $b }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/d185e8ea/asterix-app/src/test/resources/optimizerts/queries/open-index-enforced/inverted-index-join/ngram-fuzzyeq-edit-distance_02.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries/open-index-enforced/inverted-index-join/ngram-fuzzyeq-edit-distance_02.aql b/asterix-app/src/test/resources/optimizerts/queries/open-index-enforced/inverted-index-join/ngram-fuzzyeq-edit-distance_02.aql
index b29f8c9..afa9a18 100644
--- a/asterix-app/src/test/resources/optimizerts/queries/open-index-enforced/inverted-index-join/ngram-fuzzyeq-edit-distance_02.aql
+++ b/asterix-app/src/test/resources/optimizerts/queries/open-index-enforced/inverted-index-join/ngram-fuzzyeq-edit-distance_02.aql
@@ -52,7 +52,7 @@ write output to asterix_nc1:"rttest/inverted-index-join_ngram-fuzzyeq-edit-dista
 set simfunction 'edit-distance';
 set simthreshold '3';
 
-for $a in dataset('DBLP')
 for $b in dataset('CSX')
+for $a in dataset('DBLP')
 where $a.authors ~= $b.authors and $a.id < $b.id
 return {"arec": $a, "brec": $b }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/d185e8ea/asterix-app/src/test/resources/optimizerts/queries/open-index-enforced/inverted-index-join/ngram-fuzzyeq-jaccard_01.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries/open-index-enforced/inverted-index-join/ngram-fuzzyeq-jaccard_01.aql b/asterix-app/src/test/resources/optimizerts/queries/open-index-enforced/inverted-index-join/ngram-fuzzyeq-jaccard_01.aql
index fe68a2a..c7e57af 100644
--- a/asterix-app/src/test/resources/optimizerts/queries/open-index-enforced/inverted-index-join/ngram-fuzzyeq-jaccard_01.aql
+++ b/asterix-app/src/test/resources/optimizerts/queries/open-index-enforced/inverted-index-join/ngram-fuzzyeq-jaccard_01.aql
@@ -53,7 +53,7 @@ write output to asterix_nc1:"rttest/inverted-index-join_ngram-fuzzyeq-jaccard_01
 set simfunction 'jaccard';
 set simthreshold '0.5f';
 
-for $a in dataset('DBLP')
 for $b in dataset('CSX')
+for $a in dataset('DBLP')
 where gram-tokens($a.title, 3, false) ~= gram-tokens($b.title, 3, false) and $a.id < $b.id
 return {"arec": $a, "brec": $b }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/d185e8ea/asterix-app/src/test/resources/optimizerts/queries/open-index-enforced/inverted-index-join/ngram-jaccard-check_01.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries/open-index-enforced/inverted-index-join/ngram-jaccard-check_01.aql b/asterix-app/src/test/resources/optimizerts/queries/open-index-enforced/inverted-index-join/ngram-jaccard-check_01.aql
index d5e033a..06d1a7b 100644
--- a/asterix-app/src/test/resources/optimizerts/queries/open-index-enforced/inverted-index-join/ngram-jaccard-check_01.aql
+++ b/asterix-app/src/test/resources/optimizerts/queries/open-index-enforced/inverted-index-join/ngram-jaccard-check_01.aql
@@ -50,8 +50,8 @@ create index ngram_index on DBLP(title:string) type ngram(3) enforced;
 
 write output to asterix_nc1:"rttest/inverted-index-join_ngram-jaccard-check_01.adm";
 
-for $a in dataset('DBLP')
 for $b in dataset('CSX')
+for $a in dataset('DBLP')
 where similarity-jaccard-check(gram-tokens($a.title, 3, false), gram-tokens($b.title, 3, false), 0.5f)[0]
       and $a.id < $b.id
 return {"arec": $a, "brec": $b }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/d185e8ea/asterix-app/src/test/resources/optimizerts/queries/open-index-enforced/inverted-index-join/ngram-jaccard_01.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries/open-index-enforced/inverted-index-join/ngram-jaccard_01.aql b/asterix-app/src/test/resources/optimizerts/queries/open-index-enforced/inverted-index-join/ngram-jaccard_01.aql
index 5877397..07773fa 100644
--- a/asterix-app/src/test/resources/optimizerts/queries/open-index-enforced/inverted-index-join/ngram-jaccard_01.aql
+++ b/asterix-app/src/test/resources/optimizerts/queries/open-index-enforced/inverted-index-join/ngram-jaccard_01.aql
@@ -50,8 +50,8 @@ create index ngram_index on DBLP(title:string) type ngram(3) enforced;
 
 write output to asterix_nc1:"rttest/inverted-index-join_ngram-jaccard_01.adm";
 
-for $a in dataset('DBLP')
 for $b in dataset('CSX')
+for $a in dataset('DBLP')
 where similarity-jaccard(gram-tokens($a.title, 3, false), gram-tokens($b.title, 3, false)) >= 0.5f
       and $a.id < $b.id
 return {"arec": $a, "brec": $b }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/d185e8ea/asterix-app/src/test/resources/optimizerts/queries/open-index-enforced/inverted-index-join/word-fuzzyeq-jaccard_01.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries/open-index-enforced/inverted-index-join/word-fuzzyeq-jaccard_01.aql b/asterix-app/src/test/resources/optimizerts/queries/open-index-enforced/inverted-index-join/word-fuzzyeq-jaccard_01.aql
index 2f46d9c..dd19d4e 100644
--- a/asterix-app/src/test/resources/optimizerts/queries/open-index-enforced/inverted-index-join/word-fuzzyeq-jaccard_01.aql
+++ b/asterix-app/src/test/resources/optimizerts/queries/open-index-enforced/inverted-index-join/word-fuzzyeq-jaccard_01.aql
@@ -52,7 +52,7 @@ write output to asterix_nc1:"rttest/inverted-index-join_word-fuzzyeq-jaccard_01.
 set simfunction 'jaccard';
 set simthreshold '0.5f';
 
-for $a in dataset('DBLP')
 for $b in dataset('CSX')
+for $a in dataset('DBLP')
 where word-tokens($a.title) ~= word-tokens($b.title) and $a.id < $b.id
 return {"arec": $a, "brec": $b }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/d185e8ea/asterix-app/src/test/resources/optimizerts/queries/open-index-enforced/inverted-index-join/word-jaccard-check_01.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries/open-index-enforced/inverted-index-join/word-jaccard-check_01.aql b/asterix-app/src/test/resources/optimizerts/queries/open-index-enforced/inverted-index-join/word-jaccard-check_01.aql
index 8857de5..c2f5903 100644
--- a/asterix-app/src/test/resources/optimizerts/queries/open-index-enforced/inverted-index-join/word-jaccard-check_01.aql
+++ b/asterix-app/src/test/resources/optimizerts/queries/open-index-enforced/inverted-index-join/word-jaccard-check_01.aql
@@ -49,8 +49,8 @@ create index keyword_index on DBLP(title:string) type keyword enforced;
 
 write output to asterix_nc1:"rttest/inverted-index-join_word-jaccard-check_01.adm";
 
-for $a in dataset('DBLP')
 for $b in dataset('CSX')
+for $a in dataset('DBLP')
 where similarity-jaccard-check(word-tokens($a.title), word-tokens($b.title), 0.5f)[0]
       and $a.id < $b.id
 return {"arec": $a, "brec": $b }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/d185e8ea/asterix-app/src/test/resources/optimizerts/queries/open-index-enforced/inverted-index-join/word-jaccard_01.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries/open-index-enforced/inverted-index-join/word-jaccard_01.aql b/asterix-app/src/test/resources/optimizerts/queries/open-index-enforced/inverted-index-join/word-jaccard_01.aql
index e7fb8d5..6b449b1 100644
--- a/asterix-app/src/test/resources/optimizerts/queries/open-index-enforced/inverted-index-join/word-jaccard_01.aql
+++ b/asterix-app/src/test/resources/optimizerts/queries/open-index-enforced/inverted-index-join/word-jaccard_01.aql
@@ -49,8 +49,8 @@ create index keyword_index on DBLP(title:string) type keyword enforced;
 
 write output to asterix_nc1:"rttest/inverted-index-join_word-jaccard_01.adm";
 
-for $a in dataset('DBLP')
 for $b in dataset('CSX')
+for $a in dataset('DBLP')
 where similarity-jaccard(word-tokens($a.title), word-tokens($b.title)) >= 0.5f
       and $a.id < $b.id
 return {"arec": $a, "brec": $b }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/d185e8ea/asterix-app/src/test/resources/optimizerts/queries/open-index-enforced/rtree-index-join/spatial-intersect-point_01.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries/open-index-enforced/rtree-index-join/spatial-intersect-point_01.aql b/asterix-app/src/test/resources/optimizerts/queries/open-index-enforced/rtree-index-join/spatial-intersect-point_01.aql
index 1b3bb3e..fd2fce1 100644
--- a/asterix-app/src/test/resources/optimizerts/queries/open-index-enforced/rtree-index-join/spatial-intersect-point_01.aql
+++ b/asterix-app/src/test/resources/optimizerts/queries/open-index-enforced/rtree-index-join/spatial-intersect-point_01.aql
@@ -55,7 +55,7 @@ create index rtree_index on MyData1(point:point) type rtree enforced;
 
 write output to asterix_nc1:"rttest/index-join_rtree-spatial-intersect-point.adm";
 
-for $a in dataset('MyData1')
 for $b in dataset('MyData2')
+for $a in dataset('MyData1')
 where spatial-intersect($a.point, $b.point)
 return {"a": $a, "b": $b}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/d185e8ea/asterix-app/src/test/resources/optimizerts/queries/rtree-index-join/spatial-intersect-point_01.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/optimizerts/queries/rtree-index-join/spatial-intersect-point_01.aql b/asterix-app/src/test/resources/optimizerts/queries/rtree-index-join/spatial-intersect-point_01.aql
index 58c1acc..4a82561 100644
--- a/asterix-app/src/test/resources/optimizerts/queries/rtree-index-join/spatial-intersect-point_01.aql
+++ b/asterix-app/src/test/resources/optimizerts/queries/rtree-index-join/spatial-intersect-point_01.aql
@@ -18,7 +18,7 @@
  */
 /*
  * Description    : Joins two datasets on the intersection of their point attributes.
- *                  The dataset 'MyData1' has an RTree index, and we expect the 
+ *                  The dataset 'MyData1' has an RTree index, and we expect the
  *                  join to be transformed into an indexed nested-loop join.
  * Success        : Yes
  */
@@ -45,7 +45,7 @@ create index rtree_index on MyData1(point) type rtree;
 
 write output to asterix_nc1:"rttest/index-join_rtree-spatial-intersect-point.adm";
 
-for $a in dataset('MyData1')
 for $b in dataset('MyData2')
+for $a in dataset('MyData1')
 where spatial-intersect($a.point, $b.point)
 return {"a": $a, "b": $b}



Mime
View raw message