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 2019/11/04 12:08:35 UTC

[asterixdb] branch master updated (d203752 -> 43b223d)

This is an automated email from the ASF dual-hosted git repository.

mblow pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/asterixdb.git.


    from d203752  [NO ISSUE][DOC] Fix doc of recovery memory budget
     new a9a59ba  [ASTERIXDB-2665][DOC] fix typo in primer
     new ff271b7  [NO ISSUE][COMP] Fix internal error with composite key index
     new fe51374  Merge branch 'stabilization-f69489' into 'mad-hatter'
     new 43b223d  Merge branch 'gerrit/mad-hatter' into 'master'

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../am/AbstractIntroduceAccessMethodRule.java      |  2 +-
 .../btree-index/btree-composite-key-03.sqlpp       | 49 ++++++++++++++++++++++
 .../btree-composite-key-non-enforced-03.sqlpp      | 43 +++++++++++++++++++
 .../btree-index/btree-composite-key-03.plan        | 15 +++++++
 .../btree-index/non-enforced-composite-key/11.plan |  2 +-
 .../btree-composite-key-non-enforced-03.plan       | 17 ++++++++
 .../btree-index-composite-key-03.1.ddl.sqlpp       | 44 +++++++++++++++++++
 .../btree-index-composite-key-03.2.update.sqlpp    | 26 ++++++++++++
 .../btree-index-composite-key-03.3.query.sqlpp     | 28 +++++++++++++
 .../btree-index-composite-key-03.1.ddl.sqlpp       | 39 +++++++++++++++++
 .../btree-index-composite-key-03.2.update.sqlpp    | 35 ++++++++++++++++
 .../btree-index-composite-key-03.3.query.sqlpp     | 27 ++++++++++++
 .../btree-index-composite-key-03.3.adm             |  1 +
 .../btree-index-composite-key-03.3.adm}            |  0
 .../test/resources/runtimets/testsuite_sqlpp.xml   | 10 +++++
 .../asterix-doc/src/site/markdown/aql/primer.md    |  2 +-
 .../src/site/markdown/sqlpp/primer-sqlpp.md        |  2 +-
 17 files changed, 338 insertions(+), 4 deletions(-)
 create mode 100644 asterixdb/asterix-app/src/test/resources/optimizerts/queries/btree-index/btree-composite-key-03.sqlpp
 create mode 100644 asterixdb/asterix-app/src/test/resources/optimizerts/queries/open-index-non-enforced/btree-composite-key-non-enforced/btree-composite-key-non-enforced-03.sqlpp
 create mode 100644 asterixdb/asterix-app/src/test/resources/optimizerts/results/btree-index/btree-composite-key-03.plan
 create mode 100644 asterixdb/asterix-app/src/test/resources/optimizerts/results/open-index-non-enforced/btree-composite-key-non-enforced/btree-composite-key-non-enforced-03.plan
 create mode 100644 asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/index-selection/btree-index-composite-key-03/btree-index-composite-key-03.1.ddl.sqlpp
 create mode 100644 asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/index-selection/btree-index-composite-key-03/btree-index-composite-key-03.2.update.sqlpp
 create mode 100644 asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/index-selection/btree-index-composite-key-03/btree-index-composite-key-03.3.query.sqlpp
 create mode 100644 asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/open-index-non-enforced/index-selection/btree-index-composite-key-03/btree-index-composite-key-03.1.ddl.sqlpp
 create mode 100644 asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/open-index-non-enforced/index-selection/btree-index-composite-key-03/btree-index-composite-key-03.2.update.sqlpp
 create mode 100644 asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/open-index-non-enforced/index-selection/btree-index-composite-key-03/btree-index-composite-key-03.3.query.sqlpp
 create mode 100644 asterixdb/asterix-app/src/test/resources/runtimets/results/index-selection/btree-index-composite-key-03/btree-index-composite-key-03.3.adm
 copy asterixdb/asterix-app/src/test/resources/runtimets/results/{resolution/field_accessor_1/field_accessor_1.7.adm => open-index-non-enforced/index-selection/btree-index-composite-key-03/btree-index-composite-key-03.3.adm} (100%)


[asterixdb] 03/04: Merge branch 'stabilization-f69489' into 'mad-hatter'

Posted by mb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

mblow pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/asterixdb.git

