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/inverted-index-join-noeqjoin/ngram-edit-distance.aql b/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join-noeqjoin/ngram-edit-distance.aql
index 991dd0b..6640508 100644
--- a/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join-noeqjoin/ngram-edit-distance.aql
+++ b/asterix-app/src/test/resources/optimizerts/queries/inverted-index-join-noeqjoin/ngram-edit-distance.aql
@@ -19,7 +19,7 @@
 /*
  * Description    : Fuzzy joins two datasets, DBLP and CSX, based on the edit-distance function of their authors.
  *                  DBLP has a 3-gram index on authors, and we expect the join to be transformed into an indexed nested-loop join.
- *                  We expect the top-level equi join introduced because of surrogate optimization to be removed, since it is not necessary. 
+ *                  We expect the top-level equi join introduced because of surrogate optimization to be removed, since it is not necessary.
  * Success        : Yes
  */
 
@@ -28,7 +28,7 @@
 use dataverse test;
 
 create type DBLPType as closed {
-  id: int32, 
+  id: int32,
   dblpid: string,
   title: string,
   authors: string,
@@ -36,7 +36,7 @@
 }
 
 create type CSXType as closed {
-  id: int32, 
+  id: int32,
   csxid: string,
   title: string,
   authors: string,
@@ -51,7 +51,7 @@
 
 write output to asterix_nc1:"rttest/inverted-index-join-noeqjoin_ngram-edit-distance.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 {"aauthors": $a.authors, "bauthors": $b.authors}