asterixdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wangs...@apache.org
Subject [4/4] asterixdb git commit: ASTERIXDB-1186: fixed a composite primary index search issue.
Date Thu, 25 Aug 2016 20:00:11 GMT
ASTERIXDB-1186: fixed a composite primary index search issue.

 - Providing only one field to a composite primary index search
   now works properly by broadcasting search predicates to all nodes.

Change-Id: I0f75229ea804a02e7cacd04f7269a4907668eab0
Reviewed-on: https://asterix-gerrit.ics.uci.edu/1094
Sonar-Qube: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Taewoo Kim <wangsaeu@yahoo.com>


Project: http://git-wip-us.apache.org/repos/asf/asterixdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/asterixdb/commit/52a9d992
Tree: http://git-wip-us.apache.org/repos/asf/asterixdb/tree/52a9d992
Diff: http://git-wip-us.apache.org/repos/asf/asterixdb/diff/52a9d992

Branch: refs/heads/master
Commit: 52a9d992dfadf6bb3057968416bf217c9a42dffb
Parents: fdc71eb
Author: Taewoo Kim <wangsaeu@yahoo.com>
Authored: Wed Aug 24 11:37:43 2016 -0700
Committer: Taewoo Kim <wangsaeu@yahoo.com>
Committed: Thu Aug 25 12:51:52 2016 -0700

----------------------------------------------------------------------
 .../physical/BTreeSearchPOperator.java          |   43 +-
 .../primary-composite-key-prefix-join_03.plan   |    2 +-
 .../primary-composite-key-prefix-join_04.plan   |    4 +-
 .../primary-composite-key-prefix-join_05.plan   |    4 +-
 .../primary-composite-key-prefix-join_06.plan   |    4 +-
 .../primary-composite-key-prefix-join_03.plan   |   17 +-
 .../primary-composite-key-prefix-join_04.plan   |   17 +-
 .../primary-composite-key-prefix-join_05.plan   |   17 +-
 .../primary-composite-key-prefix-join_06.plan   |   17 +-
 .../cross-dv19/cross-dv19.3.query.aql           |    1 +
 .../btree-index-composite-key-02.1.ddl.aql      |   68 +
 .../btree-index-composite-key-02.2.update.aql   |   28 +
 .../btree-index-composite-key-02.3.query.aql    |   28 +
 .../btree-index-composite-key-02.4.query.aql    |   28 +
 .../cross-dv19/cross-dv19.3.query.sqlpp         |    1 +
 .../btree-index-composite-key-02.3.adm          | 6005 ++++++++++++++++++
 .../btree-index-composite-key-02.4.adm          | 6005 ++++++++++++++++++
 .../cross-dataverse/cross-dv19/cross-dv19.3.ast |   17 +
 .../src/test/resources/runtimets/testsuite.xml  |    5 +
 .../asterix/metadata/declared/AqlIndex.java     |    7 +-
 20 files changed, 12252 insertions(+), 66 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52a9d992/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/algebra/operators/physical/BTreeSearchPOperator.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/algebra/operators/physical/BTreeSearchPOperator.java
b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/algebra/operators/physical/BTreeSearchPOperator.java
index 69665a8..c3796ac 100644
--- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/algebra/operators/physical/BTreeSearchPOperator.java
+++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/algebra/operators/physical/BTreeSearchPOperator.java
@@ -21,9 +21,11 @@ package org.apache.asterix.algebra.operators.physical;
 import java.util.ArrayList;
 import java.util.List;
 
+import org.apache.asterix.metadata.declared.AqlIndex;
 import org.apache.asterix.metadata.declared.AqlMetadataProvider;
 import org.apache.asterix.metadata.declared.AqlSourceId;
 import org.apache.asterix.metadata.entities.Dataset;
+import org.apache.asterix.metadata.entities.Index;
 import org.apache.asterix.om.functions.AsterixBuiltinFunctions;
 import org.apache.asterix.optimizer.rules.am.BTreeJobGenParams;
 import org.apache.hyracks.algebricks.common.constraints.AlgebricksPartitionConstraint;