commit fe51374f21cc03aebed5735ee21215b57e4ed52a
Merge: a9a59ba ff271b7
Author: Michael Blow <mb...@apache.org>
AuthorDate: Fri Nov 1 21:13:20 2019 -0400

    Merge branch 'stabilization-f69489' into 'mad-hatter'
    
    Change-Id: I3bcf787f56d8e9288c48d619df31cad452837ef7

 .../am/AbstractIntroduceAccessMethodRule.java      |  2 +-
 .../btree-index/btree-composite-key-03.sqlpp       | 49 ++++++++++++++++++++++
 .../btree-composite-key-non-enforced-03.sqlpp      | 43 +++++++++++++++++++
 .../btree-index/btree-composite-key-03.plan        | 15 +++++++
 .../btree-index/non-enforced-composite-key/11.plan |  2 +-
 .../btree-composite-key-non-enforced-03.plan       | 17 ++++++++
 .../btree-index-composite-key-03.1.ddl.sqlpp       | 44 +++++++++++++++++++
 .../btree-index-composite-key-03.2.update.sqlpp    | 26 ++++++++++++
 .../btree-index-composite-key-03.3.query.sqlpp     | 28 +++++++++++++
 .../btree-index-composite-key-03.1.ddl.sqlpp       | 39 +++++++++++++++++
 .../btree-index-composite-key-03.2.update.sqlpp    | 35 ++++++++++++++++
 .../btree-index-composite-key-03.3.query.sqlpp     | 27 ++++++++++++
 .../btree-index-composite-key-03.3.adm             |  1 +
 .../btree-index-composite-key-03.3.adm             |  1 +
 .../test/resources/runtimets/testsuite_sqlpp.xml   | 10 +++++
 15 files changed, 337 insertions(+), 2 deletions(-)

diff --cc asterixdb/asterix-app/src/test/resources/optimizerts/results/btree-index/btree-composite-key-03.plan
index 0000000,eb0128b..04345b1
mode 000000,100644..100644
--- a/asterixdb/asterix-app/src/test/resources/optimizerts/results/btree-index/btree-composite-key-03.plan
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/results/btree-index/btree-composite-key-03.plan
@@@ -1,0 -1,15 +1,15 @@@
+ -- DISTRIBUTE_RESULT  |PARTITIONED|
+   -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+     -- STREAM_SELECT  |PARTITIONED|
+       -- STREAM_PROJECT  |PARTITIONED|
+         -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+           -- BTREE_SEARCH  |PARTITIONED|
+             -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
 -              -- STABLE_SORT [$$23(ASC)]  |PARTITIONED|
++              -- STABLE_SORT [$$24(ASC)]  |PARTITIONED|
+                 -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                   -- STREAM_PROJECT  |PARTITIONED|
+                     -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                       -- BTREE_SEARCH  |PARTITIONED|
+                         -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                           -- ASSIGN  |PARTITIONED|
+                             -- EMPTY_TUPLE_SOURCE  |PARTITIONED|
diff --cc asterixdb/asterix-app/src/test/resources/optimizerts/results/nested-open-index/btree-index/non-enforced-composite-key/11.plan
index f43b2f5,813805c..af7f7c5
--- a/asterixdb/asterix-app/src/test/resources/optimizerts/results/nested-open-index/btree-index/non-enforced-composite-key/11.plan
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/results/nested-open-index/btree-index/non-enforced-composite-key/11.plan
@@@ -15,7 -15,7 +15,7 @@@
                              -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
                                -- BTREE_SEARCH  |PARTITIONED|
                                  -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                   -- STABLE_SORT [$$35(ASC)]  |PARTITIONED|
 -                                  -- STABLE_SORT [$$33(ASC)]  |PARTITIONED|
++                                  -- STABLE_SORT [$$34(ASC)]  |PARTITIONED|
                                      -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
                                        -- STREAM_PROJECT  |PARTITIONED|
                                          -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
diff --cc asterixdb/asterix-app/src/test/resources/optimizerts/results/open-index-non-enforced/btree-composite-key-non-enforced/btree-composite-key-non-enforced-03.plan
index 0000000,7a2ab4c..1323261
mode 000000,100644..100644
--- a/asterixdb/asterix-app/src/test/resources/optimizerts/results/open-index-non-enforced/btree-composite-key-non-enforced/btree-composite-key-non-enforced-03.plan
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/results/open-index-non-enforced/btree-composite-key-non-enforced/btree-composite-key-non-enforced-03.plan
@@@ -1,0 -1,17 +1,17 @@@
+ -- DISTRIBUTE_RESULT  |PARTITIONED|
+   -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+     -- STREAM_PROJECT  |PARTITIONED|
+       -- STREAM_SELECT  |PARTITIONED|
+         -- ASSIGN  |PARTITIONED|
+           -- STREAM_PROJECT  |PARTITIONED|
+             -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+               -- BTREE_SEARCH  |PARTITIONED|
+                 -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
 -                  -- STABLE_SORT [$$25(ASC)]  |PARTITIONED|
