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

[6/8] asterixdb git commit: [NO ISSUE][COMP][RT] Rename index-only test case directory

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/211cbe1b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-secondary-composite-index-indexonly-plan-02/btree-sidx-composite-idxonly-03.3.query.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-secondary-composite-index-indexonly-plan-02/btree-sidx-composite-idxonly-03.3.query.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-secondary-composite-index-indexonly-plan-02/btree-sidx-composite-idxonly-03.3.query.aql
deleted file mode 100644
index 6993c15..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-secondary-composite-index-indexonly-plan-02/btree-sidx-composite-idxonly-03.3.query.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;
-
-for $o in dataset('MyData')
-where $o.docid < 3
-order by $o.id
-return {"pk":$o.id, "sk":$o.docid}

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/211cbe1b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-secondary-composite-index-indexonly-plan-03/btree-sidx-composite-idxonly-03.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-secondary-composite-index-indexonly-plan-03/btree-sidx-composite-idxonly-03.1.ddl.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-secondary-composite-index-indexonly-plan-03/btree-sidx-composite-idxonly-03.1.ddl.aql
deleted file mode 100644
index 7b436d2..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-secondary-composite-index-indexonly-plan-03/btree-sidx-composite-idxonly-03.1.ddl.aql
+++ /dev/null
@@ -1,62 +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     : Secondary BTree Index index-only selection plan verification test
- *                  : This test is intended to verify that the secondary BTree index is
- *                  : used in the optimized query plan.
- *                  : In this plan, we fetch PK and SK based on a select condition that utilizes a secondary index.
- *                  : The plan should have two paths after the secondary index-lookup.
- *                  : The left path:
- *                      ... -> unnest-map (sidx) -> split -> unnest-map (pidx) -> select   -> union -> ...
- *                  : The right path:
- *                      ... -> unnest-map (sidx) -> split -> select (the second condition) -> union -> ...
- *  Expected Result : Success
- *
-*/
-
-drop dataverse test if exists;
-create dataverse test;
-use dataverse test;
-
-create type MyRecord as closed {
-  id: int64,
-  docid: int64,
-  val1: int64,
-  title: string,
-  point: point,
-  kwds: string,
-  line1: line,
-  line2: line,
-  poly1: polygon,
-  poly2: polygon,
-  rec: rectangle,
-  circle: circle
-}
-
-create dataset MyData(MyRecord)
-  primary key id;
-
-//create index btree_index_docid on MyData(docid) type btree;
-//create index btree_index_val1 on MyData(val1) type btree;
-create index btree_index_docid_val1 on MyData(docid,val1) type btree;
-create index rtree_index_point on MyData(point) type rtree;
-create index rtree_index_rec on MyData(rec) type rtree;
-create index ngram_index_title on MyData(title) type ngram(3);
-create index keyword_index_title on MyData(title) type keyword;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/211cbe1b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-secondary-composite-index-indexonly-plan-03/btree-sidx-composite-idxonly-03.2.update.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-secondary-composite-index-indexonly-plan-03/btree-sidx-composite-idxonly-03.2.update.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-secondary-composite-index-indexonly-plan-03/btree-sidx-composite-idxonly-03.2.update.aql
deleted file mode 100644
index 4f5e20d..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-secondary-composite-index-indexonly-plan-03/btree-sidx-composite-idxonly-03.2.update.aql
+++ /dev/null
@@ -1,25 +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 MyData
-using localfs
-(("path"="asterix_nc1://data/spatial/spatialData2.json"),("format"="adm"));
-

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/211cbe1b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-secondary-composite-index-indexonly-plan-03/btree-sidx-composite-idxonly-03.3.query.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-secondary-composite-index-indexonly-plan-03/btree-sidx-composite-idxonly-03.3.query.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-secondary-composite-index-indexonly-plan-03/btree-sidx-composite-idxonly-03.3.query.aql
deleted file mode 100644
index 256baa8..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-secondary-composite-index-indexonly-plan-03/btree-sidx-composite-idxonly-03.3.query.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;
-
-for $o in dataset('MyData')
-where $o.docid < 3 and $o.val1 >= 3
-return {"pk":$o.id, "sk":$o.docid, "sk2":$o.val1}

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/211cbe1b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-secondary-index-indexonly-plan-01/btree-sidx-idxonly-01.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-secondary-index-indexonly-plan-01/btree-sidx-idxonly-01.1.ddl.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-secondary-index-indexonly-plan-01/btree-sidx-idxonly-01.1.ddl.aql
deleted file mode 100644
index 5935213..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-secondary-index-indexonly-plan-01/btree-sidx-idxonly-01.1.ddl.aql
+++ /dev/null
@@ -1,60 +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     : Secondary BTree Index index-only selection plan verification test
- *                  : The test is intended to verify that the secondary BTree index is used in the optimized query plan.
- *                  : In this plan, we fetch PK and SK based on a select condition that utilizes a secondary index.
- *                  : The plan should have two paths after the secondary index-lookup.
- *                  : The left path:
- *                      ... -> unnest-map (sidx) -> split -> unnest-map (pidx) -> select -> union -> ...
- *                  : The right path:
- *                      ... -> unnest-map (sidx) -> split ->                             -> union -> ...
- *  Expected Result : Success
- *
-*/
-
-drop dataverse test if exists;
-create dataverse test;
-use dataverse test;
-
-create type MyRecord as closed {
-  id: int64,
-  docid: int64,
-  val1: int64,
-  title: string,
-  point: point,
-  kwds: string,
-  line1: line,
-  line2: line,
-  poly1: polygon,
-  poly2: polygon,
-  rec: rectangle,
-  circle: circle
-}
-
-create dataset MyData(MyRecord)
-  primary key id;
-
-create index btree_index_docid on MyData(docid) type btree;
-create index btree_index_val1 on MyData(val1) type btree;
-create index rtree_index_point on MyData(point) type rtree;
-create index rtree_index_rec on MyData(rec) type rtree;
-create index ngram_index_title on MyData(title) type ngram(3);
-create index keyword_index_title on MyData(title) type keyword;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/211cbe1b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-secondary-index-indexonly-plan-01/btree-sidx-idxonly-01.10.query.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-secondary-index-indexonly-plan-01/btree-sidx-idxonly-01.10.query.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-secondary-index-indexonly-plan-01/btree-sidx-idxonly-01.10.query.aql
deleted file mode 100644
index 72bf03e..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-secondary-index-indexonly-plan-01/btree-sidx-idxonly-01.10.query.aql
+++ /dev/null
@@ -1,28 +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('MyData')
-where $o.docid < 3
-order by $o.id
-return $o
-);
-

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/211cbe1b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-secondary-index-indexonly-plan-01/btree-sidx-idxonly-01.2.update.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-secondary-index-indexonly-plan-01/btree-sidx-idxonly-01.2.update.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-secondary-index-indexonly-plan-01/btree-sidx-idxonly-01.2.update.aql
deleted file mode 100644
index 9a7b2b7..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-secondary-index-indexonly-plan-01/btree-sidx-idxonly-01.2.update.aql
+++ /dev/null
@@ -1,25 +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 MyData
-using localfs
-(("path"="asterix_nc1://data/spatial/spatialData2.json"),("format"="adm"));
-

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/211cbe1b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-secondary-index-indexonly-plan-01/btree-sidx-idxonly-01.3.query.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-secondary-index-indexonly-plan-01/btree-sidx-idxonly-01.3.query.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-secondary-index-indexonly-plan-01/btree-sidx-idxonly-01.3.query.aql
deleted file mode 100644
index 2e3b770..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-secondary-index-indexonly-plan-01/btree-sidx-idxonly-01.3.query.aql
+++ /dev/null
@@ -1,25 +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;
-
-for $o in dataset('MyData')
-where $o.docid < 3
-order by $o.id
-return {"pk":$o.id, "sk":$o.docid}

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/211cbe1b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-secondary-index-indexonly-plan-01/btree-sidx-idxonly-01.4.query.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-secondary-index-indexonly-plan-01/btree-sidx-idxonly-01.4.query.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-secondary-index-indexonly-plan-01/btree-sidx-idxonly-01.4.query.aql
deleted file mode 100644
index eb7d8d3..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-secondary-index-indexonly-plan-01/btree-sidx-idxonly-01.4.query.aql
+++ /dev/null
@@ -1,25 +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;
-
-for $o in dataset('MyData')
-where $o.docid < 3
-order by $o.id
-return {"pk":$o.id}

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/211cbe1b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-secondary-index-indexonly-plan-01/btree-sidx-idxonly-01.5.query.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-secondary-index-indexonly-plan-01/btree-sidx-idxonly-01.5.query.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-secondary-index-indexonly-plan-01/btree-sidx-idxonly-01.5.query.aql
deleted file mode 100644
index 019ec61..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-secondary-index-indexonly-plan-01/btree-sidx-idxonly-01.5.query.aql
+++ /dev/null
@@ -1,25 +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;
-
-for $o in dataset('MyData')
-where $o.docid < 3
-order by $o.id
-return {"sk":$o.docid}

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/211cbe1b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-secondary-index-indexonly-plan-01/btree-sidx-idxonly-01.6.query.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-secondary-index-indexonly-plan-01/btree-sidx-idxonly-01.6.query.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-secondary-index-indexonly-plan-01/btree-sidx-idxonly-01.6.query.aql
deleted file mode 100644
index dbfceea..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-secondary-index-indexonly-plan-01/btree-sidx-idxonly-01.6.query.aql
+++ /dev/null
@@ -1,28 +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('MyData')
-where $o.docid < 3
-order by $o.id
-return {"pk":$o.id, "sk":$o.docid}
-);
-

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/211cbe1b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-secondary-index-indexonly-plan-01/btree-sidx-idxonly-01.7.query.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-secondary-index-indexonly-plan-01/btree-sidx-idxonly-01.7.query.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-secondary-index-indexonly-plan-01/btree-sidx-idxonly-01.7.query.aql
deleted file mode 100644
index 0eaa1ea..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-secondary-index-indexonly-plan-01/btree-sidx-idxonly-01.7.query.aql
+++ /dev/null
@@ -1,28 +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('MyData')
-where $o.docid < 3
-order by $o.id
-return {"pk":$o.id}
-);
-

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/211cbe1b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-secondary-index-indexonly-plan-01/btree-sidx-idxonly-01.8.query.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-secondary-index-indexonly-plan-01/btree-sidx-idxonly-01.8.query.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-secondary-index-indexonly-plan-01/btree-sidx-idxonly-01.8.query.aql
deleted file mode 100644
index d42794f..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-secondary-index-indexonly-plan-01/btree-sidx-idxonly-01.8.query.aql
+++ /dev/null
@@ -1,28 +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('MyData')
-where $o.docid < 3
-order by $o.id
-return {"sk":$o.docid}
-);
-

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/211cbe1b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-secondary-index-indexonly-plan-01/btree-sidx-idxonly-01.9.query.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-secondary-index-indexonly-plan-01/btree-sidx-idxonly-01.9.query.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-secondary-index-indexonly-plan-01/btree-sidx-idxonly-01.9.query.aql
deleted file mode 100644
index 50fd514..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-secondary-index-indexonly-plan-01/btree-sidx-idxonly-01.9.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('MyData')
-where $o.docid < 3
-order by $o.id
-return {"rec":$o, "pk":$o.id}
-);

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/211cbe1b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-secondary-index-non-indexonly-plan-01/btree-sidx-non-idxonly-01.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-secondary-index-non-indexonly-plan-01/btree-sidx-non-idxonly-01.1.ddl.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-secondary-index-non-indexonly-plan-01/btree-sidx-non-idxonly-01.1.ddl.aql
deleted file mode 100644
index a6b865b..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-secondary-index-non-indexonly-plan-01/btree-sidx-non-idxonly-01.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     : Secondary BTree Index index-only selection plan verification test
- *                  : The test is intended to verify that the secondary BTree index is used in the optimized query plan.
- *                  : In this plan, we have multiple conditions that one index can cover.
- *                  : Thus, index-only plan is not possible.
- *  Expected Result : Success
- *
-*/
-
-drop dataverse test if exists;
-create dataverse test;
-use dataverse test;
-
-create type MyRecord as closed {
-  id: int64,
-  docid: int64,
-  val1: int64,
-  title: string,
-  point: point,
-  kwds: string,
-  line1: line,
-  line2: line,
-  poly1: polygon,
-  poly2: polygon,
-  rec: rectangle,
-  circle: circle
-}
-
-create dataset MyData(MyRecord)
-  primary key id;
-
-create index btree_index_docid on MyData(docid) type btree;
-create index btree_index_val1 on MyData(val1) type btree;
-create index rtree_index_point on MyData(point) type rtree;
-create index rtree_index_rec on MyData(rec) type rtree;
-create index ngram_index_title on MyData(title) type ngram(3);
-create index keyword_index_title on MyData(title) type keyword;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/211cbe1b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-secondary-index-non-indexonly-plan-01/btree-sidx-non-idxonly-01.2.update.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-secondary-index-non-indexonly-plan-01/btree-sidx-non-idxonly-01.2.update.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-secondary-index-non-indexonly-plan-01/btree-sidx-non-idxonly-01.2.update.aql
deleted file mode 100644
index 9a7b2b7..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-secondary-index-non-indexonly-plan-01/btree-sidx-non-idxonly-01.2.update.aql
+++ /dev/null
@@ -1,25 +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 MyData
-using localfs
-(("path"="asterix_nc1://data/spatial/spatialData2.json"),("format"="adm"));
-

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/211cbe1b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-secondary-index-non-indexonly-plan-01/btree-sidx-non-idxonly-01.3.query.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-secondary-index-non-indexonly-plan-01/btree-sidx-non-idxonly-01.3.query.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-secondary-index-non-indexonly-plan-01/btree-sidx-non-idxonly-01.3.query.aql
deleted file mode 100644
index d072af2..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-secondary-index-non-indexonly-plan-01/btree-sidx-non-idxonly-01.3.query.aql
+++ /dev/null
@@ -1,26 +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('MyData')
-where $o.docid < 10 and $o.val1 < 3
-return {"pk":$o.id, "sk":$o.point}
-);

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/211cbe1b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-sidx-composite-idxonly-01/btree-sidx-composite-idxonly-01.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-sidx-composite-idxonly-01/btree-sidx-composite-idxonly-01.1.ddl.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-sidx-composite-idxonly-01/btree-sidx-composite-idxonly-01.1.ddl.aql
new file mode 100644
index 0000000..11a3605
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-sidx-composite-idxonly-01/btree-sidx-composite-idxonly-01.1.ddl.aql
@@ -0,0 +1,62 @@
+/*
+ * 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     : Secondary BTree Index index-only selection plan verification test
+ *                  : This test is intended to verify that the secondary BTree index is
+ *                  : used in the optimized query plan.
+ *                  : In this plan, we fetch PK and SK based on a select condition that utilizes a secondary index.
+ *                  : The plan should have two paths after the secondary index-lookup.
+ *                  : The left path:
+ *                      ... -> unnest-map (sidx) -> split -> unnest-map (pidx) -> select -> union -> ...
+ *                  : The right path:
+ *                      ... -> unnest-map (sidx) -> split ->                                union -> ...
+ *  Expected Result : Success
+ *
+*/
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type MyRecord as closed {
+  id: int64,
+  docid: int64,
+  val1: int64,
+  title: string,
+  point: point,
+  kwds: string,
+  line1: line,
+  line2: line,
+  poly1: polygon,
+  poly2: polygon,
+  rec: rectangle,
+  circle: circle
+}
+
+create dataset MyData(MyRecord)
+  primary key id;
+
+//create index btree_index_docid on MyData(docid) type btree;
+//create index btree_index_val1 on MyData(val1) type btree;
+create index btree_index_docid_val1 on MyData(docid,val1) type btree;
+create index rtree_index_point on MyData(point) type rtree;
+create index rtree_index_rec on MyData(rec) type rtree;
+create index ngram_index_title on MyData(title) type ngram(3);
+create index keyword_index_title on MyData(title) type keyword;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/211cbe1b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-sidx-composite-idxonly-01/btree-sidx-composite-idxonly-01.2.update.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-sidx-composite-idxonly-01/btree-sidx-composite-idxonly-01.2.update.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-sidx-composite-idxonly-01/btree-sidx-composite-idxonly-01.2.update.aql
new file mode 100644
index 0000000..9a7b2b7
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-sidx-composite-idxonly-01/btree-sidx-composite-idxonly-01.2.update.aql
@@ -0,0 +1,25 @@
+/*
+ * 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 MyData
+using localfs
+(("path"="asterix_nc1://data/spatial/spatialData2.json"),("format"="adm"));
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/211cbe1b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-sidx-composite-idxonly-01/btree-sidx-composite-idxonly-01.3.query.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-sidx-composite-idxonly-01/btree-sidx-composite-idxonly-01.3.query.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-sidx-composite-idxonly-01/btree-sidx-composite-idxonly-01.3.query.aql
new file mode 100644
index 0000000..e9c6f51
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-sidx-composite-idxonly-01/btree-sidx-composite-idxonly-01.3.query.aql
@@ -0,0 +1,25 @@
+/*
+ * 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;
+
+for $o in dataset('MyData')
+where $o.docid < 3
+order by $o.id
+return {"pk":$o.id, "sk":$o.val1}

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/211cbe1b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-sidx-composite-idxonly-02/btree-sidx-composite-idxonly-02.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-sidx-composite-idxonly-02/btree-sidx-composite-idxonly-02.1.ddl.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-sidx-composite-idxonly-02/btree-sidx-composite-idxonly-02.1.ddl.aql
new file mode 100644
index 0000000..11a3605
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-sidx-composite-idxonly-02/btree-sidx-composite-idxonly-02.1.ddl.aql
@@ -0,0 +1,62 @@
+/*
+ * 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     : Secondary BTree Index index-only selection plan verification test
+ *                  : This test is intended to verify that the secondary BTree index is
+ *                  : used in the optimized query plan.
+ *                  : In this plan, we fetch PK and SK based on a select condition that utilizes a secondary index.
+ *                  : The plan should have two paths after the secondary index-lookup.
+ *                  : The left path:
+ *                      ... -> unnest-map (sidx) -> split -> unnest-map (pidx) -> select -> union -> ...
+ *                  : The right path:
+ *                      ... -> unnest-map (sidx) -> split ->                                union -> ...
+ *  Expected Result : Success
+ *
+*/
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type MyRecord as closed {
+  id: int64,
+  docid: int64,
+  val1: int64,
+  title: string,
+  point: point,
+  kwds: string,
+  line1: line,
+  line2: line,
+  poly1: polygon,
+  poly2: polygon,
+  rec: rectangle,
+  circle: circle
+}
+
+create dataset MyData(MyRecord)
+  primary key id;
+
+//create index btree_index_docid on MyData(docid) type btree;
+//create index btree_index_val1 on MyData(val1) type btree;
+create index btree_index_docid_val1 on MyData(docid,val1) type btree;
+create index rtree_index_point on MyData(point) type rtree;
+create index rtree_index_rec on MyData(rec) type rtree;
+create index ngram_index_title on MyData(title) type ngram(3);
+create index keyword_index_title on MyData(title) type keyword;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/211cbe1b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-sidx-composite-idxonly-02/btree-sidx-composite-idxonly-02.2.update.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-sidx-composite-idxonly-02/btree-sidx-composite-idxonly-02.2.update.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-sidx-composite-idxonly-02/btree-sidx-composite-idxonly-02.2.update.aql
new file mode 100644
index 0000000..07ad6a0
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-sidx-composite-idxonly-02/btree-sidx-composite-idxonly-02.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 MyData
+using localfs
+(("path"="asterix_nc1://data/spatial/spatialData2.json"),("format"="adm"));
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/211cbe1b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-sidx-composite-idxonly-02/btree-sidx-composite-idxonly-03.3.query.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-sidx-composite-idxonly-02/btree-sidx-composite-idxonly-03.3.query.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-sidx-composite-idxonly-02/btree-sidx-composite-idxonly-03.3.query.aql
new file mode 100644
index 0000000..6993c15
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-sidx-composite-idxonly-02/btree-sidx-composite-idxonly-03.3.query.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;
+
+for $o in dataset('MyData')
+where $o.docid < 3
+order by $o.id
+return {"pk":$o.id, "sk":$o.docid}

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/211cbe1b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-sidx-composite-idxonly-03/btree-sidx-composite-idxonly-03.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-sidx-composite-idxonly-03/btree-sidx-composite-idxonly-03.1.ddl.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-sidx-composite-idxonly-03/btree-sidx-composite-idxonly-03.1.ddl.aql
new file mode 100644
index 0000000..7b436d2
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-sidx-composite-idxonly-03/btree-sidx-composite-idxonly-03.1.ddl.aql
@@ -0,0 +1,62 @@
+/*
+ * 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     : Secondary BTree Index index-only selection plan verification test
+ *                  : This test is intended to verify that the secondary BTree index is
+ *                  : used in the optimized query plan.
+ *                  : In this plan, we fetch PK and SK based on a select condition that utilizes a secondary index.
+ *                  : The plan should have two paths after the secondary index-lookup.
+ *                  : The left path:
+ *                      ... -> unnest-map (sidx) -> split -> unnest-map (pidx) -> select   -> union -> ...
+ *                  : The right path:
+ *                      ... -> unnest-map (sidx) -> split -> select (the second condition) -> union -> ...
+ *  Expected Result : Success
+ *
+*/
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type MyRecord as closed {
+  id: int64,
+  docid: int64,
+  val1: int64,
+  title: string,
+  point: point,
+  kwds: string,
+  line1: line,
+  line2: line,
+  poly1: polygon,
+  poly2: polygon,
+  rec: rectangle,
+  circle: circle
+}
+
+create dataset MyData(MyRecord)
+  primary key id;
+
+//create index btree_index_docid on MyData(docid) type btree;
+//create index btree_index_val1 on MyData(val1) type btree;
+create index btree_index_docid_val1 on MyData(docid,val1) type btree;
+create index rtree_index_point on MyData(point) type rtree;
+create index rtree_index_rec on MyData(rec) type rtree;
+create index ngram_index_title on MyData(title) type ngram(3);
+create index keyword_index_title on MyData(title) type keyword;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/211cbe1b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-sidx-composite-idxonly-03/btree-sidx-composite-idxonly-03.2.update.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-sidx-composite-idxonly-03/btree-sidx-composite-idxonly-03.2.update.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-sidx-composite-idxonly-03/btree-sidx-composite-idxonly-03.2.update.aql
new file mode 100644
index 0000000..4f5e20d
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-sidx-composite-idxonly-03/btree-sidx-composite-idxonly-03.2.update.aql
@@ -0,0 +1,25 @@
+/*
+ * 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 MyData
+using localfs
+(("path"="asterix_nc1://data/spatial/spatialData2.json"),("format"="adm"));
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/211cbe1b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-sidx-composite-idxonly-03/btree-sidx-composite-idxonly-03.3.query.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-sidx-composite-idxonly-03/btree-sidx-composite-idxonly-03.3.query.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-sidx-composite-idxonly-03/btree-sidx-composite-idxonly-03.3.query.aql
new file mode 100644
index 0000000..256baa8
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-sidx-composite-idxonly-03/btree-sidx-composite-idxonly-03.3.query.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;
+
+for $o in dataset('MyData')
+where $o.docid < 3 and $o.val1 >= 3
+return {"pk":$o.id, "sk":$o.docid, "sk2":$o.val1}

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/211cbe1b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-sidx-idxonly-01/btree-sidx-idxonly-01.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-sidx-idxonly-01/btree-sidx-idxonly-01.1.ddl.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-sidx-idxonly-01/btree-sidx-idxonly-01.1.ddl.aql
new file mode 100644
index 0000000..5935213
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-sidx-idxonly-01/btree-sidx-idxonly-01.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     : Secondary BTree Index index-only selection plan verification test
+ *                  : The test is intended to verify that the secondary BTree index is used in the optimized query plan.
+ *                  : In this plan, we fetch PK and SK based on a select condition that utilizes a secondary index.
+ *                  : The plan should have two paths after the secondary index-lookup.
+ *                  : The left path:
+ *                      ... -> unnest-map (sidx) -> split -> unnest-map (pidx) -> select -> union -> ...
+ *                  : The right path:
+ *                      ... -> unnest-map (sidx) -> split ->                             -> union -> ...
+ *  Expected Result : Success
+ *
+*/
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type MyRecord as closed {
+  id: int64,
+  docid: int64,
+  val1: int64,
+  title: string,
+  point: point,
+  kwds: string,
+  line1: line,
+  line2: line,
+  poly1: polygon,
+  poly2: polygon,
+  rec: rectangle,
+  circle: circle
+}
+
+create dataset MyData(MyRecord)
+  primary key id;
+
+create index btree_index_docid on MyData(docid) type btree;
+create index btree_index_val1 on MyData(val1) type btree;
+create index rtree_index_point on MyData(point) type rtree;
+create index rtree_index_rec on MyData(rec) type rtree;
+create index ngram_index_title on MyData(title) type ngram(3);
+create index keyword_index_title on MyData(title) type keyword;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/211cbe1b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-sidx-idxonly-01/btree-sidx-idxonly-01.10.query.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-sidx-idxonly-01/btree-sidx-idxonly-01.10.query.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-sidx-idxonly-01/btree-sidx-idxonly-01.10.query.aql
new file mode 100644
index 0000000..72bf03e
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-sidx-idxonly-01/btree-sidx-idxonly-01.10.query.aql
@@ -0,0 +1,28 @@
+/*
+ * 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('MyData')
+where $o.docid < 3
+order by $o.id
+return $o
+);
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/211cbe1b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-sidx-idxonly-01/btree-sidx-idxonly-01.2.update.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-sidx-idxonly-01/btree-sidx-idxonly-01.2.update.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-sidx-idxonly-01/btree-sidx-idxonly-01.2.update.aql
new file mode 100644
index 0000000..9a7b2b7
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-sidx-idxonly-01/btree-sidx-idxonly-01.2.update.aql
@@ -0,0 +1,25 @@
+/*
+ * 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 MyData
+using localfs
+(("path"="asterix_nc1://data/spatial/spatialData2.json"),("format"="adm"));
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/211cbe1b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-sidx-idxonly-01/btree-sidx-idxonly-01.3.query.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-sidx-idxonly-01/btree-sidx-idxonly-01.3.query.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-sidx-idxonly-01/btree-sidx-idxonly-01.3.query.aql
new file mode 100644
index 0000000..2e3b770
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-sidx-idxonly-01/btree-sidx-idxonly-01.3.query.aql
@@ -0,0 +1,25 @@
+/*
+ * 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;
+
+for $o in dataset('MyData')
+where $o.docid < 3
+order by $o.id
+return {"pk":$o.id, "sk":$o.docid}

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/211cbe1b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-sidx-idxonly-01/btree-sidx-idxonly-01.4.query.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-sidx-idxonly-01/btree-sidx-idxonly-01.4.query.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-sidx-idxonly-01/btree-sidx-idxonly-01.4.query.aql
new file mode 100644
index 0000000..eb7d8d3
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-sidx-idxonly-01/btree-sidx-idxonly-01.4.query.aql
@@ -0,0 +1,25 @@
+/*
+ * 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;
+
+for $o in dataset('MyData')
+where $o.docid < 3
+order by $o.id
+return {"pk":$o.id}

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/211cbe1b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-sidx-idxonly-01/btree-sidx-idxonly-01.5.query.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-sidx-idxonly-01/btree-sidx-idxonly-01.5.query.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-sidx-idxonly-01/btree-sidx-idxonly-01.5.query.aql
new file mode 100644
index 0000000..019ec61
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-sidx-idxonly-01/btree-sidx-idxonly-01.5.query.aql
@@ -0,0 +1,25 @@
+/*
+ * 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;
+
+for $o in dataset('MyData')
+where $o.docid < 3
+order by $o.id
+return {"sk":$o.docid}

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/211cbe1b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-sidx-idxonly-01/btree-sidx-idxonly-01.6.query.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-sidx-idxonly-01/btree-sidx-idxonly-01.6.query.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-sidx-idxonly-01/btree-sidx-idxonly-01.6.query.aql
new file mode 100644
index 0000000..dbfceea
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-sidx-idxonly-01/btree-sidx-idxonly-01.6.query.aql
@@ -0,0 +1,28 @@
+/*
+ * 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('MyData')
+where $o.docid < 3
+order by $o.id
+return {"pk":$o.id, "sk":$o.docid}
+);
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/211cbe1b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-sidx-idxonly-01/btree-sidx-idxonly-01.7.query.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-sidx-idxonly-01/btree-sidx-idxonly-01.7.query.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-sidx-idxonly-01/btree-sidx-idxonly-01.7.query.aql
new file mode 100644
index 0000000..0eaa1ea
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-sidx-idxonly-01/btree-sidx-idxonly-01.7.query.aql
@@ -0,0 +1,28 @@
+/*
+ * 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('MyData')
+where $o.docid < 3
+order by $o.id
+return {"pk":$o.id}
+);
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/211cbe1b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-sidx-idxonly-01/btree-sidx-idxonly-01.8.query.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-sidx-idxonly-01/btree-sidx-idxonly-01.8.query.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-sidx-idxonly-01/btree-sidx-idxonly-01.8.query.aql
new file mode 100644
index 0000000..d42794f
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-sidx-idxonly-01/btree-sidx-idxonly-01.8.query.aql
@@ -0,0 +1,28 @@
+/*
+ * 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('MyData')
+where $o.docid < 3
+order by $o.id
+return {"sk":$o.docid}
+);
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/211cbe1b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-sidx-idxonly-01/btree-sidx-idxonly-01.9.query.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-sidx-idxonly-01/btree-sidx-idxonly-01.9.query.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-sidx-idxonly-01/btree-sidx-idxonly-01.9.query.aql
new file mode 100644
index 0000000..50fd514
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-sidx-idxonly-01/btree-sidx-idxonly-01.9.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('MyData')
+where $o.docid < 3
+order by $o.id
+return {"rec":$o, "pk":$o.id}
+);

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/211cbe1b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-sidx-non-idxonly-01/btree-sidx-non-idxonly-01.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-sidx-non-idxonly-01/btree-sidx-non-idxonly-01.1.ddl.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-sidx-non-idxonly-01/btree-sidx-non-idxonly-01.1.ddl.aql
new file mode 100644
index 0000000..a6b865b
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-sidx-non-idxonly-01/btree-sidx-non-idxonly-01.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     : Secondary BTree Index index-only selection plan verification test
+ *                  : The test is intended to verify that the secondary BTree index is used in the optimized query plan.
+ *                  : In this plan, we have multiple conditions that one index can cover.
+ *                  : Thus, index-only plan is not possible.
+ *  Expected Result : Success
+ *
+*/
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type MyRecord as closed {
+  id: int64,
+  docid: int64,
+  val1: int64,
+  title: string,
+  point: point,
+  kwds: string,
+  line1: line,
+  line2: line,
+  poly1: polygon,
+  poly2: polygon,
+  rec: rectangle,
+  circle: circle
+}
+
+create dataset MyData(MyRecord)
+  primary key id;
+
+create index btree_index_docid on MyData(docid) type btree;
+create index btree_index_val1 on MyData(val1) type btree;
+create index rtree_index_point on MyData(point) type rtree;
+create index rtree_index_rec on MyData(rec) type rtree;
+create index ngram_index_title on MyData(title) type ngram(3);
+create index keyword_index_title on MyData(title) type keyword;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/211cbe1b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-sidx-non-idxonly-01/btree-sidx-non-idxonly-01.2.update.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-sidx-non-idxonly-01/btree-sidx-non-idxonly-01.2.update.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-sidx-non-idxonly-01/btree-sidx-non-idxonly-01.2.update.aql
new file mode 100644
index 0000000..9a7b2b7
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-sidx-non-idxonly-01/btree-sidx-non-idxonly-01.2.update.aql
@@ -0,0 +1,25 @@
+/*
+ * 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 MyData
+using localfs
+(("path"="asterix_nc1://data/spatial/spatialData2.json"),("format"="adm"));
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/211cbe1b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-sidx-non-idxonly-01/btree-sidx-non-idxonly-01.3.query.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-sidx-non-idxonly-01/btree-sidx-non-idxonly-01.3.query.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-sidx-non-idxonly-01/btree-sidx-non-idxonly-01.3.query.aql
new file mode 100644
index 0000000..d072af2
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-sidx-non-idxonly-01/btree-sidx-non-idxonly-01.3.query.aql
@@ -0,0 +1,26 @@
+/*
+ * 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('MyData')
+where $o.docid < 10 and $o.val1 < 3
+return {"pk":$o.id, "sk":$o.point}
+);

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/211cbe1b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/rtree-secondary-index-indexonly-plan-01/rtree-sidx-idxonly-01.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/rtree-secondary-index-indexonly-plan-01/rtree-sidx-idxonly-01.1.ddl.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/rtree-secondary-index-indexonly-plan-01/rtree-sidx-idxonly-01.1.ddl.aql
deleted file mode 100644
index 462122a..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/rtree-secondary-index-indexonly-plan-01/rtree-sidx-idxonly-01.1.ddl.aql
+++ /dev/null
@@ -1,107 +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     : Secondary RTree Index index-only selection plan verification test
- *                  : The test is intended to verify that the secondary RTree index is used in the optimized query plan.
- *                  : In this plan, we fetch PK and SK based on a select condition that utilizes a secondary index.
- *                  : The plan should have two paths after the secondary index-lookup.
- *                  : The left path:
- *                      ... -> unnest-map (sidx) -> split -> unnest-map (pidx) -> select -> union -> ...
- *                  : The right path:
- *                      ... -> unnest-map (sidx) -> split ->                                union -> ...
- *  Expected Result : Success
- *
-*/
-
-drop dataverse test if exists;
-create dataverse test;
-use dataverse test;
-
-/* For raw Fragile data */
-create type FragileTypeRaw as closed {
-  row_id: int32,
-  sid: int32,
-  date: string,
-  day: int32,
-  time: string,
-  bpm: int32,
-  RR: float,
-  /* new string field and location field*/
-  text: string,
-  location: point,
-  text2: string
-
-};
-
-/* For cleaned Fragile data */
-create type FragileType as closed {
-  row_id: int32,
-  sid: int32,
-  date: date,
-  day: int32,
-  time: time,
-  bpm: int32,
-  RR: float,
-
-  /* new string field and location field*/
-  text: string,
-  location: point,
-  text2: string
-};
-
-/* Create dataset for loading raw Fragile data */
-create dataset Fragile_raw (FragileTypeRaw)
-primary key row_id;
-
-/* Create dataset for cleaned Fragile data */
-create dataset Fragile (FragileType)
-primary key row_id;
-
-
-/* Create rtree secondary index on dataset clean Fragile */
-create index cfLocation on Fragile(location) type rtree;
-create index cfLocation on Fragile_raw(location) type rtree;
-
-create type MyRecord as closed {
-  id: int64,
-  docid: int64,
-  val1: int64,
-  title: string,
-  point: point,
-  kwds: string,
-  line1: line,
-  line2: line,
-  poly1: polygon,
-  poly2: polygon,
-  rec: rectangle,
-  circle: circle
-}
-
-create dataset MyData(MyRecord)
-  primary key id;
-
-create index btree_index_docid on MyData(docid) type btree;
-create index btree_index_val1 on MyData(val1) type btree;
-create index rtree_index_point on MyData(point) type rtree;
-create index rtree_index_rec on MyData(rec) type rtree;
-create index ngram_index_title on MyData(title) type ngram(3);
-create index keyword_index_title on MyData(title) type keyword;
-
-

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/211cbe1b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/rtree-secondary-index-indexonly-plan-01/rtree-sidx-idxonly-01.10.query.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/rtree-secondary-index-indexonly-plan-01/rtree-sidx-idxonly-01.10.query.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/rtree-secondary-index-indexonly-plan-01/rtree-sidx-idxonly-01.10.query.aql
deleted file mode 100644
index 98d86bd..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/rtree-secondary-index-indexonly-plan-01/rtree-sidx-idxonly-01.10.query.aql
+++ /dev/null
@@ -1,28 +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(
-let $area:=create-rectangle(point("0.0,0.0"), point("4.0,4.0"))
-for $o in dataset('MyData')
-where spatial-intersect($o.point, $area)
-order by $o.id
-return $o
-);

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/211cbe1b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/rtree-secondary-index-indexonly-plan-01/rtree-sidx-idxonly-01.11.query.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/rtree-secondary-index-indexonly-plan-01/rtree-sidx-idxonly-01.11.query.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/rtree-secondary-index-indexonly-plan-01/rtree-sidx-idxonly-01.11.query.aql
deleted file mode 100644
index 577c6f1..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/rtree-secondary-index-indexonly-plan-01/rtree-sidx-idxonly-01.11.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;
-
-//let $area:=create-rectangle(point("0.0,0.0"), point("4.0,4.0"))
-let $area:=create-circle(create-point(4.0,3.0), 5.0)
-for $o in dataset('MyData')
-where spatial-intersect($o.point, $area)
-order by $o.id
-return {"id":$o.id}

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/211cbe1b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/rtree-secondary-index-indexonly-plan-01/rtree-sidx-idxonly-01.2.update.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/rtree-secondary-index-indexonly-plan-01/rtree-sidx-idxonly-01.2.update.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/rtree-secondary-index-indexonly-plan-01/rtree-sidx-idxonly-01.2.update.aql
deleted file mode 100644
index cf3f316..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/rtree-secondary-index-indexonly-plan-01/rtree-sidx-idxonly-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 Fragile_raw using localfs
-(("path"="asterix_nc1://data/csv/fragile_02.adm"),("format"="adm")) pre-sorted;
-
-load dataset MyData
-using localfs
-(("path"="asterix_nc1://data/spatial/spatialData2.json"),("format"="adm"));
-