@@ -146,25 +148,32 @@ public class BTreeSearchPOperator extends IndexSearchPOperator {
         if (requiresBroadcast) {
             // For primary indexes optimizing an equality condition we can reduce the broadcast
requirement to hash partitioning.
             if (isPrimaryIndex && isEqCondition) {
-                StructuralPropertiesVector[] pv = new StructuralPropertiesVector[1];
-                ListSet<LogicalVariable> searchKeyVars = new ListSet<LogicalVariable>();
-                searchKeyVars.addAll(lowKeyVarList);
-                searchKeyVars.addAll(highKeyVarList);
-                // Also, add a local sorting property to enforce a sort before the primary-index
operator.
-                List<ILocalStructuralProperty> propsLocal = new ArrayList<ILocalStructuralProperty>();
-                List<OrderColumn> orderColumns = new ArrayList<OrderColumn>();
-                for (LogicalVariable orderVar : searchKeyVars) {
-                    orderColumns.add(new OrderColumn(orderVar, OrderKind.ASC));
+
+                // If this is a composite primary index, then all of the keys should be provided.
+                Index searchIndex = ((AqlIndex) idx).getIndex();
+                int numberOfKeyFields = searchIndex.getKeyFieldNames().size();
+
+                if (numberOfKeyFields < 2
+                        || (lowKeyVarList.size() == numberOfKeyFields && highKeyVarList.size()
== numberOfKeyFields)) {
+                    StructuralPropertiesVector[] pv = new StructuralPropertiesVector[1];
+                    ListSet<LogicalVariable> searchKeyVars = new ListSet<>();
+                    searchKeyVars.addAll(lowKeyVarList);
+                    searchKeyVars.addAll(highKeyVarList);
+                    // Also, add a local sorting property to enforce a sort before the primary-index
operator.
+                    List<ILocalStructuralProperty> propsLocal = new ArrayList<>();
+                    List<OrderColumn> orderColumns = new ArrayList<>();
+                    for (LogicalVariable orderVar : searchKeyVars) {
+                        orderColumns.add(new OrderColumn(orderVar, OrderKind.ASC));
+                    }
+                    propsLocal.add(new LocalOrderProperty(orderColumns));
+                    pv[0] = new StructuralPropertiesVector(new UnorderedPartitionedProperty(searchKeyVars,
domain),
+                            propsLocal);
+                    return new PhysicalRequirements(pv, IPartitioningRequirementsCoordinator.NO_COORDINATION);
                 }
-                propsLocal.add(new LocalOrderProperty(orderColumns));
-                pv[0] = new StructuralPropertiesVector(new UnorderedPartitionedProperty(searchKeyVars,
domain),
-                        propsLocal);
-                return new PhysicalRequirements(pv, IPartitioningRequirementsCoordinator.NO_COORDINATION);
-            } else {
-                StructuralPropertiesVector[] pv = new StructuralPropertiesVector[1];
-                pv[0] = new StructuralPropertiesVector(new BroadcastPartitioningProperty(domain),
null);
-                return new PhysicalRequirements(pv, IPartitioningRequirementsCoordinator.NO_COORDINATION);
             }
+            StructuralPropertiesVector[] pv = new StructuralPropertiesVector[1];
+            pv[0] = new StructuralPropertiesVector(new BroadcastPartitioningProperty(domain),
null);
+            return new PhysicalRequirements(pv, IPartitioningRequirementsCoordinator.NO_COORDINATION);
         } else {
             return super.getRequiredPropertiesForChildren(op, reqdByParent, context);
         }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52a9d992/asterixdb/asterix-app/src/test/resources/optimizerts/results/btree-index-join/primary-composite-key-prefix-join_03.plan
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/results/btree-index-join/primary-composite-key-prefix-join_03.plan
b/asterixdb/asterix-app/src/test/resources/optimizerts/results/btree-index-join/primary-composite-key-prefix-join_03.plan
index 33e6c10..5814a93 100644
--- a/asterixdb/asterix-app/src/test/resources/optimizerts/results/btree-index-join/primary-composite-key-prefix-join_03.plan
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/results/btree-index-join/primary-composite-key-prefix-join_03.plan
@@ -6,7 +6,7 @@
           -- STREAM_SELECT  |PARTITIONED|
             -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
               -- BTREE_SEARCH  |PARTITIONED|
-                -- HASH_PARTITION_MERGE_EXCHANGE MERGE:[$$12(ASC), $$13(ASC)] HASH:[$$12]
 |PARTITIONED|
+                -- BROADCAST_EXCHANGE  |PARTITIONED|
                   -- DATASOURCE_SCAN  |PARTITIONED|
                     -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
                       -- EMPTY_TUPLE_SOURCE  |PARTITIONED|

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52a9d992/asterixdb/asterix-app/src/test/resources/optimizerts/results/btree-index-join/primary-composite-key-prefix-join_04.plan
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/results/btree-index-join/primary-composite-key-prefix-join_04.plan
b/asterixdb/asterix-app/src/test/resources/optimizerts/results/btree-index-join/primary-composite-key-prefix-join_04.plan
index 721af36..5814a93 100644
--- a/asterixdb/asterix-app/src/test/resources/optimizerts/results/btree-index-join/primary-composite-key-prefix-join_04.plan
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/results/btree-index-join/primary-composite-key-prefix-join_04.plan
@@ -6,7 +6,7 @@
           -- STREAM_SELECT  |PARTITIONED|
             -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
               -- BTREE_SEARCH  |PARTITIONED|
-                -- HASH_PARTITION_MERGE_EXCHANGE MERGE:[$$12(ASC), $$13(ASC)] HASH:[$$12]
 |PARTITIONED|
+                -- BROADCAST_EXCHANGE  |PARTITIONED|
                   -- DATASOURCE_SCAN  |PARTITIONED|
                     -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                      -- EMPTY_TUPLE_SOURCE  |PARTITIONED|
\ No newline at end of file
+                      -- EMPTY_TUPLE_SOURCE  |PARTITIONED|

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52a9d992/asterixdb/asterix-app/src/test/resources/optimizerts/results/btree-index-join/primary-composite-key-prefix-join_05.plan
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/results/btree-index-join/primary-composite-key-prefix-join_05.plan
b/asterixdb/asterix-app/src/test/resources/optimizerts/results/btree-index-join/primary-composite-key-prefix-join_05.plan
index 721af36..5814a93 100644
--- a/asterixdb/asterix-app/src/test/resources/optimizerts/results/btree-index-join/primary-composite-key-prefix-join_05.plan
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/results/btree-index-join/primary-composite-key-prefix-join_05.plan
@@ -6,7 +6,7 @@
           -- STREAM_SELECT  |PARTITIONED|
             -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
               -- BTREE_SEARCH  |PARTITIONED|
-                -- HASH_PARTITION_MERGE_EXCHANGE MERGE:[$$12(ASC), $$13(ASC)] HASH:[$$12]
 |PARTITIONED|
+                -- BROADCAST_EXCHANGE  |PARTITIONED|
                   -- DATASOURCE_SCAN  |PARTITIONED|
                     -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                      -- EMPTY_TUPLE_SOURCE  |PARTITIONED|
\ No newline at end of file
+                      -- EMPTY_TUPLE_SOURCE  |PARTITIONED|

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52a9d992/asterixdb/asterix-app/src/test/resources/optimizerts/results/btree-index-join/primary-composite-key-prefix-join_06.plan
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/results/btree-index-join/primary-composite-key-prefix-join_06.plan
b/asterixdb/asterix-app/src/test/resources/optimizerts/results/btree-index-join/primary-composite-key-prefix-join_06.plan
index 721af36..5814a93 100644
--- a/asterixdb/asterix-app/src/test/resources/optimizerts/results/btree-index-join/primary-composite-key-prefix-join_06.plan
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/results/btree-index-join/primary-composite-key-prefix-join_06.plan
@@ -6,7 +6,7 @@
           -- STREAM_SELECT  |PARTITIONED|
             -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
               -- BTREE_SEARCH  |PARTITIONED|
-                -- HASH_PARTITION_MERGE_EXCHANGE MERGE:[$$12(ASC), $$13(ASC)] HASH:[$$12]
 |PARTITIONED|
+                -- BROADCAST_EXCHANGE  |PARTITIONED|
                   -- DATASOURCE_SCAN  |PARTITIONED|
                     -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                      -- EMPTY_TUPLE_SOURCE  |PARTITIONED|
\ No newline at end of file
+                      -- EMPTY_TUPLE_SOURCE  |PARTITIONED|

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52a9d992/asterixdb/asterix-app/src/test/resources/optimizerts/results/nested-index/btree-index-join/primary-composite-key-prefix-join_03.plan
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/results/nested-index/btree-index-join/primary-composite-key-prefix-join_03.plan
b/asterixdb/asterix-app/src/test/resources/optimizerts/results/nested-index/btree-index-join/primary-composite-key-prefix-join_03.plan
index 0fe5859..8bd7dc4 100644
--- a/asterixdb/asterix-app/src/test/resources/optimizerts/results/nested-index/btree-index-join/primary-composite-key-prefix-join_03.plan
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/results/nested-index/btree-index-join/primary-composite-key-prefix-join_03.plan
@@ -8,14 +8,11 @@
               -- STREAM_PROJECT  |PARTITIONED|
                 -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
                   -- BTREE_SEARCH  |PARTITIONED|
-                    -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                      -- STABLE_SORT [$$22(ASC)]  |PARTITIONED|
-                        -- HASH_PARTITION_EXCHANGE [$$22]  |PARTITIONED|
+                    -- BROADCAST_EXCHANGE  |PARTITIONED|
+                      -- ASSIGN  |PARTITIONED|
+                        -- ASSIGN  |PARTITIONED|
                           -- STREAM_PROJECT  |PARTITIONED|
-                            -- ASSIGN  |PARTITIONED|
-                              -- ASSIGN  |PARTITIONED|
-                                -- STREAM_PROJECT  |PARTITIONED|
-                                  -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                    -- DATASOURCE_SCAN  |PARTITIONED|
-                                      -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                        -- EMPTY_TUPLE_SOURCE  |PARTITIONED|
\ No newline at end of file
+                            -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                              -- DATASOURCE_SCAN  |PARTITIONED|
+                                -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                                  -- EMPTY_TUPLE_SOURCE  |PARTITIONED|

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52a9d992/asterixdb/asterix-app/src/test/resources/optimizerts/results/nested-index/btree-index-join/primary-composite-key-prefix-join_04.plan
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/results/nested-index/btree-index-join/primary-composite-key-prefix-join_04.plan
b/asterixdb/asterix-app/src/test/resources/optimizerts/results/nested-index/btree-index-join/primary-composite-key-prefix-join_04.plan
index 0fe5859..8bd7dc4 100644
--- a/asterixdb/asterix-app/src/test/resources/optimizerts/results/nested-index/btree-index-join/primary-composite-key-prefix-join_04.plan
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/results/nested-index/btree-index-join/primary-composite-key-prefix-join_04.plan
@@ -8,14 +8,11 @@
               -- STREAM_PROJECT  |PARTITIONED|
                 -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
                   -- BTREE_SEARCH  |PARTITIONED|
-                    -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                      -- STABLE_SORT [$$22(ASC)]  |PARTITIONED|
-                        -- HASH_PARTITION_EXCHANGE [$$22]  |PARTITIONED|
+                    -- BROADCAST_EXCHANGE  |PARTITIONED|
+                      -- ASSIGN  |PARTITIONED|
+                        -- ASSIGN  |PARTITIONED|
                           -- STREAM_PROJECT  |PARTITIONED|
-                            -- ASSIGN  |PARTITIONED|
-                              -- ASSIGN  |PARTITIONED|
-                                -- STREAM_PROJECT  |PARTITIONED|
-                                  -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                    -- DATASOURCE_SCAN  |PARTITIONED|
-                                      -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                        -- EMPTY_TUPLE_SOURCE  |PARTITIONED|
\ No newline at end of file
+                            -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                              -- DATASOURCE_SCAN  |PARTITIONED|
+                                -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                                  -- EMPTY_TUPLE_SOURCE  |PARTITIONED|

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52a9d992/asterixdb/asterix-app/src/test/resources/optimizerts/results/nested-index/btree-index-join/primary-composite-key-prefix-join_05.plan
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/results/nested-index/btree-index-join/primary-composite-key-prefix-join_05.plan
b/asterixdb/asterix-app/src/test/resources/optimizerts/results/nested-index/btree-index-join/primary-composite-key-prefix-join_05.plan
index 0fe5859..8bd7dc4 100644
--- a/asterixdb/asterix-app/src/test/resources/optimizerts/results/nested-index/btree-index-join/primary-composite-key-prefix-join_05.plan
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/results/nested-index/btree-index-join/primary-composite-key-prefix-join_05.plan
@@ -8,14 +8,11 @@
               -- STREAM_PROJECT  |PARTITIONED|
                 -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
                   -- BTREE_SEARCH  |PARTITIONED|
-                    -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                      -- STABLE_SORT [$$22(ASC)]  |PARTITIONED|
-                        -- HASH_PARTITION_EXCHANGE [$$22]  |PARTITIONED|
+                    -- BROADCAST_EXCHANGE  |PARTITIONED|
+                      -- ASSIGN  |PARTITIONED|
+                        -- ASSIGN  |PARTITIONED|
                           -- STREAM_PROJECT  |PARTITIONED|
-                            -- ASSIGN  |PARTITIONED|
-                              -- ASSIGN  |PARTITIONED|
-                                -- STREAM_PROJECT  |PARTITIONED|
-                                  -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                    -- DATASOURCE_SCAN  |PARTITIONED|
-                                      -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                        -- EMPTY_TUPLE_SOURCE  |PARTITIONED|
\ No newline at end of file
+                            -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                              -- DATASOURCE_SCAN  |PARTITIONED|
+                                -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                                  -- EMPTY_TUPLE_SOURCE  |PARTITIONED|

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52a9d992/asterixdb/asterix-app/src/test/resources/optimizerts/results/nested-index/btree-index-join/primary-composite-key-prefix-join_06.plan
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/results/nested-index/btree-index-join/primary-composite-key-prefix-join_06.plan
b/asterixdb/asterix-app/src/test/resources/optimizerts/results/nested-index/btree-index-join/primary-composite-key-prefix-join_06.plan
index 0fe5859..8bd7dc4 100644
--- a/asterixdb/asterix-app/src/test/resources/optimizerts/results/nested-index/btree-index-join/primary-composite-key-prefix-join_06.plan
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/results/nested-index/btree-index-join/primary-composite-key-prefix-join_06.plan
@@ -8,14 +8,11 @@
               -- STREAM_PROJECT  |PARTITIONED|
                 -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
                   -- BTREE_SEARCH  |PARTITIONED|
-                    -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                      -- STABLE_SORT [$$22(ASC)]  |PARTITIONED|
-                        -- HASH_PARTITION_EXCHANGE [$$22]  |PARTITIONED|
+                    -- BROADCAST_EXCHANGE  |PARTITIONED|
+                      -- ASSIGN  |PARTITIONED|
+                        -- ASSIGN  |PARTITIONED|
                           -- STREAM_PROJECT  |PARTITIONED|
-                            -- ASSIGN  |PARTITIONED|
-                              -- ASSIGN  |PARTITIONED|
-                                -- STREAM_PROJECT  |PARTITIONED|
-                                  -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                    -- DATASOURCE_SCAN  |PARTITIONED|
-                                      -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                        -- EMPTY_TUPLE_SOURCE  |PARTITIONED|
\ No newline at end of file
+                            -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                              -- DATASOURCE_SCAN  |PARTITIONED|
+                                -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                                  -- EMPTY_TUPLE_SOURCE  |PARTITIONED|

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52a9d992/asterixdb/asterix-app/src/test/resources/runtimets/queries/cross-dataverse/cross-dv19/cross-dv19.3.query.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/cross-dataverse/cross-dv19/cross-dv19.3.query.aql
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/cross-dataverse/cross-dv19/cross-dv19.3.query.aql
index 2a5277c..2017742 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries/cross-dataverse/cross-dv19/cross-dv19.3.query.aql
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/cross-dataverse/cross-dv19/cross-dv19.3.query.aql
@@ -24,5 +24,6 @@
 
 for $l in dataset('Metadata.Dataset')
 where $l.DataverseName='test1' or $l.DataverseName='test2' or $l.DataverseName='TwitterData'
+order by $l.DataverseName, $l.DatasetName, $l.DatatypeDataverseName
 return $l
 

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52a9d992/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-index-composite-key-02/btree-index-composite-key-02.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-index-composite-key-02/btree-index-composite-key-02.1.ddl.aql
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-index-composite-key-02/btree-index-composite-key-02.1.ddl.aql
new file mode 100644
index 0000000..c193cc5
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-index-composite-key-02/btree-index-composite-key-02.1.ddl.aql
@@ -0,0 +1,68 @@
+/*
+ * 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.
+ *                 : define two BTree indexes - composite key (l_orderkey,l_linenumber) on
LineItem
+ *                 : single key (o_orderkey) on Orders
+ *                 : predicate => where $l.l_orderkey = $o.o_orderkey
+ *                 : Outer - $l (LineItem), Inner - $l (Orders)
+ * Expected Result : Success
+ * Issue           : ASTERIXDB-1186
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type LineItemType as
+{
+  l_orderkey: int64,
+  l_partkey: int64,
+  l_suppkey: int64,
+  l_linenumber: int32,
+  l_quantity: int32,
+  l_extendedprice: double,
+  l_discount: double,
+  l_tax: double,
+  l_returnflag: string,
+  l_linestatus: string,
+  l_shipdate: string,
+  l_commitdate: string,
+  l_receiptdate: string,
+  l_shipinstruct: string,
+  l_shipmode: string,
+  l_comment: string
+}
+
+create type OrderType as
+{
+  o_orderkey: int64,
+  o_custkey: int64,
+  o_orderstatus: string,
+  o_totalprice: double,
+  o_orderdate: string,
+  o_orderpriority: string,
+  o_clerk: string,
+  o_shippriority: int32,
+  o_comment: string
+}
+
+create dataset LineItem(LineItemType) primary key l_orderkey, l_linenumber;
+create dataset Orders(OrderType) primary key o_orderkey;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52a9d992/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-index-composite-key-02/btree-index-composite-key-02.2.update.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-index-composite-key-02/btree-index-composite-key-02.2.update.aql
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-index-composite-key-02/btree-index-composite-key-02.2.update.aql
new file mode 100644
index 0000000..567ee98
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-index-composite-key-02/btree-index-composite-key-02.2.update.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;
+
+load dataset LineItem
+using localfs
+(("path"="asterix_nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|"))
pre-sorted;
+
+load dataset Orders
+using localfs
+(("path"="asterix_nc1://data/tpch0.001/orders.tbl"),("format"="delimited-text"),("delimiter"="|"))
pre-sorted;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52a9d992/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-index-composite-key-02/btree-index-composite-key-02.3.query.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-index-composite-key-02/btree-index-composite-key-02.3.query.aql
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-index-composite-key-02/btree-index-composite-key-02.3.query.aql
new file mode 100644
index 0000000..8377159
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-index-composite-key-02/btree-index-composite-key-02.3.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;
+
+// Outer - $l (LineItem), Inner - $o (Orders)
+for $l in dataset('LineItem')
+for $o in dataset('Orders')
+where $l.l_orderkey /*+ indexnl */ = $o.o_orderkey
+order by $o.o_orderkey,$l.l_orderkey
+return
+{ "o_orderkey": $o.o_orderkey, "l_orderkey": $l.l_orderkey  }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52a9d992/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-index-composite-key-02/btree-index-composite-key-02.4.query.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-index-composite-key-02/btree-index-composite-key-02.4.query.aql
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-index-composite-key-02/btree-index-composite-key-02.4.query.aql
new file mode 100644
index 0000000..dc911fc
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-index-composite-key-02/btree-index-composite-key-02.4.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;
+
+// Outer - $o (Orders), Inner - $l (LineItem)
+for $o in dataset('Orders')
+for $l in dataset('LineItem')
+where $l.l_orderkey /*+ indexnl */ = $o.o_orderkey
+order by $o.o_orderkey,$l.l_orderkey
+return
+{ "o_orderkey": $o.o_orderkey, "l_orderkey": $l.l_orderkey  }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52a9d992/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cross-dataverse/cross-dv19/cross-dv19.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cross-dataverse/cross-dv19/cross-dv19.3.query.sqlpp
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cross-dataverse/cross-dv19/cross-dv19.3.query.sqlpp
index 4d91114..2c5c6a4 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cross-dataverse/cross-dv19/cross-dv19.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cross-dataverse/cross-dv19/cross-dv19.3.query.sqlpp
@@ -25,4 +25,5 @@
 select element l
 from  `Metadata.Dataset` as l
 where ((l.DataverseName = 'test1') or (l.DataverseName = 'test2') or (l.DataverseName = 'TwitterData'))
+order by l.DataverseName, l.DatasetName, l.DatatypeDataverseName
 ;


Mime
View raw message