++                  -- STABLE_SORT [$$26(ASC)]  |PARTITIONED|
+                     -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                       -- STREAM_PROJECT  |PARTITIONED|
+                         -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                           -- BTREE_SEARCH  |PARTITIONED|
+                             -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                               -- ASSIGN  |PARTITIONED|
+                                 -- EMPTY_TUPLE_SOURCE  |PARTITIONED|


[asterixdb] 02/04: [ASTERIXDB-2665][DOC] fix typo in primer

Posted by mb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

mblow pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/asterixdb.git

commit a9a59ba1c991d5755b30b757544eafd51d200ad4
Author: Till Westmann <ti...@apache.org>
AuthorDate: Mon Oct 28 15:41:40 2019 -0700

    [ASTERIXDB-2665][DOC] fix typo in primer
    
    - user model changes: yes
    - storage format changes: no
    - interface changes: no
    
    Change-Id: I7b1114c4e61f50881879ecb2ca455a96bd1734a0
    Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/3945
    Tested-by: Jenkins <je...@fulliautomatix.ics.uci.edu>
    Integration-Tests: Jenkins <je...@fulliautomatix.ics.uci.edu>
    Reviewed-by: Murtadha Hubail <mh...@apache.org>
---
 asterixdb/asterix-doc/src/site/markdown/aql/primer.md         | 2 +-
 asterixdb/asterix-doc/src/site/markdown/sqlpp/primer-sqlpp.md | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/asterixdb/asterix-doc/src/site/markdown/aql/primer.md b/asterixdb/asterix-doc/src/site/markdown/aql/primer.md
