ASTERIXDB-920: Fixed consecutive index-nested-loop joins failure
Index-nested-loop join now tries to use an index from the inner relation first.
Change-Id: Ie7bcc70c19d2c1e70ce274eaacfe2c3ce89c8de8
Reviewed-on: https://asterix-gerrit.ics.uci.edu/434
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Yingyi Bu <buyingyi@gmail.com>
diff --git a/asterix-app/data/index-join/results.adm b/asterix-app/data/index-join/results.adm
new file mode 100644
index 0000000..6f04907
--- /dev/null
+++ b/asterix-app/data/index-join/results.adm
@@ -0,0 +1,8 @@
+{ "vertexid": 8, "rank": double("4.3815337979687034E-10d") }
+{ "vertexid": 9, "rank": double("4.3815337979687034E-10d") }
+{ "vertexid": 13, "rank": double("4.3815337979687034E-10d") }
+{ "vertexid": 17, "rank": double("4.3815337979687034E-10d") }
+{ "vertexid": 22, "rank": double("4.3815337979687034E-10d") }
+{ "vertexid": 24, "rank": double("4.3815337979687034E-10d") }
+{ "vertexid": 25, "rank": double("4.3815337979687034E-10d") }
+{ "vertexid": 34, "rank": double("4.3815337979687034E-10d") }
\ No newline at end of file
diff --git a/asterix-app/data/index-join/tw_messages.adm b/asterix-app/data/index-join/tw_messages.adm
new file mode 100644
index 0000000..445b84c
--- /dev/null
+++ b/asterix-app/data/index-join/tw_messages.adm
@@ -0,0 +1,13 @@
+{"tweetid":1,"user":"AaliyahAckerley@136","sender-location":point("35.65,84.93"),"send-time":datetime("2005-02-14T10:10:00"),"forward-from":-1,"retweet-from":-1,"referred-topics":{{"motorola","customer-service"}},"message-text":" like motorola the customer-service is amazing"}
+{"tweetid":2,"user":"VerniaHerndon_714","sender-location":point("45.37,82.91"),"send-time":datetime("2007-04-27T10:10:00"),"forward-from":-1,"retweet-from":-1,"referred-topics":{{"sprint","network"}},"message-text":" hate sprint its network is horrible:("}
+{"tweetid":3,"user":"VerniaHerndon_714","sender-location":point("31.54,73.22"),"send-time":datetime("2009-12-20T10:10:00"),"forward-from":-1,"retweet-from":-1,"referred-topics":{{"motorola","signal"}},"message-text":" love motorola the signal is good:)"}
+{"tweetid":4,"user":"VerniaHerndon_714","sender-location":point("35.64,71.08"),"send-time":datetime("2006-03-19T10:10:00"),"forward-from":-1,"retweet-from":-1,"referred-topics":{{"at&t","voicemail-service"}},"message-text":" like at&t its voicemail-service is awesome"}
+{"tweetid":5,"user":"VerniaHerndon_714","sender-location":point("40.69,92.3"),"send-time":datetime("2008-04-08T10:10:00"),"forward-from":-1,"retweet-from":-1,"referred-topics":{{"iphone","plan"}},"message-text":" love iphone the plan is amazing:)"}
+{"tweetid":6,"user":"VerniaHerndon_714","sender-location":point("35.53,97.61"),"send-time":datetime("2010-01-05T10:10:00"),"forward-from":-1,"retweet-from":-1,"referred-topics":{{"at&t","network"}},"message-text":" like at&t its network is good"}
+{"tweetid":7,"user":"VerniaHerndon_714","sender-location":point("25.29,85.77"),"send-time":datetime("2008-10-08T10:10:00"),"forward-from":-1,"retweet-from":-1,"referred-topics":{{"at&t","speed"}},"message-text":" can't stand at&t its speed is terrible:("}
+{"tweetid":8,"user":"VerniaHerndon_714","sender-location":point("26.08,83.01"),"send-time":datetime("2007-04-14T10:10:00"),"forward-from":8831723361,"retweet-from":-1,"referred-topics":{{"motorola","network"}},"message-text":" hate motorola the network is horrible"}
+{"tweetid":9,"user":"VerniaHerndon_714","sender-location":point("40.38,73.48"),"send-time":datetime("2006-10-10T10:10:00"),"forward-from":-1,"retweet-from":3258345607,"referred-topics":{{"verizon","shortcut-menu"}},"message-text":" love verizon the shortcut-menu is awesome:)"}
+{"tweetid":10,"user":"VerniaHerndon_714","sender-location":point("47.42,68.06"),"send-time":datetime("2011-11-18T10:10:00"),"forward-from":-1,"retweet-from":-1,"referred-topics":{{"samsung","customization"}},"message-text":" love samsung the customization is mind-blowing"}
+{"tweetid":11,"user":"VerniaHerndon_714","sender-location":point("27.95,95.22"),"send-time":datetime("2006-10-24T10:10:00"),"forward-from":-1,"retweet-from":-1,"referred-topics":{{"at&t","voice-clarity"}},"message-text":" dislike at&t the voice-clarity is bad"}
+{"tweetid":12,"user":"VerniaHerndon_714","sender-location":point("37.68,96.92"),"send-time":datetime("2007-06-28T10:10:00"),"forward-from":-1,"retweet-from":-1,"referred-topics":{{"samsung","customization"}},"message-text":" dislike samsung its customization is OMG:("}
+{"tweetid":13,"user":"VerniaHerndon_714","sender-location":point("33.25,67.32"),"send-time":datetime("2007-08-19T10:10:00"),"forward-from":1231614665,"retweet-from":-1,"referred-topics":{{"sprint","plan"}},"message-text":" love sprint the plan is good"}
\ No newline at end of file
diff --git a/asterix-app/data/index-join/tw_users.adm b/asterix-app/data/index-join/tw_users.adm
new file mode 100644
index 0000000..299adc3
--- /dev/null
+++ b/asterix-app/data/index-join/tw_users.adm
@@ -0,0 +1,12 @@
+{"screen-name":"AaliyahAckerley@136","lang":"en","friends_count":6148151,"statuses_count":131,"name":"Aaliyah Ackerley","followers_count":4843658}
+{"screen-name":"AaliyahAckerley_586","lang":"en","friends_count":14590365,"statuses_count":54,"name":"Aaliyah Ackerley","followers_count":1866794}
+{"screen-name":"AaliyahAdams#87","lang":"en","friends_count":3808840,"statuses_count":385,"name":"Aaliyah Adams","followers_count":7511412}
+{"screen-name":"AaliyahAdams#977","lang":"en","friends_count":11060186,"statuses_count":452,"name":"Aaliyah Adams","followers_count":240575}
+{"screen-name":"AaliyahAdams_995","lang":"en","friends_count":12240342,"statuses_count":466,"name":"Aaliyah Adams","followers_count":9042070}
+{"screen-name":"AaliyahAgg#257","lang":"en","friends_count":1787009,"statuses_count":49,"name":"Aaliyah Agg","followers_count":1368140}
+{"screen-name":"AaliyahAgg$544","lang":"en","friends_count":9576364,"statuses_count":14,"name":"Aaliyah Agg","followers_count":11032599}
+{"screen-name":"AaliyahAkers#573","lang":"en","friends_count":871157,"statuses_count":439,"name":"Aaliyah Akers","followers_count":10481754}
+{"screen-name":"AaliyahAlbright@317","lang":"en","friends_count":12759158,"statuses_count":257,"name":"Aaliyah Albright","followers_count":1769056}
+{"screen-name":"VerniaHerndon_714","lang":"en","friends_count":12388156,"statuses_count":448,"name":"Aaliyah Alcocke","followers_count":594008}
+{"screen-name":"AaliyahAlcocke_869","lang":"en","friends_count":2365292,"statuses_count":442,"name":"Aaliyah Alcocke","followers_count":8066644}
+{"screen-name":"AaliyahAlington@332","lang":"en","friends_count":9864476,"statuses_count":153,"name":"Aaliyah Alington","followers_count":3071616}
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-join/btree-index-nested-loop-join/btree-index-nested-loop-join.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/index-join/btree-index-nested-loop-join/btree-index-nested-loop-join.1.ddl.aql
new file mode 100644
index 0000000..cc8ba34
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/index-join/btree-index-nested-loop-join/btree-index-nested-loop-join.1.ddl.aql
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Description : Index Nested Loop Join on three datasets. Two index nested loop joins should be nested properly.
+ * Success : Yes
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+
+use dataverse test;
+
+create type TwitterUserType as {
+ screen-name: string,
+ lang: string,
+ friends_count: int32,
+ statuses_count: int32,
+ name: string,
+ followers_count: int32
+}
+
+create type TweetMessageType as {
+ tweetid: int64,
+ user: string,
+ sender-location: point,
+ send-time: datetime,
+ forward-from: int64,
+ retweet-from: int64,
+ referred-topics: {{ string }},
+ message-text: string
+}
+
+create type ResultType as {
+ vertexid: int64,
+ rank: double
+}
+
+create dataset TwitterUsers(TwitterUserType) primary key screen-name;
+
+create dataset TweetMessages(TweetMessageType) primary key tweetid;
+
+create dataset results(ResultType) primary key vertexid;
+
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-equi-join/btree-secondary-equi-join.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/index-join/btree-index-nested-loop-join/btree-index-nested-loop-join.2.update.aql
similarity index 64%
copy from asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-equi-join/btree-secondary-equi-join.2.update.aql
copy to asterix-app/src/test/resources/runtimets/queries/index-join/btree-index-nested-loop-join/btree-index-nested-loop-join.2.update.aql
index 2b3c126..a6b4348 100644
--- a/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-equi-join/btree-secondary-equi-join.2.update.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/index-join/btree-index-nested-loop-join/btree-index-nested-loop-join.2.update.aql
@@ -16,20 +16,20 @@
* specific language governing permissions and limitations
* under the License.
*/
-/*
- * Description : Equi joins two datasets, DBLP and CSX, based on their title.
- * DBLP has a secondary btree index on title, and given the 'indexnl' hint
- * we expect the join to be transformed into an indexed nested-loop join.
+ /*
+ * Description : Index Nested Loop Join on three datasets. Two index nested loop joins should be nested properly.
* Success : Yes
*/
+ use dataverse test;
-use dataverse test;
-
-load dataset DBLP
+load dataset TweetMessages
using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter"
-(("path"="nc1://data/pub-small/dblp-small-id.txt"),("format"="delimited-text"),("delimiter"=":"));
+(("path"="nc1://data/index-join/tw_messages.adm"),("format"="adm"));
-load dataset CSX
+load dataset TwitterUsers
using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter"
-(("path"="nc1://data/pub-small/csx-small-id.txt"),("format"="delimited-text"),("delimiter"=":"),("quote"="\u0000"));
+(("path"="nc1://data/index-join/tw_users.adm"),("format"="adm"));
+load dataset results
+using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/index-join/results.adm"),("format"="adm"));
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-equi-join/btree-secondary-equi-join.3.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/index-join/btree-index-nested-loop-join/btree-index-nested-loop-join.3.query.aql
similarity index 67%
copy from asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-equi-join/btree-secondary-equi-join.3.ddl.aql
copy to asterix-app/src/test/resources/runtimets/queries/index-join/btree-index-nested-loop-join/btree-index-nested-loop-join.3.query.aql
index 2cca7e7..6356191 100644
--- a/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-equi-join/btree-secondary-equi-join.3.ddl.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/index-join/btree-index-nested-loop-join/btree-index-nested-loop-join.3.query.aql
@@ -16,14 +16,18 @@
* specific language governing permissions and limitations
* under the License.
*/
-/*
- * Description : Equi joins two datasets, DBLP and CSX, based on their title.
- * DBLP has a secondary btree index on title, and given the 'indexnl' hint
- * we expect the join to be transformed into an indexed nested-loop join.
+ /*
+ * Description : Index Nested Loop Join on three datasets. Two index nested loop joins should be nested properly.
* Success : Yes
*/
+ use dataverse test;
-use dataverse test;
-
-create index title_index on DBLP(authors);
-
+for $tu in dataset TwitterUsers
+for $tm in dataset TweetMessages
+for $r in dataset results
+ where
+ $r.vertexid /*+ indexnl */ = $tm.tweetid
+ and
+ $tm.user /*+ indexnl */ = $tu.screen-name
+ order by $tm.tweetid
+ return $tm.tweetid;
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-equi-join/btree-secondary-equi-join.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-equi-join_01/btree-secondary-equi-join_01.1.ddl.aql
similarity index 91%
copy from asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-equi-join/btree-secondary-equi-join.1.ddl.aql
copy to asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-equi-join_01/btree-secondary-equi-join_01.1.ddl.aql
index 4c03b65..672a457 100644
--- a/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-equi-join/btree-secondary-equi-join.1.ddl.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-equi-join_01/btree-secondary-equi-join_01.1.ddl.aql
@@ -16,9 +16,9 @@
* specific language governing permissions and limitations
* under the License.
*/
-/*
- * Description : Equi joins two datasets, DBLP and CSX, based on their title.
- * DBLP has a secondary btree index on title, and given the 'indexnl' hint
+ /*
+ * Description : Equi joins two datasets, DBLP and CSX, based on their authors.
+ * DBLP has a secondary btree index on authors, and given the 'indexnl' hint
* we expect the join to be transformed into an indexed nested-loop join.
* Success : Yes
*/
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-equi-join/btree-secondary-equi-join.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-equi-join_01/btree-secondary-equi-join_01.2.update.aql
similarity index 91%
copy from asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-equi-join/btree-secondary-equi-join.2.update.aql
copy to asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-equi-join_01/btree-secondary-equi-join_01.2.update.aql
index 2b3c126..7a2f450 100644
--- a/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-equi-join/btree-secondary-equi-join.2.update.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-equi-join_01/btree-secondary-equi-join_01.2.update.aql
@@ -16,9 +16,9 @@
* specific language governing permissions and limitations
* under the License.
*/
-/*
- * Description : Equi joins two datasets, DBLP and CSX, based on their title.
- * DBLP has a secondary btree index on title, and given the 'indexnl' hint
+ /*
+ * Description : Equi joins two datasets, DBLP and CSX, based on their authors.
+ * DBLP has a secondary btree index on authors, and given the 'indexnl' hint
* we expect the join to be transformed into an indexed nested-loop join.
* Success : Yes
*/
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-equi-join/btree-secondary-equi-join.3.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-equi-join_01/btree-secondary-equi-join_01.3.ddl.aql
similarity index 86%
copy from asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-equi-join/btree-secondary-equi-join.3.ddl.aql
copy to asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-equi-join_01/btree-secondary-equi-join_01.3.ddl.aql
index 2cca7e7..f781be5 100644
--- a/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-equi-join/btree-secondary-equi-join.3.ddl.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-equi-join_01/btree-secondary-equi-join_01.3.ddl.aql
@@ -17,13 +17,13 @@
* under the License.
*/
/*
- * Description : Equi joins two datasets, DBLP and CSX, based on their title.
- * DBLP has a secondary btree index on title, and given the 'indexnl' hint
+ * Description : Equi joins two datasets, DBLP and CSX, based on their authors.
+ * DBLP has a secondary btree index on authors, and given the 'indexnl' hint
* we expect the join to be transformed into an indexed nested-loop join.
* Success : Yes
*/
use dataverse test;
-create index title_index on DBLP(authors);
+create index authors_index on DBLP(authors);
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-equi-join/btree-secondary-equi-join.4.query.aql b/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-equi-join_01/btree-secondary-equi-join_01.4.query.aql
similarity index 90%
rename from asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-equi-join/btree-secondary-equi-join.4.query.aql
rename to asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-equi-join_01/btree-secondary-equi-join_01.4.query.aql
index 040f319..a97a51a 100644
--- a/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-equi-join/btree-secondary-equi-join.4.query.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-equi-join_01/btree-secondary-equi-join_01.4.query.aql
@@ -17,8 +17,8 @@
* under the License.
*/
/*
- * Description : Equi joins two datasets, DBLP and CSX, based on their title.
- * DBLP has a secondary btree index on title, and given the 'indexnl' hint
+ * Description : Equi joins two datasets, DBLP and CSX, based on their authors.
+ * DBLP has a secondary btree index on authors, and given the 'indexnl' hint
* we expect the join to be transformed into an indexed nested-loop join.
* Success : Yes
*/
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-equi-join/btree-secondary-equi-join.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-equi-join_02/btree-secondary-equi-join_02.1.ddl.aql
similarity index 92%
rename from asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-equi-join/btree-secondary-equi-join.1.ddl.aql
rename to asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-equi-join_02/btree-secondary-equi-join_02.1.ddl.aql
index 4c03b65..bfc50ec 100644
--- a/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-equi-join/btree-secondary-equi-join.1.ddl.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-equi-join_02/btree-secondary-equi-join_02.1.ddl.aql
@@ -17,8 +17,8 @@
* under the License.
*/
/*
- * Description : Equi joins two datasets, DBLP and CSX, based on their title.
- * DBLP has a secondary btree index on title, and given the 'indexnl' hint
+ * Description : Equi joins two datasets, DBLP and CSX, based on their authors.
+ * CSX has a secondary btree index on authors, and given the 'indexnl' hint
* we expect the join to be transformed into an indexed nested-loop join.
* Success : Yes
*/
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-equi-join/btree-secondary-equi-join.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-equi-join_02/btree-secondary-equi-join_02.2.update.aql
similarity index 92%
rename from asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-equi-join/btree-secondary-equi-join.2.update.aql
rename to asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-equi-join_02/btree-secondary-equi-join_02.2.update.aql
index 2b3c126..384ce3c 100644
--- a/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-equi-join/btree-secondary-equi-join.2.update.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-equi-join_02/btree-secondary-equi-join_02.2.update.aql
@@ -17,8 +17,8 @@
* under the License.
*/
/*
- * Description : Equi joins two datasets, DBLP and CSX, based on their title.
- * DBLP has a secondary btree index on title, and given the 'indexnl' hint
+ * Description : Equi joins two datasets, DBLP and CSX, based on their authors.
+ * CSX has a secondary btree index on authors, and given the 'indexnl' hint
* we expect the join to be transformed into an indexed nested-loop join.
* Success : Yes
*/
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-equi-join/btree-secondary-equi-join.3.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-equi-join_02/btree-secondary-equi-join_02.3.ddl.aql
similarity index 86%
rename from asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-equi-join/btree-secondary-equi-join.3.ddl.aql
rename to asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-equi-join_02/btree-secondary-equi-join_02.3.ddl.aql
index 2cca7e7..79467ab 100644
--- a/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-equi-join/btree-secondary-equi-join.3.ddl.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-equi-join_02/btree-secondary-equi-join_02.3.ddl.aql
@@ -17,13 +17,13 @@
* under the License.
*/
/*
- * Description : Equi joins two datasets, DBLP and CSX, based on their title.
- * DBLP has a secondary btree index on title, and given the 'indexnl' hint
+ * Description : Equi joins two datasets, DBLP and CSX, based on their authors.
+ * CSX has a secondary btree index on authors, and given the 'indexnl' hint
* we expect the join to be transformed into an indexed nested-loop join.
* Success : Yes
*/
use dataverse test;
-create index title_index on DBLP(authors);
+create index authors_index on CSX(authors);
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-equi-join/btree-secondary-equi-join.4.query.aql b/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-equi-join_02/btree-secondary-equi-join_02.4.query.aql
similarity index 90%
copy from asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-equi-join/btree-secondary-equi-join.4.query.aql
copy to asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-equi-join_02/btree-secondary-equi-join_02.4.query.aql
index 040f319..42423a3 100644
--- a/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-equi-join/btree-secondary-equi-join.4.query.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-equi-join_02/btree-secondary-equi-join_02.4.query.aql
@@ -17,8 +17,8 @@
* under the License.
*/
/*
- * Description : Equi joins two datasets, DBLP and CSX, based on their title.
- * DBLP has a secondary btree index on title, and given the 'indexnl' hint
+ * Description : Equi joins two datasets, DBLP and CSX, based on their authors.
+ * CSX has a secondary btree index on authors, and given the 'indexnl' hint
* we expect the join to be transformed into an indexed nested-loop join.
* Success : Yes
*/
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-equi-join/btree-secondary-equi-join.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-equi-join_03/btree-secondary-equi-join_03.1.ddl.aql
similarity index 84%
copy from asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-equi-join/btree-secondary-equi-join.1.ddl.aql
copy to asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-equi-join_03/btree-secondary-equi-join_03.1.ddl.aql
index 4c03b65..c7597c2 100644
--- a/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-equi-join/btree-secondary-equi-join.1.ddl.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-equi-join_03/btree-secondary-equi-join_03.1.ddl.aql
@@ -17,9 +17,10 @@
* under the License.
*/
/*
- * Description : Equi joins two datasets, DBLP and CSX, based on their title.
- * DBLP has a secondary btree index on title, and given the 'indexnl' hint
+ * Description : Equi joins two datasets, DBLP and CSX, based on their authors.
+ * Both datasets have a secondary btree index on authors. So, given the 'indexnl' hint
* we expect the join to be transformed into an indexed nested-loop join.
+ * (outer relation: the first relation described in the for-loop, inner relation: the other relation)
* Success : Yes
*/
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-equi-join/btree-secondary-equi-join.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-equi-join_03/btree-secondary-equi-join_03.2.update.aql
similarity index 84%
copy from asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-equi-join/btree-secondary-equi-join.2.update.aql
copy to asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-equi-join_03/btree-secondary-equi-join_03.2.update.aql
index 2b3c126..d6d3ace 100644
--- a/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-equi-join/btree-secondary-equi-join.2.update.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-equi-join_03/btree-secondary-equi-join_03.2.update.aql
@@ -17,9 +17,10 @@
* under the License.
*/
/*
- * Description : Equi joins two datasets, DBLP and CSX, based on their title.
- * DBLP has a secondary btree index on title, and given the 'indexnl' hint
+ * Description : Equi joins two datasets, DBLP and CSX, based on their authors.
+ * Both datasets have a secondary btree index on authors. So, given the 'indexnl' hint
* we expect the join to be transformed into an indexed nested-loop join.
+ * (outer relation: the first relation described in the for-loop, inner relation: the other relation)
* Success : Yes
*/
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-equi-join/btree-secondary-equi-join.3.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-equi-join_03/btree-secondary-equi-join_03.3.ddl.aql
similarity index 74%
copy from asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-equi-join/btree-secondary-equi-join.3.ddl.aql
copy to asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-equi-join_03/btree-secondary-equi-join_03.3.ddl.aql
index 2cca7e7..776bd87 100644
--- a/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-equi-join/btree-secondary-equi-join.3.ddl.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-equi-join_03/btree-secondary-equi-join_03.3.ddl.aql
@@ -17,13 +17,15 @@
* under the License.
*/
/*
- * Description : Equi joins two datasets, DBLP and CSX, based on their title.
- * DBLP has a secondary btree index on title, and given the 'indexnl' hint
+ * Description : Equi joins two datasets, DBLP and CSX, based on their authors.
+ * Both datasets have a secondary btree index on authors. So, given the 'indexnl' hint
* we expect the join to be transformed into an indexed nested-loop join.
+ * (outer relation: the first relation described in the for-loop, inner relation: the other relation)
* Success : Yes
*/
use dataverse test;
-create index title_index on DBLP(authors);
+create index CSX_authors_index on CSX(authors);
+create index DBLP_authors_index on DBLP(authors);
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-equi-join/btree-secondary-equi-join.4.query.aql b/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-equi-join_03/btree-secondary-equi-join_03.4.query.aql
similarity index 82%
copy from asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-equi-join/btree-secondary-equi-join.4.query.aql
copy to asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-equi-join_03/btree-secondary-equi-join_03.4.query.aql
index 040f319..ed3cd7e 100644
--- a/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-equi-join/btree-secondary-equi-join.4.query.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-equi-join_03/btree-secondary-equi-join_03.4.query.aql
@@ -17,9 +17,10 @@
* under the License.
*/
/*
- * Description : Equi joins two datasets, DBLP and CSX, based on their title.
- * DBLP has a secondary btree index on title, and given the 'indexnl' hint
+ * Description : Equi joins two datasets, DBLP and CSX, based on their authors.
+ * Both datasets have a secondary btree index on authors. So, given the 'indexnl' hint
* we expect the join to be transformed into an indexed nested-loop join.
+ * (outer relation: the first relation described in the for-loop, inner relation: the other relation)
* Success : Yes
*/
diff --git a/asterix-app/src/test/resources/runtimets/results/index-join/btree-index-nested-loop-join/btree-index-nested-loop-join.1.adm b/asterix-app/src/test/resources/runtimets/results/index-join/btree-index-nested-loop-join/btree-index-nested-loop-join.1.adm
new file mode 100644
index 0000000..4f7a33a
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/index-join/btree-index-nested-loop-join/btree-index-nested-loop-join.1.adm
@@ -0,0 +1,4 @@
+[ 8
+, 9
+, 13
+ ]
diff --git a/asterix-app/src/test/resources/runtimets/results/index-join/btree-secondary-equi-join/btree-secondary-equi-join.1.adm b/asterix-app/src/test/resources/runtimets/results/index-join/btree-secondary-equi-join_01/btree-secondary-equi-join_01.1.adm
similarity index 100%
rename from asterix-app/src/test/resources/runtimets/results/index-join/btree-secondary-equi-join/btree-secondary-equi-join.1.adm
rename to asterix-app/src/test/resources/runtimets/results/index-join/btree-secondary-equi-join_01/btree-secondary-equi-join_01.1.adm
diff --git a/asterix-app/src/test/resources/runtimets/results/index-join/btree-secondary-equi-join/btree-secondary-equi-join.1.adm b/asterix-app/src/test/resources/runtimets/results/index-join/btree-secondary-equi-join_02/btree-secondary-equi-join_02.1.adm
similarity index 100%
copy from asterix-app/src/test/resources/runtimets/results/index-join/btree-secondary-equi-join/btree-secondary-equi-join.1.adm
copy to asterix-app/src/test/resources/runtimets/results/index-join/btree-secondary-equi-join_02/btree-secondary-equi-join_02.1.adm
diff --git a/asterix-app/src/test/resources/runtimets/results/index-join/btree-secondary-equi-join/btree-secondary-equi-join.1.adm b/asterix-app/src/test/resources/runtimets/results/index-join/btree-secondary-equi-join_03/btree-secondary-equi-join_03.1.adm
similarity index 100%
copy from asterix-app/src/test/resources/runtimets/results/index-join/btree-secondary-equi-join/btree-secondary-equi-join.1.adm
copy to asterix-app/src/test/resources/runtimets/results/index-join/btree-secondary-equi-join_03/btree-secondary-equi-join_03.1.adm
diff --git a/asterix-app/src/test/resources/runtimets/testsuite.xml b/asterix-app/src/test/resources/runtimets/testsuite.xml
index d706feb..ba471cb 100644
--- a/asterix-app/src/test/resources/runtimets/testsuite.xml
+++ b/asterix-app/src/test/resources/runtimets/testsuite.xml
@@ -2479,13 +2479,28 @@
</test-group> -->
<test-group name="index-join">
<test-case FilePath="index-join">
+ <compilation-unit name="btree-index-nested-loop-join">
+ <output-dir compare="Text">btree-index-nested-loop-join</output-dir>
+ </compilation-unit>
+ </test-case>
+ <test-case FilePath="index-join">
<compilation-unit name="btree-primary-equi-join">
<output-dir compare="Text">btree-primary-equi-join</output-dir>
</compilation-unit>
</test-case>
<test-case FilePath="index-join">
- <compilation-unit name="btree-secondary-equi-join">
- <output-dir compare="Text">btree-secondary-equi-join</output-dir>
+ <compilation-unit name="btree-secondary-equi-join_01">
+ <output-dir compare="Text">btree-secondary-equi-join_01</output-dir>
+ </compilation-unit>
+ </test-case>
+ <test-case FilePath="index-join">
+ <compilation-unit name="btree-secondary-equi-join_02">
+ <output-dir compare="Text">btree-secondary-equi-join_02</output-dir>
+ </compilation-unit>
+ </test-case>
+ <test-case FilePath="index-join">
+ <compilation-unit name="btree-secondary-equi-join_03">
+ <output-dir compare="Text">btree-secondary-equi-join_03</output-dir>
</compilation-unit>
</test-case>
<test-case FilePath="index-join">