You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@asterixdb.apache.org by wa...@apache.org on 2018/03/10 17:27:22 UTC

[08/12] asterixdb git commit: [NO ISSUE][COMP][RT] Rename index-only test case files

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/06cec01b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-primary-to-secondary-indexonly-plan-equi-join_01/btree-pidx-to-sidx-idxonly-equi-join_01.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-primary-to-secondary-indexonly-plan-equi-join_01/btree-pidx-to-sidx-idxonly-equi-join_01.1.ddl.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-primary-to-secondary-indexonly-plan-equi-join_01/btree-pidx-to-sidx-idxonly-equi-join_01.1.ddl.aql
new file mode 100644
index 0000000..efa4aee
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-primary-to-secondary-indexonly-plan-equi-join_01/btree-pidx-to-sidx-idxonly-equi-join_01.1.ddl.aql
@@ -0,0 +1,64 @@
+/*
+ * 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    : Equi joins two datasets, Customers and Orders, based on the customer id.
+ *                  Given the 'indexnl' hint we expect the join to be transformed
+ *                  into an indexed nested-loop join using Orders' secondary index.
+ * Success        : Yes
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+
+use dataverse test;
+
+create type AddressType as open {
+  number: int64,
+  street: string,
+  city: string
+}
+
+create type CustomerType as closed {
+  cid: int64,
+  name: string,
+  cashBack: int64,
+  age: int64?,
+  address: AddressType?,
+  lastorder: {
+    oid: int64,
+    total: float
+  }
+}
+
+create type OrderType as open {
+  oid: int64,
+  cid: int64,
+  orderstatus: string,
+  orderpriority: string,
+  clerk: string,
+  total: float,
+  items: [int64]
+}
+
+create dataset Customers(CustomerType) primary key cid;
+create dataset Orders(OrderType) primary key oid;
+
+create index CustomerID_idx on Orders(cid);
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/06cec01b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-primary-to-secondary-indexonly-plan-equi-join_01/btree-pidx-to-sidx-idxonly-equi-join_01.2.update.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-primary-to-secondary-indexonly-plan-equi-join_01/btree-pidx-to-sidx-idxonly-equi-join_01.2.update.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-primary-to-secondary-indexonly-plan-equi-join_01/btree-pidx-to-sidx-idxonly-equi-join_01.2.update.aql
new file mode 100644
index 0000000..3bee139
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-primary-to-secondary-indexonly-plan-equi-join_01/btree-pidx-to-sidx-idxonly-equi-join_01.2.update.aql
@@ -0,0 +1,36 @@
+/*
+ * 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    : Equi joins two datasets, Customers and Orders, based on the customer id.
+ *                  Given the 'indexnl' hint we expect the join to be transformed
+ *                  into an indexed nested-loop join using Orders' secondary index.
+ * Success        : Yes
+ */
+
+use dataverse test;
+
+load dataset Customers
+using localfs
+(("path"="asterix_nc1://data/nontagged/customerData.json"),("format"="adm"));
+
+load dataset Orders
+using localfs
+(("path"="asterix_nc1://data/nontagged/orderData.json"),("format"="adm"));
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/06cec01b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-primary-to-secondary-indexonly-plan-equi-join_01/btree-pidx-to-sidx-idxonly-equi-join_01.3.query.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-primary-to-secondary-indexonly-plan-equi-join_01/btree-pidx-to-sidx-idxonly-equi-join_01.3.query.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-primary-to-secondary-indexonly-plan-equi-join_01/btree-pidx-to-sidx-idxonly-equi-join_01.3.query.aql
new file mode 100644
index 0000000..8ee1f18
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-primary-to-secondary-indexonly-plan-equi-join_01/btree-pidx-to-sidx-idxonly-equi-join_01.3.query.aql
@@ -0,0 +1,34 @@
+/*
+ * 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    : Equi joins two datasets, Customers and Orders, based on the customer id.
+ *                  Given the 'indexnl' hint we expect the join to be transformed
+ *                  into an indexed nested-loop join using Orders' secondary index.
+ * Success        : Yes
+ */
+
+use dataverse test;
+
+count(
+for $c in dataset('Customers')
+for $o in dataset('Orders')
+where $c.cid /*+ indexnl */ = $o.cid
+return {"oid": $o.oid, "cid":$c.cid}
+);

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/06cec01b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-primary-to-secondary-indexonly-plan-equi-join_01/btree-primary-to-secondary-indexonly-plan-equi-join_01.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-primary-to-secondary-indexonly-plan-equi-join_01/btree-primary-to-secondary-indexonly-plan-equi-join_01.1.ddl.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-primary-to-secondary-indexonly-plan-equi-join_01/btree-primary-to-secondary-indexonly-plan-equi-join_01.1.ddl.aql
deleted file mode 100644
index efa4aee..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-primary-to-secondary-indexonly-plan-equi-join_01/btree-primary-to-secondary-indexonly-plan-equi-join_01.1.ddl.aql
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * 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    : Equi joins two datasets, Customers and Orders, based on the customer id.
- *                  Given the 'indexnl' hint we expect the join to be transformed
- *                  into an indexed nested-loop join using Orders' secondary index.
- * Success        : Yes
- */
-
-drop dataverse test if exists;
-create dataverse test;
-
-use dataverse test;
-
-create type AddressType as open {
-  number: int64,
-  street: string,
-  city: string
-}
-
-create type CustomerType as closed {
-  cid: int64,
-  name: string,
-  cashBack: int64,
-  age: int64?,
-  address: AddressType?,
-  lastorder: {
-    oid: int64,
-    total: float
-  }
-}
-
-create type OrderType as open {
-  oid: int64,
-  cid: int64,
-  orderstatus: string,
-  orderpriority: string,
-  clerk: string,
-  total: float,
-  items: [int64]
-}
-
-create dataset Customers(CustomerType) primary key cid;
-create dataset Orders(OrderType) primary key oid;
-
-create index CustomerID_idx on Orders(cid);
-

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/06cec01b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-primary-to-secondary-indexonly-plan-equi-join_01/btree-primary-to-secondary-indexonly-plan-equi-join_01.2.update.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-primary-to-secondary-indexonly-plan-equi-join_01/btree-primary-to-secondary-indexonly-plan-equi-join_01.2.update.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-primary-to-secondary-indexonly-plan-equi-join_01/btree-primary-to-secondary-indexonly-plan-equi-join_01.2.update.aql
deleted file mode 100644
index 3bee139..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-primary-to-secondary-indexonly-plan-equi-join_01/btree-primary-to-secondary-indexonly-plan-equi-join_01.2.update.aql
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * 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    : Equi joins two datasets, Customers and Orders, based on the customer id.
- *                  Given the 'indexnl' hint we expect the join to be transformed
- *                  into an indexed nested-loop join using Orders' secondary index.
- * Success        : Yes
- */
-
-use dataverse test;
-
-load dataset Customers
-using localfs
-(("path"="asterix_nc1://data/nontagged/customerData.json"),("format"="adm"));
-
-load dataset Orders
-using localfs
-(("path"="asterix_nc1://data/nontagged/orderData.json"),("format"="adm"));
-

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/06cec01b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-primary-to-secondary-indexonly-plan-equi-join_01/btree-primary-to-secondary-indexonly-plan-equi-join_01.3.query.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-primary-to-secondary-indexonly-plan-equi-join_01/btree-primary-to-secondary-indexonly-plan-equi-join_01.3.query.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-primary-to-secondary-indexonly-plan-equi-join_01/btree-primary-to-secondary-indexonly-plan-equi-join_01.3.query.aql
deleted file mode 100644
index 8ee1f18..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-primary-to-secondary-indexonly-plan-equi-join_01/btree-primary-to-secondary-indexonly-plan-equi-join_01.3.query.aql
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * 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    : Equi joins two datasets, Customers and Orders, based on the customer id.
- *                  Given the 'indexnl' hint we expect the join to be transformed
- *                  into an indexed nested-loop join using Orders' secondary index.
- * Success        : Yes
- */
-
-use dataverse test;
-
-count(
-for $c in dataset('Customers')
-for $o in dataset('Orders')
-where $c.cid /*+ indexnl */ = $o.cid
-return {"oid": $o.oid, "cid":$c.cid}
-);

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/06cec01b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-indexonly-plan-to-primary-equi-join_01/btree-secondary-indexonly-plan-to-primary-equi-join_01.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-indexonly-plan-to-primary-equi-join_01/btree-secondary-indexonly-plan-to-primary-equi-join_01.1.ddl.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-indexonly-plan-to-primary-equi-join_01/btree-secondary-indexonly-plan-to-primary-equi-join_01.1.ddl.aql
deleted file mode 100644
index 875820d..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-indexonly-plan-to-primary-equi-join_01/btree-secondary-indexonly-plan-to-primary-equi-join_01.1.ddl.aql
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * 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    : Equi joins two datasets, Customers and Orders, based on the customer id.
- *                  Given the 'indexnl' hint we expect the join to be transformed
- *                  into an indexed nested-loop join using Customers' primary index.
- * Success        : Yes
- */
-
-drop dataverse test if exists;
-create dataverse test;
-
-use dataverse test;
-
-create type AddressType as open {
-  number: int64,
-  street: string,
-  city: string
-}
-
-create type CustomerType as closed {
-  cid: int64,
-  name: string,
-  cashBack: int64,
-  age: int64?,
-  address: AddressType?,
-  lastorder: {
-    oid: int64,
-    total: float
-  }
-}
-
-create type OrderType as open {
-  oid: int64,
-  cid: int64,
-  orderstatus: string,
-  orderpriority: string,
-  clerk: string,
-  total: float,
-  items: [int64]
-}
-
-create dataset Customers(CustomerType) primary key cid;
-create dataset Orders(OrderType) primary key oid;
-
-create index CustomerID_idx on Orders(cid);
-

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/06cec01b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-indexonly-plan-to-primary-equi-join_01/btree-secondary-indexonly-plan-to-primary-equi-join_01.2.update.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-indexonly-plan-to-primary-equi-join_01/btree-secondary-indexonly-plan-to-primary-equi-join_01.2.update.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-indexonly-plan-to-primary-equi-join_01/btree-secondary-indexonly-plan-to-primary-equi-join_01.2.update.aql
deleted file mode 100644
index 0605ade..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-indexonly-plan-to-primary-equi-join_01/btree-secondary-indexonly-plan-to-primary-equi-join_01.2.update.aql
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * 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.
- */
-
-use dataverse test;
-
-load dataset Customers
-using localfs
-(("path"="asterix_nc1://data/nontagged/customerData.json"),("format"="adm"));
-
-load dataset Orders
-using localfs
-(("path"="asterix_nc1://data/nontagged/orderData.json"),("format"="adm"));
-

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/06cec01b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-indexonly-plan-to-primary-equi-join_01/btree-secondary-indexonly-plan-to-primary-equi-join_01.3.query.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-indexonly-plan-to-primary-equi-join_01/btree-secondary-indexonly-plan-to-primary-equi-join_01.3.query.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-indexonly-plan-to-primary-equi-join_01/btree-secondary-indexonly-plan-to-primary-equi-join_01.3.query.aql
deleted file mode 100644
index c6f1303..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-indexonly-plan-to-primary-equi-join_01/btree-secondary-indexonly-plan-to-primary-equi-join_01.3.query.aql
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * 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.
- */
-
-use dataverse test;
-
-count(
-for $o in dataset('Orders')
-for $c in dataset('Customers')
-where $o.cid < 800 and $o.cid /*+ indexnl */ = $c.cid
-return {"oid": $o.oid, "cid":$c.cid}
-);

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/06cec01b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-indexonly-plan-to-primary-equi-join_01/btree-sidx-idxonly-to-pidx-equi-join_01.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-indexonly-plan-to-primary-equi-join_01/btree-sidx-idxonly-to-pidx-equi-join_01.1.ddl.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-indexonly-plan-to-primary-equi-join_01/btree-sidx-idxonly-to-pidx-equi-join_01.1.ddl.aql
new file mode 100644
index 0000000..875820d
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-indexonly-plan-to-primary-equi-join_01/btree-sidx-idxonly-to-pidx-equi-join_01.1.ddl.aql
@@ -0,0 +1,63 @@
+/*
+ * 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    : Equi joins two datasets, Customers and Orders, based on the customer id.
+ *                  Given the 'indexnl' hint we expect the join to be transformed
+ *                  into an indexed nested-loop join using Customers' primary index.
+ * Success        : Yes
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+
+use dataverse test;
+
+create type AddressType as open {
+  number: int64,
+  street: string,
+  city: string
+}
+
+create type CustomerType as closed {
+  cid: int64,
+  name: string,
+  cashBack: int64,
+  age: int64?,
+  address: AddressType?,
+  lastorder: {
+    oid: int64,
+    total: float
+  }
+}
+
+create type OrderType as open {
+  oid: int64,
+  cid: int64,
+  orderstatus: string,
+  orderpriority: string,
+  clerk: string,
+  total: float,
+  items: [int64]
+}
+
+create dataset Customers(CustomerType) primary key cid;
+create dataset Orders(OrderType) primary key oid;
+
+create index CustomerID_idx on Orders(cid);
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/06cec01b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-indexonly-plan-to-primary-equi-join_01/btree-sidx-idxonly-to-pidx-equi-join_01.2.update.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-indexonly-plan-to-primary-equi-join_01/btree-sidx-idxonly-to-pidx-equi-join_01.2.update.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-indexonly-plan-to-primary-equi-join_01/btree-sidx-idxonly-to-pidx-equi-join_01.2.update.aql
new file mode 100644
index 0000000..0605ade
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-indexonly-plan-to-primary-equi-join_01/btree-sidx-idxonly-to-pidx-equi-join_01.2.update.aql
@@ -0,0 +1,29 @@
+/*
+ * 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.
+ */
+
+use dataverse test;
+
+load dataset Customers
+using localfs
+(("path"="asterix_nc1://data/nontagged/customerData.json"),("format"="adm"));
+
+load dataset Orders
+using localfs
+(("path"="asterix_nc1://data/nontagged/orderData.json"),("format"="adm"));
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/06cec01b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-indexonly-plan-to-primary-equi-join_01/btree-sidx-idxonly-to-pidx-equi-join_01.3.query.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-indexonly-plan-to-primary-equi-join_01/btree-sidx-idxonly-to-pidx-equi-join_01.3.query.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-indexonly-plan-to-primary-equi-join_01/btree-sidx-idxonly-to-pidx-equi-join_01.3.query.aql
new file mode 100644
index 0000000..c6f1303
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-indexonly-plan-to-primary-equi-join_01/btree-sidx-idxonly-to-pidx-equi-join_01.3.query.aql
@@ -0,0 +1,27 @@
+/*
+ * 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.
+ */
+
+use dataverse test;
+
+count(
+for $o in dataset('Orders')
+for $c in dataset('Customers')
+where $o.cid < 800 and $o.cid /*+ indexnl */ = $c.cid
+return {"oid": $o.oid, "cid":$c.cid}
+);

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/06cec01b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-indexonly-plan-to-secondary-indexonly-plan-equi-join_01/btree-secondary-indexonly-plan-to-secondary-indexonly-plan-equi-join_01.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-indexonly-plan-to-secondary-indexonly-plan-equi-join_01/btree-secondary-indexonly-plan-to-secondary-indexonly-plan-equi-join_01.1.ddl.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-indexonly-plan-to-secondary-indexonly-plan-equi-join_01/btree-secondary-indexonly-plan-to-secondary-indexonly-plan-equi-join_01.1.ddl.aql
deleted file mode 100644
index 476185a..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-indexonly-plan-to-secondary-indexonly-plan-equi-join_01/btree-secondary-indexonly-plan-to-secondary-indexonly-plan-equi-join_01.1.ddl.aql
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * 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    : Equi joins two datasets, Customers and Orders, based on the customer id.
- *                  Given the 'indexnl' hint we expect the join to be transformed
- *                  into an indexed nested-loop join using Orders' secondary index.
- *                  Each branch (outer and inner) will be transformed as an index-only plan.
- * Success        : Yes
- */
-
-drop dataverse test if exists;
-create dataverse test;
-
-use dataverse test;
-
-create type AddressType as open {
-  number: int64,
-  street: string,
-  city: string
-}
-
-create type CustomerType as closed {
-  cid: int64,
-  name: string,
-  cashBack: int64,
-  age: int64?,
-  address: AddressType?,
-  lastorder: {
-    oid: int64,
-    total: float
-  }
-}
-
-create type OrderType as open {
-  oid: int64,
-  cid: int64,
-  orderstatus: string,
-  orderpriority: string,
-  clerk: string,
-  total: float,
-  items: [int64]
-}
-
-create dataset Customers(CustomerType) primary key cid;
-create dataset Orders(OrderType) primary key oid;
-
-create index CustomerID_idx on Orders(cid);
-create index Cashback_idx on Customers(cashBack);

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/06cec01b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-indexonly-plan-to-secondary-indexonly-plan-equi-join_01/btree-secondary-indexonly-plan-to-secondary-indexonly-plan-equi-join_01.2.update.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-indexonly-plan-to-secondary-indexonly-plan-equi-join_01/btree-secondary-indexonly-plan-to-secondary-indexonly-plan-equi-join_01.2.update.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-indexonly-plan-to-secondary-indexonly-plan-equi-join_01/btree-secondary-indexonly-plan-to-secondary-indexonly-plan-equi-join_01.2.update.aql
deleted file mode 100644
index 461f5c2..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-indexonly-plan-to-secondary-indexonly-plan-equi-join_01/btree-secondary-indexonly-plan-to-secondary-indexonly-plan-equi-join_01.2.update.aql
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * 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.
- */
-
-use dataverse test;
-
-load dataset Customers
-using localfs
-(("path"="asterix_nc1://data/nontagged/customerData2.json"),("format"="adm"));
-
-load dataset Orders
-using localfs
-(("path"="asterix_nc1://data/nontagged/orderData.json"),("format"="adm"));
-

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/06cec01b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-indexonly-plan-to-secondary-indexonly-plan-equi-join_01/btree-secondary-indexonly-plan-to-secondary-indexonly-plan-equi-join_01.3.query.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-indexonly-plan-to-secondary-indexonly-plan-equi-join_01/btree-secondary-indexonly-plan-to-secondary-indexonly-plan-equi-join_01.3.query.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-indexonly-plan-to-secondary-indexonly-plan-equi-join_01/btree-secondary-indexonly-plan-to-secondary-indexonly-plan-equi-join_01.3.query.aql
deleted file mode 100644
index 2066c68..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-indexonly-plan-to-secondary-indexonly-plan-equi-join_01/btree-secondary-indexonly-plan-to-secondary-indexonly-plan-equi-join_01.3.query.aql
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * 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.
- */
-
-use dataverse test;
-
-count(
-for $o in dataset('Orders')
-for $c in dataset('Customers')
-where $o.cid < 100000 and $o.cid /*+ indexnl */ = $c.cashBack
-return {"oid": $o.oid, "cid":$c.cid}
-);

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/06cec01b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-indexonly-plan-to-secondary-indexonly-plan-equi-join_01/btree-sidx-idxonly-to-sidx-idxonly-equi-join_01.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-indexonly-plan-to-secondary-indexonly-plan-equi-join_01/btree-sidx-idxonly-to-sidx-idxonly-equi-join_01.1.ddl.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-indexonly-plan-to-secondary-indexonly-plan-equi-join_01/btree-sidx-idxonly-to-sidx-idxonly-equi-join_01.1.ddl.aql
new file mode 100644
index 0000000..476185a
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-indexonly-plan-to-secondary-indexonly-plan-equi-join_01/btree-sidx-idxonly-to-sidx-idxonly-equi-join_01.1.ddl.aql
@@ -0,0 +1,65 @@
+/*
+ * 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    : Equi joins two datasets, Customers and Orders, based on the customer id.
+ *                  Given the 'indexnl' hint we expect the join to be transformed
+ *                  into an indexed nested-loop join using Orders' secondary index.
+ *                  Each branch (outer and inner) will be transformed as an index-only plan.
+ * Success        : Yes
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+
+use dataverse test;
+
+create type AddressType as open {
+  number: int64,
+  street: string,
+  city: string
+}
+
+create type CustomerType as closed {
+  cid: int64,
+  name: string,
+  cashBack: int64,
+  age: int64?,
+  address: AddressType?,
+  lastorder: {
+    oid: int64,
+    total: float
+  }
+}
+
+create type OrderType as open {
+  oid: int64,
+  cid: int64,
+  orderstatus: string,
+  orderpriority: string,
+  clerk: string,
+  total: float,
+  items: [int64]
+}
+
+create dataset Customers(CustomerType) primary key cid;
+create dataset Orders(OrderType) primary key oid;
+
+create index CustomerID_idx on Orders(cid);
+create index Cashback_idx on Customers(cashBack);

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/06cec01b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-indexonly-plan-to-secondary-indexonly-plan-equi-join_01/btree-sidx-idxonly-to-sidx-idxonly-equi-join_01.2.update.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-indexonly-plan-to-secondary-indexonly-plan-equi-join_01/btree-sidx-idxonly-to-sidx-idxonly-equi-join_01.2.update.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-indexonly-plan-to-secondary-indexonly-plan-equi-join_01/btree-sidx-idxonly-to-sidx-idxonly-equi-join_01.2.update.aql
new file mode 100644
index 0000000..461f5c2
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-indexonly-plan-to-secondary-indexonly-plan-equi-join_01/btree-sidx-idxonly-to-sidx-idxonly-equi-join_01.2.update.aql
@@ -0,0 +1,29 @@
+/*
+ * 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.
+ */
+
+use dataverse test;
+
+load dataset Customers
+using localfs
+(("path"="asterix_nc1://data/nontagged/customerData2.json"),("format"="adm"));
+
+load dataset Orders
+using localfs
+(("path"="asterix_nc1://data/nontagged/orderData.json"),("format"="adm"));
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/06cec01b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-indexonly-plan-to-secondary-indexonly-plan-equi-join_01/btree-sidx-idxonly-to-sidx-idxonly-equi-join_01.3.query.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-indexonly-plan-to-secondary-indexonly-plan-equi-join_01/btree-sidx-idxonly-to-sidx-idxonly-equi-join_01.3.query.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-indexonly-plan-to-secondary-indexonly-plan-equi-join_01/btree-sidx-idxonly-to-sidx-idxonly-equi-join_01.3.query.aql
new file mode 100644
index 0000000..2066c68
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-indexonly-plan-to-secondary-indexonly-plan-equi-join_01/btree-sidx-idxonly-to-sidx-idxonly-equi-join_01.3.query.aql
@@ -0,0 +1,27 @@
+/*
+ * 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.
+ */
+
+use dataverse test;
+
+count(
+for $o in dataset('Orders')
+for $c in dataset('Customers')
+where $o.cid < 100000 and $o.cid /*+ indexnl */ = $c.cashBack
+return {"oid": $o.oid, "cid":$c.cid}
+);

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/06cec01b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-non-indexonly-plan-to-primary-equi-join_01/btree-secondary-non-indexonly-plan-to-primary-equi-join_01.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-non-indexonly-plan-to-primary-equi-join_01/btree-secondary-non-indexonly-plan-to-primary-equi-join_01.1.ddl.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-non-indexonly-plan-to-primary-equi-join_01/btree-secondary-non-indexonly-plan-to-primary-equi-join_01.1.ddl.aql
deleted file mode 100644
index baa89f4..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-non-indexonly-plan-to-primary-equi-join_01/btree-secondary-non-indexonly-plan-to-primary-equi-join_01.1.ddl.aql
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * 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    : Equi joins two datasets, Customers and Orders, based on the customer id.
- *                  Given the 'indexnl' hint we expect the join to be transformed
- *                  into an indexed nested-loop join using Customers' primary index.
- *                  This is not an index-only plan since a single secondary index can't
- *                  cover the whole search predicate for the outer relation even when we exclude the join condition.
- * Success        : Yes
- */
-
-drop dataverse test if exists;
-create dataverse test;
-
-use dataverse test;
-
-create type AddressType as open {
-  number: int64,
-  street: string,
-  city: string
-}
-
-create type CustomerType as closed {
-  cid: int64,
-  name: string,
-  cashBack: int64,
-  age: int64?,
-  address: AddressType?,
-  lastorder: {
-    oid: int64,
-    total: float
-  }
-}
-
-create type OrderType as open {
-  oid: int64,
-  cid: int64,
-  orderstatus: string,
-  orderpriority: string,
-  clerk: string,
-  total: float,
-  items: [int64]
-}
-
-create dataset Customers(CustomerType) primary key cid;
-create dataset Orders(OrderType) primary key oid;
-
-create index CustomerID_idx on Orders(cid);
-

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/06cec01b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-non-indexonly-plan-to-primary-equi-join_01/btree-secondary-non-indexonly-plan-to-primary-equi-join_01.2.update.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-non-indexonly-plan-to-primary-equi-join_01/btree-secondary-non-indexonly-plan-to-primary-equi-join_01.2.update.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-non-indexonly-plan-to-primary-equi-join_01/btree-secondary-non-indexonly-plan-to-primary-equi-join_01.2.update.aql
deleted file mode 100644
index 0605ade..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-non-indexonly-plan-to-primary-equi-join_01/btree-secondary-non-indexonly-plan-to-primary-equi-join_01.2.update.aql
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * 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.
- */
-
-use dataverse test;
-
-load dataset Customers
-using localfs
-(("path"="asterix_nc1://data/nontagged/customerData.json"),("format"="adm"));
-
-load dataset Orders
-using localfs
-(("path"="asterix_nc1://data/nontagged/orderData.json"),("format"="adm"));
-

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/06cec01b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-non-indexonly-plan-to-primary-equi-join_01/btree-secondary-non-indexonly-plan-to-primary-equi-join_01.3.query.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-non-indexonly-plan-to-primary-equi-join_01/btree-secondary-non-indexonly-plan-to-primary-equi-join_01.3.query.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-non-indexonly-plan-to-primary-equi-join_01/btree-secondary-non-indexonly-plan-to-primary-equi-join_01.3.query.aql
deleted file mode 100644
index 6294ef3..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-non-indexonly-plan-to-primary-equi-join_01/btree-secondary-non-indexonly-plan-to-primary-equi-join_01.3.query.aql
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * 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.
- */
-
-use dataverse test;
-
-count(
-for $o in dataset('Orders')
-for $c in dataset('Customers')
-where $o.cid < 800 and $o.total < 10000 and $o.cid /*+ indexnl */ = $c.cid
-return {"oid": $o.oid, "cid":$c.cid}
-);

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/06cec01b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-non-indexonly-plan-to-primary-equi-join_01/btree-sidx-non-idxonly-to-pidx-equi-join_01.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-non-indexonly-plan-to-primary-equi-join_01/btree-sidx-non-idxonly-to-pidx-equi-join_01.1.ddl.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-non-indexonly-plan-to-primary-equi-join_01/btree-sidx-non-idxonly-to-pidx-equi-join_01.1.ddl.aql
new file mode 100644
index 0000000..baa89f4
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-non-indexonly-plan-to-primary-equi-join_01/btree-sidx-non-idxonly-to-pidx-equi-join_01.1.ddl.aql
@@ -0,0 +1,66 @@
+/*
+ * 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    : Equi joins two datasets, Customers and Orders, based on the customer id.
+ *                  Given the 'indexnl' hint we expect the join to be transformed
+ *                  into an indexed nested-loop join using Customers' primary index.
+ *                  This is not an index-only plan since a single secondary index can't
+ *                  cover the whole search predicate for the outer relation even when we exclude the join condition.
+ * Success        : Yes
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+
+use dataverse test;
+
+create type AddressType as open {
+  number: int64,
+  street: string,
+  city: string
+}
+
+create type CustomerType as closed {
+  cid: int64,
+  name: string,
+  cashBack: int64,
+  age: int64?,
+  address: AddressType?,
+  lastorder: {
+    oid: int64,
+    total: float
+  }
+}
+
+create type OrderType as open {
+  oid: int64,
+  cid: int64,
+  orderstatus: string,
+  orderpriority: string,
+  clerk: string,
+  total: float,
+  items: [int64]
+}
+
+create dataset Customers(CustomerType) primary key cid;
+create dataset Orders(OrderType) primary key oid;
+
+create index CustomerID_idx on Orders(cid);
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/06cec01b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-non-indexonly-plan-to-primary-equi-join_01/btree-sidx-non-idxonly-to-pidx-equi-join_01.2.update.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-non-indexonly-plan-to-primary-equi-join_01/btree-sidx-non-idxonly-to-pidx-equi-join_01.2.update.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-non-indexonly-plan-to-primary-equi-join_01/btree-sidx-non-idxonly-to-pidx-equi-join_01.2.update.aql
new file mode 100644
index 0000000..0605ade
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-non-indexonly-plan-to-primary-equi-join_01/btree-sidx-non-idxonly-to-pidx-equi-join_01.2.update.aql
@@ -0,0 +1,29 @@
+/*
+ * 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.
+ */
+
+use dataverse test;
+
+load dataset Customers
+using localfs
+(("path"="asterix_nc1://data/nontagged/customerData.json"),("format"="adm"));
+
+load dataset Orders
+using localfs
+(("path"="asterix_nc1://data/nontagged/orderData.json"),("format"="adm"));
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/06cec01b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-non-indexonly-plan-to-primary-equi-join_01/btree-sidx-non-idxonly-to-pidx-equi-join_01.3.query.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-non-indexonly-plan-to-primary-equi-join_01/btree-sidx-non-idxonly-to-pidx-equi-join_01.3.query.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-non-indexonly-plan-to-primary-equi-join_01/btree-sidx-non-idxonly-to-pidx-equi-join_01.3.query.aql
new file mode 100644
index 0000000..6294ef3
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-non-indexonly-plan-to-primary-equi-join_01/btree-sidx-non-idxonly-to-pidx-equi-join_01.3.query.aql
@@ -0,0 +1,27 @@
+/*
+ * 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.
+ */
+
+use dataverse test;
+
+count(
+for $o in dataset('Orders')
+for $c in dataset('Customers')
+where $o.cid < 800 and $o.total < 10000 and $o.cid /*+ indexnl */ = $c.cid
+return {"oid": $o.oid, "cid":$c.cid}
+);

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/06cec01b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-non-indexonly-plan-to-secondary-indexonly-plan-equi-join_01/btree-secondary-non-indexonly-plan-to-secondary-indexonly-plan-equi-join_01.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-non-indexonly-plan-to-secondary-indexonly-plan-equi-join_01/btree-secondary-non-indexonly-plan-to-secondary-indexonly-plan-equi-join_01.1.ddl.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-non-indexonly-plan-to-secondary-indexonly-plan-equi-join_01/btree-secondary-non-indexonly-plan-to-secondary-indexonly-plan-equi-join_01.1.ddl.aql
deleted file mode 100644
index e5290ba..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-non-indexonly-plan-to-secondary-indexonly-plan-equi-join_01/btree-secondary-non-indexonly-plan-to-secondary-indexonly-plan-equi-join_01.1.ddl.aql
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * 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    : Equi joins two datasets, Customers and Orders, based on the customer id.
- *                  Given the 'indexnl' hint we expect the join to be transformed
- *                  into an indexed nested-loop join using Orders' secondary index.
- *                  Inner branch will be transformed as an index-only plan.
- *                  Outer branch cannot be transformed as an index-only plan as an index can't cover
- *                  all search predicates even excluding the join condition.
- * Success        : Yes
- */
-
-drop dataverse test if exists;
-create dataverse test;
-
-use dataverse test;
-
-create type AddressType as open {
-  number: int64,
-  street: string,
-  city: string
-}
-
-create type CustomerType as closed {
-  cid: int64,
-  name: string,
-  cashBack: int64,
-  age: int64?,
-  address: AddressType?,
-  lastorder: {
-    oid: int64,
-    total: float
-  }
-}
-
-create type OrderType as open {
-  oid: int64,
-  cid: int64,
-  orderstatus: string,
-  orderpriority: string,
-  clerk: string,
-  total: float,
-  items: [int64]
-}
-
-create dataset Customers(CustomerType) primary key cid;
-create dataset Orders(OrderType) primary key oid;
-
-create index CustomerID_idx on Orders(cid);
-create index Cashback_idx on Customers(cashBack);

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/06cec01b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-non-indexonly-plan-to-secondary-indexonly-plan-equi-join_01/btree-secondary-non-indexonly-plan-to-secondary-indexonly-plan-equi-join_01.2.update.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-non-indexonly-plan-to-secondary-indexonly-plan-equi-join_01/btree-secondary-non-indexonly-plan-to-secondary-indexonly-plan-equi-join_01.2.update.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-non-indexonly-plan-to-secondary-indexonly-plan-equi-join_01/btree-secondary-non-indexonly-plan-to-secondary-indexonly-plan-equi-join_01.2.update.aql
deleted file mode 100644
index 461f5c2..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-non-indexonly-plan-to-secondary-indexonly-plan-equi-join_01/btree-secondary-non-indexonly-plan-to-secondary-indexonly-plan-equi-join_01.2.update.aql
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * 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.
- */
-
-use dataverse test;
-
-load dataset Customers
-using localfs
-(("path"="asterix_nc1://data/nontagged/customerData2.json"),("format"="adm"));
-
-load dataset Orders
-using localfs
-(("path"="asterix_nc1://data/nontagged/orderData.json"),("format"="adm"));
-

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/06cec01b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-non-indexonly-plan-to-secondary-indexonly-plan-equi-join_01/btree-secondary-non-indexonly-plan-to-secondary-indexonly-plan-equi-join_01.3.query.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-non-indexonly-plan-to-secondary-indexonly-plan-equi-join_01/btree-secondary-non-indexonly-plan-to-secondary-indexonly-plan-equi-join_01.3.query.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-non-indexonly-plan-to-secondary-indexonly-plan-equi-join_01/btree-secondary-non-indexonly-plan-to-secondary-indexonly-plan-equi-join_01.3.query.aql
deleted file mode 100644
index 510f439..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-non-indexonly-plan-to-secondary-indexonly-plan-equi-join_01/btree-secondary-non-indexonly-plan-to-secondary-indexonly-plan-equi-join_01.3.query.aql
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * 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.
- */
-
-use dataverse test;
-
-count(
-for $o in dataset('Orders')
-for $c in dataset('Customers')
-where $o.cid < 100000 and $o.total >= 0 and $o.cid /*+ indexnl */ = $c.cashBack
-return {"oid": $o.oid, "cid":$c.cid}
-);

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/06cec01b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-non-indexonly-plan-to-secondary-indexonly-plan-equi-join_01/btree-sidx-non-idxonly-to-sidx-idxonly-equi-join_01.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-non-indexonly-plan-to-secondary-indexonly-plan-equi-join_01/btree-sidx-non-idxonly-to-sidx-idxonly-equi-join_01.1.ddl.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-non-indexonly-plan-to-secondary-indexonly-plan-equi-join_01/btree-sidx-non-idxonly-to-sidx-idxonly-equi-join_01.1.ddl.aql
new file mode 100644
index 0000000..e5290ba
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-non-indexonly-plan-to-secondary-indexonly-plan-equi-join_01/btree-sidx-non-idxonly-to-sidx-idxonly-equi-join_01.1.ddl.aql
@@ -0,0 +1,67 @@
+/*
+ * 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    : Equi joins two datasets, Customers and Orders, based on the customer id.
+ *                  Given the 'indexnl' hint we expect the join to be transformed
+ *                  into an indexed nested-loop join using Orders' secondary index.
+ *                  Inner branch will be transformed as an index-only plan.
+ *                  Outer branch cannot be transformed as an index-only plan as an index can't cover
+ *                  all search predicates even excluding the join condition.
+ * Success        : Yes
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+
+use dataverse test;
+
+create type AddressType as open {
+  number: int64,
+  street: string,
+  city: string
+}
+
+create type CustomerType as closed {
+  cid: int64,
+  name: string,
+  cashBack: int64,
+  age: int64?,
+  address: AddressType?,
+  lastorder: {
+    oid: int64,
+    total: float
+  }
+}
+
+create type OrderType as open {
+  oid: int64,
+  cid: int64,
+  orderstatus: string,
+  orderpriority: string,
+  clerk: string,
+  total: float,
+  items: [int64]
+}
+
+create dataset Customers(CustomerType) primary key cid;
+create dataset Orders(OrderType) primary key oid;
+
+create index CustomerID_idx on Orders(cid);
+create index Cashback_idx on Customers(cashBack);

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/06cec01b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-non-indexonly-plan-to-secondary-indexonly-plan-equi-join_01/btree-sidx-non-idxonly-to-sidx-idxonly-equi-join_01.2.update.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-non-indexonly-plan-to-secondary-indexonly-plan-equi-join_01/btree-sidx-non-idxonly-to-sidx-idxonly-equi-join_01.2.update.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-non-indexonly-plan-to-secondary-indexonly-plan-equi-join_01/btree-sidx-non-idxonly-to-sidx-idxonly-equi-join_01.2.update.aql
new file mode 100644
index 0000000..461f5c2
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-non-indexonly-plan-to-secondary-indexonly-plan-equi-join_01/btree-sidx-non-idxonly-to-sidx-idxonly-equi-join_01.2.update.aql
@@ -0,0 +1,29 @@
+/*
+ * 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.
+ */
+
+use dataverse test;
+
+load dataset Customers
+using localfs
+(("path"="asterix_nc1://data/nontagged/customerData2.json"),("format"="adm"));
+
+load dataset Orders
+using localfs
+(("path"="asterix_nc1://data/nontagged/orderData.json"),("format"="adm"));
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/06cec01b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-non-indexonly-plan-to-secondary-indexonly-plan-equi-join_01/btree-sidx-non-idxonly-to-sidx-idxonly-equi-join_01.3.query.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-non-indexonly-plan-to-secondary-indexonly-plan-equi-join_01/btree-sidx-non-idxonly-to-sidx-idxonly-equi-join_01.3.query.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-non-indexonly-plan-to-secondary-indexonly-plan-equi-join_01/btree-sidx-non-idxonly-to-sidx-idxonly-equi-join_01.3.query.aql
new file mode 100644
index 0000000..510f439
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-join/btree-secondary-non-indexonly-plan-to-secondary-indexonly-plan-equi-join_01/btree-sidx-non-idxonly-to-sidx-idxonly-equi-join_01.3.query.aql
@@ -0,0 +1,27 @@
+/*
+ * 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.
+ */
+
+use dataverse test;
+
+count(
+for $o in dataset('Orders')
+for $c in dataset('Customers')
+where $o.cid < 100000 and $o.total >= 0 and $o.cid /*+ indexnl */ = $c.cashBack
+return {"oid": $o.oid, "cid":$c.cid}
+);

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/06cec01b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-leftouterjoin/probe-pidx-with-join-btree-sidx3-indexonly-plan/probe-pidx-join-btree-sidx3-idxonly.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-leftouterjoin/probe-pidx-with-join-btree-sidx3-indexonly-plan/probe-pidx-join-btree-sidx3-idxonly.1.ddl.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-leftouterjoin/probe-pidx-with-join-btree-sidx3-indexonly-plan/probe-pidx-join-btree-sidx3-idxonly.1.ddl.aql
new file mode 100644
index 0000000..a8a8ce6
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-leftouterjoin/probe-pidx-with-join-btree-sidx3-indexonly-plan/probe-pidx-join-btree-sidx3-idxonly.1.ddl.aql
@@ -0,0 +1,56 @@
+/*
+ * 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  : Test that left-outer-join may use two available indexes, one for primary index in prob subtree and
+ *                another for secondary index in index subtree. For inner branch, this is an index-only plan.
+ * Expected Res : Success
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type TwitterUserType as closed {
+    screen-name: string,
+    lang: string,
+    friends-count: int64,
+    statuses-count: int64,
+    name: string,
+    followers-count: int64
+}
+
+create type TweetMessageType as closed {
+    tweetid: int64,
+        user: TwitterUserType,
+        sender-location: point,
+    send-time: datetime,
+        referred-topics: {{ string }},
+    message-text: string,
+    countA: int64,
+    countB: int64
+}
+
+create dataset TweetMessages(TweetMessageType)
+primary key tweetid;
+
+create index twmSndLocIx on TweetMessages(sender-location) type rtree;
+create index msgCountAIx on TweetMessages(countA) type btree;
+create index msgCountBIx on TweetMessages(countB) type btree;
+create index msgTextIx on TweetMessages(message-text) type keyword;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/06cec01b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-leftouterjoin/probe-pidx-with-join-btree-sidx3-indexonly-plan/probe-pidx-join-btree-sidx3-idxonly.2.update.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-leftouterjoin/probe-pidx-with-join-btree-sidx3-indexonly-plan/probe-pidx-join-btree-sidx3-idxonly.2.update.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-leftouterjoin/probe-pidx-with-join-btree-sidx3-indexonly-plan/probe-pidx-join-btree-sidx3-idxonly.2.update.aql
new file mode 100644
index 0000000..a045bf9
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-leftouterjoin/probe-pidx-with-join-btree-sidx3-indexonly-plan/probe-pidx-join-btree-sidx3-idxonly.2.update.aql
@@ -0,0 +1,24 @@
+/*
+ * 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.
+ */
+
+use dataverse test;
+
+load dataset TweetMessages
+using localfs
+(("path"="asterix_nc1://data/twitter/tw_for_indexleftouterjoin.adm"),("format"="adm"));

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/06cec01b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-leftouterjoin/probe-pidx-with-join-btree-sidx3-indexonly-plan/probe-pidx-join-btree-sidx3-idxonly.3.query.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-leftouterjoin/probe-pidx-with-join-btree-sidx3-indexonly-plan/probe-pidx-join-btree-sidx3-idxonly.3.query.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-leftouterjoin/probe-pidx-with-join-btree-sidx3-indexonly-plan/probe-pidx-join-btree-sidx3-idxonly.3.query.aql
new file mode 100644
index 0000000..54ff9c6
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-leftouterjoin/probe-pidx-with-join-btree-sidx3-indexonly-plan/probe-pidx-join-btree-sidx3-idxonly.3.query.aql
@@ -0,0 +1,32 @@
+/*
+ * 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.
+ */
+
+use dataverse test;
+
+count(
+for $t1 in dataset('TweetMessages')
+where $t1.tweetid < 10
+return {
+"tweetid1": $t1.tweetid,
+"count1":$t1.countA,
+"t2info": for $t2 in dataset('TweetMessages')
+                        where $t1.countA /* +indexnl */= $t2.countB
+                        return {"tweetid2": $t2.tweetid,
+                                "count2": $t2.countB}
+});

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/06cec01b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-leftouterjoin/probe-pidx-with-join-btree-sidx3-indexonly-plan/probe-pidx-with-join-btree-sidx3-indexonly-plan.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-leftouterjoin/probe-pidx-with-join-btree-sidx3-indexonly-plan/probe-pidx-with-join-btree-sidx3-indexonly-plan.1.ddl.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-leftouterjoin/probe-pidx-with-join-btree-sidx3-indexonly-plan/probe-pidx-with-join-btree-sidx3-indexonly-plan.1.ddl.aql
deleted file mode 100644
index a8a8ce6..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-leftouterjoin/probe-pidx-with-join-btree-sidx3-indexonly-plan/probe-pidx-with-join-btree-sidx3-indexonly-plan.1.ddl.aql
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * 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  : Test that left-outer-join may use two available indexes, one for primary index in prob subtree and
- *                another for secondary index in index subtree. For inner branch, this is an index-only plan.
- * Expected Res : Success
- */
-
-drop dataverse test if exists;
-create dataverse test;
-use dataverse test;
-
-create type TwitterUserType as closed {
-    screen-name: string,
-    lang: string,
-    friends-count: int64,
-    statuses-count: int64,
-    name: string,
-    followers-count: int64
-}
-
-create type TweetMessageType as closed {
-    tweetid: int64,
-        user: TwitterUserType,
-        sender-location: point,
-    send-time: datetime,
-        referred-topics: {{ string }},
-    message-text: string,
-    countA: int64,
-    countB: int64
-}
-
-create dataset TweetMessages(TweetMessageType)
-primary key tweetid;
-
-create index twmSndLocIx on TweetMessages(sender-location) type rtree;
-create index msgCountAIx on TweetMessages(countA) type btree;
-create index msgCountBIx on TweetMessages(countB) type btree;
-create index msgTextIx on TweetMessages(message-text) type keyword;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/06cec01b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-leftouterjoin/probe-pidx-with-join-btree-sidx3-indexonly-plan/probe-pidx-with-join-btree-sidx3-indexonly-plan.2.update.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-leftouterjoin/probe-pidx-with-join-btree-sidx3-indexonly-plan/probe-pidx-with-join-btree-sidx3-indexonly-plan.2.update.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-leftouterjoin/probe-pidx-with-join-btree-sidx3-indexonly-plan/probe-pidx-with-join-btree-sidx3-indexonly-plan.2.update.aql
deleted file mode 100644
index a045bf9..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-leftouterjoin/probe-pidx-with-join-btree-sidx3-indexonly-plan/probe-pidx-with-join-btree-sidx3-indexonly-plan.2.update.aql
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * 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.
- */
-
-use dataverse test;
-
-load dataset TweetMessages
-using localfs
-(("path"="asterix_nc1://data/twitter/tw_for_indexleftouterjoin.adm"),("format"="adm"));

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/06cec01b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-leftouterjoin/probe-pidx-with-join-btree-sidx3-indexonly-plan/probe-pidx-with-join-btree-sidx3-indexonly-plan.3.query.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-leftouterjoin/probe-pidx-with-join-btree-sidx3-indexonly-plan/probe-pidx-with-join-btree-sidx3-indexonly-plan.3.query.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-leftouterjoin/probe-pidx-with-join-btree-sidx3-indexonly-plan/probe-pidx-with-join-btree-sidx3-indexonly-plan.3.query.aql
deleted file mode 100644
index 54ff9c6..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-leftouterjoin/probe-pidx-with-join-btree-sidx3-indexonly-plan/probe-pidx-with-join-btree-sidx3-indexonly-plan.3.query.aql
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * 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.
- */
-
-use dataverse test;
-
-count(
-for $t1 in dataset('TweetMessages')
-where $t1.tweetid < 10
-return {
-"tweetid1": $t1.tweetid,
-"count1":$t1.countA,
-"t2info": for $t2 in dataset('TweetMessages')
-                        where $t1.countA /* +indexnl */= $t2.countB
-                        return {"tweetid2": $t2.tweetid,
-                                "count2": $t2.countB}
-});

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/06cec01b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-leftouterjoin/probe-sidx-btree-indexonly-plan-with-join-btree-pidx1/probe-sidx-btree-idxonly-join-btree-pidx1.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-leftouterjoin/probe-sidx-btree-indexonly-plan-with-join-btree-pidx1/probe-sidx-btree-idxonly-join-btree-pidx1.1.ddl.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-leftouterjoin/probe-sidx-btree-indexonly-plan-with-join-btree-pidx1/probe-sidx-btree-idxonly-join-btree-pidx1.1.ddl.aql
new file mode 100644
index 0000000..8c56ff4
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-leftouterjoin/probe-sidx-btree-indexonly-plan-with-join-btree-pidx1/probe-sidx-btree-idxonly-join-btree-pidx1.1.ddl.aql
@@ -0,0 +1,57 @@
+/*
+ * 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  : Test that left-outer-join may use an available primary index in the index subtree.
+ *                In the probe side, this is an index-only plan since a secondary index-search
+ *                will fetch all fields that are required for the plan.
+ * Expected Res : Success
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type TwitterUserType as closed {
+    screen-name: string,
+    lang: string,
+    friends-count: int64,
+    statuses-count: int64,
+    name: string,
+    followers-count: int64
+}
+
+create type TweetMessageType as closed {
+    tweetid: int64,
+    user: TwitterUserType,
+    sender-location: point,
+    send-time: datetime,
+    referred-topics: {{ string }},
+    message-text: string,
+    countA: int64,
+    countB: int64
+}
+
+create dataset TweetMessages(TweetMessageType)
+primary key tweetid;
+
+create index twmSndLocIx on TweetMessages(sender-location) type rtree;
+create index msgCountAIx on TweetMessages(countA) type btree;
+create index msgCountBIx on TweetMessages(countB) type btree;
+create index msgTextIx on TweetMessages(message-text) type keyword;