index 72406c0..bbefdce 100644
--- a/asterixdb/asterix-doc/src/site/markdown/aql/primer.md
+++ b/asterixdb/asterix-doc/src/site/markdown/aql/primer.md
@@ -577,7 +577,7 @@ for each user, it constructs a result object containing a "uname" field with the
 name and a "messages" field with a nested collection of all messages for that user.
 The nested collection for each user is specified by using a correlated subquery.
 (Note: While it looks like nested loops could be involved in computing the result,
-AsterixDB recogizes the equivalence of such a query to an outerjoin, and it will
+AsterixDB recognizes the equivalence of such a query to an outerjoin, and it will
 use an efficient hash-based strategy when actually computing the query's result.)
 
 Here is this example query's expected output:
diff --git a/asterixdb/asterix-doc/src/site/markdown/sqlpp/primer-sqlpp.md b/asterixdb/asterix-doc/src/site/markdown/sqlpp/primer-sqlpp.md
index 48eba96..2d78b01 100644
--- a/asterixdb/asterix-doc/src/site/markdown/sqlpp/primer-sqlpp.md
+++ b/asterixdb/asterix-doc/src/site/markdown/sqlpp/primer-sqlpp.md
@@ -581,7 +581,7 @@ for each user, it constructs a result object containing a "uname" field with the
 name and a "messages" field with a nested collection of all messages for that user.
 The nested collection for each user is specified by using a correlated subquery.
 (Note: While it looks like nested loops could be involved in computing the result,
-AsterixDB recogizes the equivalence of such a query to an outerjoin, and it will
+AsterixDB recognizes the equivalence of such a query to an outerjoin, and it will
 use an efficient hash-based strategy when actually computing the query's result.)
 
 Here is this example query's expected output:


[asterixdb] 04/04: Merge branch 'gerrit/mad-hatter' into 'master'

Posted by mb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

mblow pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/asterixdb.git

commit 43b223da08a43bd74ed4fb20642415e770c5fe32
Merge: d203752 fe51374
Author: Michael Blow <mb...@apache.org>
AuthorDate: Sun Nov 3 09:48:41 2019 -0500

    Merge branch 'gerrit/mad-hatter' into 'master'
    
    Change-Id: Id4a51ee33442e636f15cd812128077315f6599c0

 .../am/AbstractIntroduceAccessMethodRule.java      |  2 +-
 .../btree-index/btree-composite-key-03.sqlpp       | 49 ++++++++++++++++++++++
 .../btree-composite-key-non-enforced-03.sqlpp      | 43 +++++++++++++++++++
 .../btree-index/btree-composite-key-03.plan        | 15 +++++++
 .../btree-index/non-enforced-composite-key/11.plan |  2 +-
 .../btree-composite-key-non-enforced-03.plan       | 17 ++++++++
 .../btree-index-composite-key-03.1.ddl.sqlpp       | 44 +++++++++++++++++++
 .../btree-index-composite-key-03.2.update.sqlpp    | 26 ++++++++++++
 .../btree-index-composite-key-03.3.query.sqlpp     | 28 +++++++++++++
 .../btree-index-composite-key-03.1.ddl.sqlpp       | 39 +++++++++++++++++
 .../btree-index-composite-key-03.2.update.sqlpp    | 35 ++++++++++++++++
 .../btree-index-composite-key-03.3.query.sqlpp     | 27 ++++++++++++
 .../btree-index-composite-key-03.3.adm             |  1 +
 .../btree-index-composite-key-03.3.adm             |  1 +
 .../test/resources/runtimets/testsuite_sqlpp.xml   | 10 +++++
 .../asterix-doc/src/site/markdown/aql/primer.md    |  2 +-
 .../src/site/markdown/sqlpp/primer-sqlpp.md        |  2 +-
 17 files changed, 339 insertions(+), 4 deletions(-)



[asterixdb] 01/04: [NO ISSUE][COMP] Fix internal error with composite key index

Posted by mb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

mblow pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/asterixdb.git

commit ff271b71ac132def49f3d72653218aa31a58ae10
Author: Dmitry Lychagin <dm...@couchbase.com>
AuthorDate: Thu Oct 31 11:09:25 2019 -0700

    [NO ISSUE][COMP] Fix internal error with composite key index
    
    - user model changes: no
    - storage format changes: no
    - interface changes: no
    
    Details:
    - Fixed ArrayIndexOutOfBoundsException in
      BTreeAccessMethod.createIndexSearchPlan() when
      there's a composite key index and a query predicate
      that operates on a subset of its key fields.
      E.g.
      create index ... on .. (a,b,c);
      select ... from ... where a = ... and c = ...
    
    Change-Id: I87deb2537a97789b93a7174f97470b46a0558188
    Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/4003
    Tested-by: Jenkins <je...@fulliautomatix.ics.uci.edu>
    Integration-Tests: Jenkins <je...@fulliautomatix.ics.uci.edu>
    Reviewed-by: Ali Alsuliman <al...@gmail.com>
---
 .../am/AbstractIntroduceAccessMethodRule.java      |  2 +-
 .../btree-index/btree-composite-key-03.sqlpp       | 49 ++++++++++++++++++++++
 .../btree-composite-key-non-enforced-03.sqlpp      | 43 +++++++++++++++++++
 .../btree-index/btree-composite-key-03.plan        | 15 +++++++
 .../btree-index/non-enforced-composite-key/11.plan |  2 +-
 .../btree-composite-key-non-enforced-03.plan       | 17 ++++++++
 .../btree-index-composite-key-03.1.ddl.sqlpp       | 44 +++++++++++++++++++
 .../btree-index-composite-key-03.2.update.sqlpp    | 26 ++++++++++++
 .../btree-index-composite-key-03.3.query.sqlpp     | 28 +++++++++++++
 .../btree-index-composite-key-03.1.ddl.sqlpp       | 39 +++++++++++++++++
 .../btree-index-composite-key-03.2.update.sqlpp    | 35 ++++++++++++++++
 .../btree-index-composite-key-03.3.query.sqlpp     | 27 ++++++++++++
 .../btree-index-composite-key-03.3.adm             |  1 +
 .../btree-index-composite-key-03.3.adm             |  1 +
 .../test/resources/runtimets/testsuite_sqlpp.xml   | 10 +++++
 15 files changed, 337 insertions(+), 2 deletions(-)

diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/AbstractIntroduceAccessMethodRule.java b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/AbstractIntroduceAccessMethodRule.java
index d232ce0..6583342 100644
--- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/AbstractIntroduceAccessMethodRule.java
+++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/AbstractIntroduceAccessMethodRule.java
@@ -285,13 +285,13 @@ public abstract class AbstractIntroduceAccessMethodRule implements IAlgebraicRew
 
             boolean allUsed = true;
             int lastFieldMatched = -1;
-            boolean foundKeyField = false;
             matchedExpressions.clear();
             numMatchedKeys = 0;
 
             for (int i = 0; i < index.getKeyFieldNames().size(); i++) {
                 List<String> keyField = index.getKeyFieldNames().get(i);
                 final IAType keyType = index.getKeyFieldTypes().get(i);
+                boolean foundKeyField = false;
                 Iterator<Pair<Integer, Integer>> exprsAndVarIter = indexExprAndVarEntry.getValue().iterator();
                 while (exprsAndVarIter.hasNext()) {
                     final Pair<Integer, Integer> exprAndVarIdx = exprsAndVarIter.next();
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/queries/btree-index/btree-composite-key-03.sqlpp b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/btree-index/btree-composite-key-03.sqlpp
new file mode 100644
index 0000000..5cfe1f3
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/btree-index/btree-composite-key-03.sqlpp
@@ -0,0 +1,49 @@
+/*
+ * 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 BTree index is used in query plan.
+ *                 : Query predicate that skips one of the indexed
+ *                 : fields of a composite index.
+ *                 : Define the BTree index on a composite key (fname,age,lname)
+ *                 : predicate => WHERE fname = ... and lname = ...
+ * Expected Result : Success
+ */
+
+drop  dataverse test if exists;
+create  dataverse test;
+
+use test;
+
+create type test.Emp as
+ closed {
+  id : bigint,
+  fname : string,
+  lname : string,
+  age : bigint,
+  dept : string
+};
+
+create  dataset employee(Emp) primary key id;
+
+create  index idx_employee_fal  on employee (fname,age,lname) type btree;
+
+select element l
+from  employee as l
+where ((l.fname = 'Julio') and (l.lname = 'Isa'))
+;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/queries/open-index-non-enforced/btree-composite-key-non-enforced/btree-composite-key-non-enforced-03.sqlpp b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/open-index-non-enforced/btree-composite-key-non-enforced/btree-composite-key-non-enforced-03.sqlpp
new file mode 100644
index 0000000..b644b15
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/open-index-non-enforced/btree-composite-key-non-enforced/btree-composite-key-non-enforced-03.sqlpp
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+* Description  : Index selection for non-enforced indexes.
+*              : Query predicate that skips one of the indexed
+*              : fields of a composite index.
+*              : Define the BTree index on a composite key (c_x,c_y,c_z)
+*              : predicate => WHERE c_x = ... and c_z = ...
+* Expected Res : Success
+* Date         : 10 Oct 2019
+*/
+drop dataverse test if exists;
+create dataverse test;
+use test;
+
+create type TestOpenType as open {
+  c_id: int64
+};
+
+create dataset TestOpen(TestOpenType)
+primary key c_id;
+
+create index idx_xyz on TestOpen(c_x:string, c_y:string, c_z:string);
+
+select value t.c_value
+from TestOpen t
+where c_x = "x2" AND c_z = "z2";
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/results/btree-index/btree-composite-key-03.plan b/asterixdb/asterix-app/src/test/resources/optimizerts/results/btree-index/btree-composite-key-03.plan
new file mode 100644
index 0000000..eb0128b
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/results/btree-index/btree-composite-key-03.plan
@@ -0,0 +1,15 @@
+-- DISTRIBUTE_RESULT  |PARTITIONED|
+  -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+    -- STREAM_SELECT  |PARTITIONED|
+      -- STREAM_PROJECT  |PARTITIONED|
+        -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+          -- BTREE_SEARCH  |PARTITIONED|
+            -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+              -- STABLE_SORT [$$23(ASC)]  |PARTITIONED|
+                -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                  -- STREAM_PROJECT  |PARTITIONED|
+                    -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                      -- BTREE_SEARCH  |PARTITIONED|
+                        -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                          -- ASSIGN  |PARTITIONED|
+                            -- EMPTY_TUPLE_SOURCE  |PARTITIONED|
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/results/nested-open-index/btree-index/non-enforced-composite-key/11.plan b/asterixdb/asterix-app/src/test/resources/optimizerts/results/nested-open-index/btree-index/non-enforced-composite-key/11.plan
index 9c6b8d7..813805c 100644
--- a/asterixdb/asterix-app/src/test/resources/optimizerts/results/nested-open-index/btree-index/non-enforced-composite-key/11.plan
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/results/nested-open-index/btree-index/non-enforced-composite-key/11.plan
@@ -15,7 +15,7 @@
                             -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
                               -- BTREE_SEARCH  |PARTITIONED|
                                 -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                  -- STABLE_SORT [$$34(ASC)]  |PARTITIONED|
+                                  -- STABLE_SORT [$$33(ASC)]  |PARTITIONED|
                                     -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
                                       -- STREAM_PROJECT  |PARTITIONED|
                                         -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/results/open-index-non-enforced/btree-composite-key-non-enforced/btree-composite-key-non-enforced-03.plan b/asterixdb/asterix-app/src/test/resources/optimizerts/results/open-index-non-enforced/btree-composite-key-non-enforced/btree-composite-key-non-enforced-03.plan
new file mode 100644
index 0000000..7a2ab4c
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/results/open-index-non-enforced/btree-composite-key-non-enforced/btree-composite-key-non-enforced-03.plan
@@ -0,0 +1,17 @@
+-- DISTRIBUTE_RESULT  |PARTITIONED|
+  -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+    -- STREAM_PROJECT  |PARTITIONED|
+      -- STREAM_SELECT  |PARTITIONED|
+        -- ASSIGN  |PARTITIONED|
+          -- STREAM_PROJECT  |PARTITIONED|
+            -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+              -- BTREE_SEARCH  |PARTITIONED|
+                -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                  -- STABLE_SORT [$$25(ASC)]  |PARTITIONED|
+                    -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                      -- STREAM_PROJECT  |PARTITIONED|
+                        -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                          -- BTREE_SEARCH  |PARTITIONED|
+                            -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                              -- ASSIGN  |PARTITIONED|
+                                -- EMPTY_TUPLE_SOURCE  |PARTITIONED|
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/index-selection/btree-index-composite-key-03/btree-index-composite-key-03.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/index-selection/btree-index-composite-key-03/btree-index-composite-key-03.1.ddl.sqlpp
new file mode 100644
index 0000000..29c9879
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/index-selection/btree-index-composite-key-03/btree-index-composite-key-03.1.ddl.sqlpp
@@ -0,0 +1,44 @@
+/*
+ * 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 BTree index is used in query plan.
+ *                 : Query predicate that skips one of the indexed
+ *                 : fields of a composite index.
+ *                 : define the BTree index on a composite key (fname,age,lname)
+ *                 : predicate => WHERE fname = ... and lname = ...
+ * Expected Result : Success
+ */
+
+drop  dataverse test if exists;
+create  dataverse test;
+
+use test;
+
+create type test.Emp as
+ closed {
+  id : bigint,
+  fname : string,
+  lname : string,
+  age : bigint,
+  dept : string
+};
+
+create  dataset employee(Emp) primary key id;
+
+create  index idx_employee_fal  on employee (fname,age,lname) type btree;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/index-selection/btree-index-composite-key-03/btree-index-composite-key-03.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/index-selection/btree-index-composite-key-03/btree-index-composite-key-03.2.update.sqlpp
new file mode 100644
index 0000000..dd393dd
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/index-selection/btree-index-composite-key-03/btree-index-composite-key-03.2.update.sqlpp
@@ -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.
+ */
+/*
+ * Description     : Test that BTree index is used in query plan
+ * Expected Result : Success
+ */
+
+use test;
+
+load  dataset employee using localfs ((`path`=`asterix_nc1://data/names.adm`),(`format`=`delimited-text`),(`delimiter`=`|`));
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/index-selection/btree-index-composite-key-03/btree-index-composite-key-03.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/index-selection/btree-index-composite-key-03/btree-index-composite-key-03.3.query.sqlpp
new file mode 100644
index 0000000..9890089
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/index-selection/btree-index-composite-key-03/btree-index-composite-key-03.3.query.sqlpp
@@ -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.
+ */
+/*
+ * Description     : Test that BTree index is used in query plan
+ * Expected Result : Success
+ */
+
+use test;
+
+select element l
+from  employee as l
+where ((l.fname = 'Julio') and (l.lname = 'Isa'));
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/open-index-non-enforced/index-selection/btree-index-composite-key-03/btree-index-composite-key-03.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/open-index-non-enforced/index-selection/btree-index-composite-key-03/btree-index-composite-key-03.1.ddl.sqlpp
new file mode 100644
index 0000000..88441c9
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/open-index-non-enforced/index-selection/btree-index-composite-key-03/btree-index-composite-key-03.1.ddl.sqlpp
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+* Description  : Index selection for non-enforced indexes.
+*              : Query predicate that skips one of the indexed
+*              : fields of a composite index.
+*              : Define the BTree index on a composite key (c_x,c_y,c_z)
+*              : predicate => WHERE c_x = ... and c_z = ...
+* Expected Res : Success
+* Date         : 10 Oct 2019
+*/
+drop dataverse test if exists;
+create dataverse test;
+use test;
+
+create type TestOpenType as open {
+  c_id: int64
+};
+
+create dataset TestOpen(TestOpenType)
+primary key c_id;
+
+create index idx_xyz on TestOpen(c_x:string, c_y:string, c_z:string);
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/open-index-non-enforced/index-selection/btree-index-composite-key-03/btree-index-composite-key-03.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/open-index-non-enforced/index-selection/btree-index-composite-key-03/btree-index-composite-key-03.2.update.sqlpp
new file mode 100644
index 0000000..9027b57
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/open-index-non-enforced/index-selection/btree-index-composite-key-03/btree-index-composite-key-03.2.update.sqlpp
@@ -0,0 +1,35 @@
+/*
+ * 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 test;
+
+insert into TestOpen ({
+    "c_id": 1,
+    "c_x": "x1",
+    "c_y": "y1",
+    "c_z": "z1",
+    "c_value": 1
+});
+insert into TestOpen ({
+    "c_id": 2,
+    "c_x": "x2",
+    "c_y": "y2",
+    "c_z": "z2",
+    "c_value": 2
+});
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/open-index-non-enforced/index-selection/btree-index-composite-key-03/btree-index-composite-key-03.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/open-index-non-enforced/index-selection/btree-index-composite-key-03/btree-index-composite-key-03.3.query.sqlpp
new file mode 100644
index 0000000..f9b4fdd
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/open-index-non-enforced/index-selection/btree-index-composite-key-03/btree-index-composite-key-03.3.query.sqlpp
@@ -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 test;
+
+/* The index is on (c_x, c_y, c_z), but
+   the WHERE clause only has c_x and c_z */
+
+select value t.c_value
+from TestOpen t
+where c_x = "x2" AND c_z = "z2";
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/index-selection/btree-index-composite-key-03/btree-index-composite-key-03.3.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/index-selection/btree-index-composite-key-03/btree-index-composite-key-03.3.adm
new file mode 100644
index 0000000..99238f8
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/index-selection/btree-index-composite-key-03/btree-index-composite-key-03.3.adm
@@ -0,0 +1 @@
+{ "id": 881, "fname": "Julio", "lname": "Isa", "age": 38, "dept": "Sales" }
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/open-index-non-enforced/index-selection/btree-index-composite-key-03/btree-index-composite-key-03.3.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/open-index-non-enforced/index-selection/btree-index-composite-key-03/btree-index-composite-key-03.3.adm
new file mode 100644
index 0000000..d8263ee
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/open-index-non-enforced/index-selection/btree-index-composite-key-03/btree-index-composite-key-03.3.adm
@@ -0,0 +1 @@
+2
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
index e49b36d..929ecd5 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
@@ -3332,6 +3332,11 @@
       </compilation-unit>
     </test-case>
     <test-case FilePath="index-selection">
+      <compilation-unit name="btree-index-composite-key-03">
+        <output-dir compare="Text">btree-index-composite-key-03</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="index-selection">
       <compilation-unit name="btree-sec-primary-index">
         <output-dir compare="Text">btree-sec-primary-index</output-dir>
       </compilation-unit>
@@ -4243,6 +4248,11 @@
           <output-dir compare="Text">btree-index-04</output-dir>
         </compilation-unit>
       </test-case>
+      <test-case FilePath="open-index-non-enforced/index-selection">
+        <compilation-unit name="btree-index-composite-key-03">
+          <output-dir compare="Text">btree-index-composite-key-03</output-dir>
+        </compilation-unit>
+      </test-case>
       <test-case FilePath="open-index-non-enforced/correlated-index-selection">
         <compilation-unit name="btree-index-01">
           <output-dir compare="Text">btree-index-01</output-dir>