>From Preetham Poluparthi <[email protected]>:

Preetham Poluparthi has submitted this change. ( 
https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/20393?usp=email )

Change subject: [ASTERIXDB-3635][COMP] Tune single dataset index costing
......................................................................

[ASTERIXDB-3635][COMP] Tune single dataset index costing

- user model changes: no
- storage format changes: no
- interface changes: no

Ext-Ref: MB-68074

Change-Id: If2ed184e1dbc941ee53718e09331cbf7011370ae
Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/20393
Integration-Tests: Jenkins <[email protected]>
Integration-Tests: Preetham Poluparthi <[email protected]>
Reviewed-by: Preetham Poluparthi <[email protected]>
Tested-by: Preetham Poluparthi <[email protected]>
---
M 
asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/cbo/JoinNode.java
M 
asterixdb/asterix-app/src/test/resources/runtimets/results_cbo/cardinality-estimation/single-collection-queries/single-collection-queries.3.plan
M 
asterixdb/asterix-app/src/test/resources/runtimets/results_cbo/cardinality-estimation/single-collection-queries/single-collection-queries.4.plan
M 
asterixdb/asterix-app/src/test/resources/runtimets/results_cbo/cardinality-estimation/single-collection-queries/single-collection-queries.7.plan
4 files changed, 73 insertions(+), 112 deletions(-)

Approvals:
  Preetham Poluparthi: Looks good to me, approved; Verified; Verified
  Jenkins: Verified




diff --git 
a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/cbo/JoinNode.java
 
b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/cbo/JoinNode.java
index 5cbb6f8..c71009a 100644
--- 
a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/cbo/JoinNode.java
+++ 
b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/cbo/JoinNode.java
@@ -730,99 +730,63 @@
     private void buildIndexPlans() {
         List<PlanNode> allPlans = joinEnum.getAllPlans();
         PlanNode pn;
-        ICost opCost, totalCost;
+        double ic, dc, tc, oc; // for debugging
+
         List<Triple<Index, Double, AbstractFunctionCallExpression>> 
mandatoryIndexesInfo = new ArrayList<>();
         List<Triple<Index, Double, AbstractFunctionCallExpression>> 
optionalIndexesInfo = new ArrayList<>();
         double sel = 1.0;
-        boolean mandatoryArrayIndexUsed = false;
-        boolean optionalArrayIndexUsed = false;
-        opCost = this.joinEnum.getCostHandle().zeroCost();
+
         for (int i = 0; i < IndexCostInfo.size(); i++) {
             if (joinEnum.findUseIndexHint(IndexCostInfo.get(i).third)) {
                 mandatoryIndexesInfo.add(IndexCostInfo.get(i));
-                mandatoryArrayIndexUsed = mandatoryArrayIndexUsed
-                        || (mandatoryIndexesInfo.get(i).first.getIndexType() 
== DatasetConfig.IndexType.ARRAY);
             } else {
                 optionalIndexesInfo.add(IndexCostInfo.get(i));
-                optionalArrayIndexUsed = optionalArrayIndexUsed
-                        || (optionalIndexesInfo.get(i).first.getIndexType() == 
DatasetConfig.IndexType.ARRAY);
             }
         }

-        List<ICost> indexCosts = new ArrayList<>(); // these are the costs 
associated with the index only
-        // First cost all the mandatory indexes. These will be in the plan 
regardless of the cost
+        ICost indexCosts = this.joinEnum.getCostHandle().zeroCost();
+        ICost totalCost = this.joinEnum.getCostHandle().zeroCost();
+        ICost dataScanCost;
+
         if (mandatoryIndexesInfo.size() > 0) {
             for (int i = 0; i < mandatoryIndexesInfo.size(); i++) {
-                
indexCosts.add(joinEnum.getCostMethodsHandle().costIndexScan(this, 
mandatoryIndexesInfo.get(i).second));
+                ICost cost = 
joinEnum.getCostMethodsHandle().costIndexScan(this, 
mandatoryIndexesInfo.get(i).second);
+                if ((mandatoryIndexesInfo.get(i).first.getIndexType() == 
DatasetConfig.IndexType.ARRAY)) {
+                    cost = cost.costAdd(cost); // double the cost for arrays.
+                }
+                indexCosts = indexCosts.costAdd(cost); // a running tally
+                sel *= mandatoryIndexesInfo.get(i).second;
             }
-
-            opCost = this.joinEnum.getCostHandle().zeroCost();
-
-            for (int i = 0; i < mandatoryIndexesInfo.size(); i++) {
-                opCost = opCost.costAdd(indexCosts.get(i)); // opCost will 
have all the index scan costs
-                sel *= mandatoryIndexesInfo.get(i).second; // assuming 
selectivities are independent for now
-            }
-
-            // Now add the data Scan cost.
-            ICost dataScanCost = 
joinEnum.getCostMethodsHandle().costIndexDataScan(this, sel);
-            opCost = opCost.costAdd(dataScanCost); // opCost now has the total 
cost of all the mandatory indexes + data costs.
-            if (mandatoryArrayIndexUsed) {
-                opCost = opCost.costAdd(opCost);
-            }
+            dataScanCost = 
joinEnum.getCostMethodsHandle().costIndexDataScan(this, sel);
+            totalCost = indexCosts.costAdd(dataScanCost); // this is the total 
cost of using the mandatory costs. This cost cannot be skipped.
         }

-        ICost mandatoryIndexesCost = opCost; // This will be added at the end 
to the total cost irrespective of optimality.
-        //opCost = this.joinEnum.getCostHandle().zeroCost(); // compute cost 
for optional indexes and store in opCost.
-        // Now lets deal with the optional indexes. These are the ones without 
any hints on them.
-        List<ICost> dataCosts = new ArrayList<>(); // these are the costs 
associated with accessing the data records
-        indexCosts.clear();
+        ICost opCost = totalCost;
         if (optionalIndexesInfo.size() > 0) {
-            optionalIndexesInfo.sort(Comparator.comparingDouble(o -> 
o.second)); // sort on selectivity.
+            optionalIndexesInfo.sort(Comparator.comparingDouble(o -> 
o.second));

-            // find the costs using one index at a time first.
-
-            // sel is now the selectivity of all the previous mandatory 
indexes.
             for (int i = 0; i < optionalIndexesInfo.size(); i++) {
-                
indexCosts.add(joinEnum.getCostMethodsHandle().costIndexScan(this, 
optionalIndexesInfo.get(i).second)); // I0; I1; I2; ...
-                // Now get the cost of the datascans involved with the 
multiplied selectivity
-                // dataCost (0) will contain the dataScan cost with the first 
index
-                //dataCost (1) will contain the dataScan cost with the first 
index and the 2nd index and so on.
-                sel *= optionalIndexesInfo.get(i).second; // assuming 
selectivities are independent for now
-                if (optionalIndexesInfo.get(i).first.isPrimaryIndex()) {
-                    dataCosts.add(joinEnum.getCostHandle().zeroCost());
-                } else {
-                    
dataCosts.add(joinEnum.getCostMethodsHandle().costIndexDataScan(this, sel)); // 
D0; D01; D012; ...
+                ICost cost = 
joinEnum.getCostMethodsHandle().costIndexScan(this, 
optionalIndexesInfo.get(i).second);
+                if ((optionalIndexesInfo.get(i).first.getIndexType() == 
DatasetConfig.IndexType.ARRAY)) {
+                    cost = cost.costAdd(cost); // double the cost for arrays.
                 }
-            }
-
-            // At the of of the above loop, I0, I1, I2 ... have been computed
-            // Also D0, D01, D012 ... have been computed.
-
-            opCost = indexCosts.get(0).costAdd(dataCosts.get(0));
-            //opCost is now the cost of the first (and cheapest) optional 
index plus the corresponding data scan
-
-            //Intersect the first two and then the first three and so on.
-            //If the cost does not decrease, then stop
-
-            ICost newIdxCost = indexCosts.get(0); // I0
-            ICost currentCost;
-            for (int i = 1; i < optionalIndexesInfo.size(); i++) {
-                newIdxCost = newIdxCost.costAdd(indexCosts.get(i)); // I0 + 
I1; I0 + I1 + I2
-                currentCost = newIdxCost.costAdd(dataCosts.get(i)); // I0 + I1 
+ D01; I0 + I1 + I2 + D012
-                if (currentCost.costLT(opCost) || level <= 
joinEnum.cboFullEnumLevel) { // save this cost and try adding one more index
-                    opCost = currentCost;
-                } else {
-                    // set the selectivites of the indexes not picked to be 
-1.0, so we can set
-                    // the skp index annotations correctly
-                    for (int j = i; j < optionalIndexesInfo.size(); j++) {
-                        optionalIndexesInfo.get(j).second = -1.0;
+                indexCosts = indexCosts.costAdd(cost);
+                sel *= optionalIndexesInfo.get(i).second;
+                dataScanCost = 
joinEnum.getCostMethodsHandle().costIndexDataScan(this, sel);
+                opCost = indexCosts.costAdd(dataScanCost);
+                tc = totalCost.computeTotalCost();
+                if (tc > 0.0) {
+                    if (opCost.costGT(totalCost)) { // we can stop here since 
additional indexes are not useful
+                        for (int j = i; j < optionalIndexesInfo.size(); j++) {
+                            optionalIndexesInfo.get(j).second = -1.0;
+                        }
+                        opCost = totalCost;
+                        break;
                     }
-                    break; // can't get any cheaper.
+                } else {
+                    totalCost = indexCosts.costAdd(dataScanCost);
                 }
             }
-            if (optionalArrayIndexUsed) {
-                opCost = opCost.costAdd(opCost);
-            }
         }

         // opCost is now the total cost of the indexes chosen along with the 
associated data scan cost.
@@ -832,9 +796,6 @@
             }
         }

-        totalCost = opCost.costAdd(mandatoryIndexesCost); // cost of all the 
indexes chosen
-        // Now check if any of the indexes were array indexes. If so double 
the cost
-
         boolean forceEnum = mandatoryIndexesInfo.size() > 0 || level <= 
joinEnum.cboFullEnumLevel;
         if (opCost.costLT(this.cheapestPlanCost) || forceEnum) {
             pn = new PlanNode(allPlans.size(), joinEnum, this, 
datasetNames.get(0), leafInput);
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/results_cbo/cardinality-estimation/single-collection-queries/single-collection-queries.3.plan
 
b/asterixdb/asterix-app/src/test/resources/runtimets/results_cbo/cardinality-estimation/single-collection-queries/single-collection-queries.3.plan
index c6c8f6f..bc53d01 100644
--- 
a/asterixdb/asterix-app/src/test/resources/runtimets/results_cbo/cardinality-estimation/single-collection-queries/single-collection-queries.3.plan
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/results_cbo/cardinality-estimation/single-collection-queries/single-collection-queries.3.plan
@@ -1,38 +1,38 @@
-distribute result [$$48] [cardinality: 101.0, doc-size: 0.0, op-cost: 0.0, 
total-cost: 4495.77]
+distribute result [$$48] [cardinality: 101.0, doc-size: 0.0, op-cost: 0.0, 
total-cost: 4497.18]
 -- DISTRIBUTE_RESULT  |PARTITIONED|
-  exchange [cardinality: 101.0, doc-size: 0.0, op-cost: 0.0, total-cost: 
4495.77]
+  exchange [cardinality: 101.0, doc-size: 0.0, op-cost: 0.0, total-cost: 
4497.18]
   -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-    assign [$$48] <- [{"$1": $$51}] project: [$$48] [cardinality: 101.0, 
doc-size: 0.0, op-cost: 0.0, total-cost: 4495.77]
+    assign [$$48] <- [{"$1": $$51}] project: [$$48] [cardinality: 101.0, 
doc-size: 0.0, op-cost: 0.0, total-cost: 4497.18]
     -- ASSIGN  |PARTITIONED|
-      project ([$$51]) [cardinality: 101.0, doc-size: 0.0, op-cost: 0.0, 
total-cost: 4495.77]
+      project ([$$51]) [cardinality: 101.0, doc-size: 0.0, op-cost: 0.0, 
total-cost: 4497.18]
       -- STREAM_PROJECT  |PARTITIONED|
-        exchange [cardinality: 101.0, doc-size: 0.0, op-cost: 0.0, total-cost: 
4495.77]
+        exchange [cardinality: 101.0, doc-size: 0.0, op-cost: 0.0, total-cost: 
4497.18]
         -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
           group by ([$$o_custkey := $$54]) decor ([]) {
                     aggregate [$$51] <- [sql-sum-serial($$53)] [cardinality: 
0.0, doc-size: 0.0, op-cost: 0.0, total-cost: 0.0]
                     -- AGGREGATE  |LOCAL|
                       nested tuple source [cardinality: 0.0, doc-size: 0.0, 
op-cost: 0.0, total-cost: 0.0]
                       -- NESTED_TUPLE_SOURCE  |LOCAL|
-                 } [cardinality: 101.0, doc-size: 0.0, op-cost: 0.0, 
total-cost: 4495.77]
+                 } [cardinality: 101.0, doc-size: 0.0, op-cost: 0.0, 
total-cost: 4497.18]
           -- EXTERNAL_GROUP_BY[$$54]  |PARTITIONED|
-            exchange [cardinality: 101.0, doc-size: 0.0, op-cost: 0.0, 
total-cost: 2997.18]
+            exchange [cardinality: 101.0, doc-size: 0.0, op-cost: 0.0, 
total-cost: 2998.59]
             -- HASH_PARTITION_EXCHANGE [$$54]  |PARTITIONED|
               group by ([$$54 := $$49]) decor ([]) {
                         aggregate [$$53] <- [sql-count-serial(1)] 
[cardinality: 0.0, doc-size: 0.0, op-cost: 0.0, total-cost: 0.0]
                         -- AGGREGATE  |LOCAL|
                           nested tuple source [cardinality: 0.0, doc-size: 
0.0, op-cost: 0.0, total-cost: 0.0]
                           -- NESTED_TUPLE_SOURCE  |LOCAL|
-                     } [cardinality: 101.0, doc-size: 0.0, op-cost: 0.0, 
total-cost: 2997.18]
+                     } [cardinality: 101.0, doc-size: 0.0, op-cost: 0.0, 
total-cost: 2998.59]
               -- EXTERNAL_GROUP_BY[$$49]  |PARTITIONED|
-                exchange [cardinality: 1498.59, doc-size: 0.0, op-cost: 0.0, 
total-cost: 1498.59]
+                exchange [cardinality: 1498.59, doc-size: 0.0, op-cost: 0.0, 
total-cost: 1500.0]
                 -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                  assign [$$49] <- [$$o.getField(1)] project: [$$49] 
[cardinality: 1498.59, doc-size: 0.0, op-cost: 0.0, total-cost: 1498.59]
+                  assign [$$49] <- [$$o.getField(1)] project: [$$49] 
[cardinality: 1498.59, doc-size: 0.0, op-cost: 0.0, total-cost: 1500.0]
                   -- ASSIGN  |PARTITIONED|
-                    project ([$$o]) [cardinality: 1498.59, doc-size: 0.0, 
op-cost: 0.0, total-cost: 1498.59]
+                    project ([$$o]) [cardinality: 1498.59, doc-size: 0.0, 
op-cost: 0.0, total-cost: 1500.0]
                     -- STREAM_PROJECT  |PARTITIONED|
-                      exchange [cardinality: 1498.59, doc-size: 0.0, op-cost: 
0.0, total-cost: 1498.59]
+                      exchange [cardinality: 1498.59, doc-size: 0.0, op-cost: 
0.0, total-cost: 1500.0]
                       -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                        unnest-map [$$50, $$o] <- index-search("Orders", 0, 
"Default", "tpch", "Orders", false, false, 1, $$55, 0, false, true, false) 
[cardinality: 1498.59, doc-size: 0.0, op-cost: 0.0, total-cost: 1498.59]
+                        unnest-map [$$50, $$o] <- index-search("Orders", 0, 
"Default", "tpch", "Orders", false, false, 1, $$55, 0, false, true, false) 
[cardinality: 1498.59, doc-size: 0.0, op-cost: 0.0, total-cost: 1500.0]
                         -- BTREE_SEARCH  |PARTITIONED|
                           exchange [cardinality: 0.0, doc-size: 0.0, op-cost: 
0.0, total-cost: 0.0]
                           -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/results_cbo/cardinality-estimation/single-collection-queries/single-collection-queries.4.plan
 
b/asterixdb/asterix-app/src/test/resources/runtimets/results_cbo/cardinality-estimation/single-collection-queries/single-collection-queries.4.plan
index d725fcf..5e8aa1a 100644
--- 
a/asterixdb/asterix-app/src/test/resources/runtimets/results_cbo/cardinality-estimation/single-collection-queries/single-collection-queries.4.plan
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/results_cbo/cardinality-estimation/single-collection-queries/single-collection-queries.4.plan
@@ -1,38 +1,38 @@
-distribute result [$$48] [cardinality: 1495.77, doc-size: 0.0, op-cost: 0.0, 
total-cost: 4487.31]
+distribute result [$$48] [cardinality: 1495.77, doc-size: 0.0, op-cost: 0.0, 
total-cost: 4491.54]
 -- DISTRIBUTE_RESULT  |PARTITIONED|
-  exchange [cardinality: 1495.77, doc-size: 0.0, op-cost: 0.0, total-cost: 
4487.31]
+  exchange [cardinality: 1495.77, doc-size: 0.0, op-cost: 0.0, total-cost: 
4491.54]
   -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-    assign [$$48] <- [{"$1": $$51}] project: [$$48] [cardinality: 1495.77, 
doc-size: 0.0, op-cost: 0.0, total-cost: 4487.31]
+    assign [$$48] <- [{"$1": $$51}] project: [$$48] [cardinality: 1495.77, 
doc-size: 0.0, op-cost: 0.0, total-cost: 4491.54]
     -- ASSIGN  |PARTITIONED|
-      project ([$$51]) [cardinality: 1495.77, doc-size: 0.0, op-cost: 0.0, 
total-cost: 4487.31]
+      project ([$$51]) [cardinality: 1495.77, doc-size: 0.0, op-cost: 0.0, 
total-cost: 4491.54]
       -- STREAM_PROJECT  |PARTITIONED|
-        exchange [cardinality: 1495.77, doc-size: 0.0, op-cost: 0.0, 
total-cost: 4487.31]
+        exchange [cardinality: 1495.77, doc-size: 0.0, op-cost: 0.0, 
total-cost: 4491.54]
         -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
           group by ([$$o_orderdate := $$54]) decor ([]) {
                     aggregate [$$51] <- [sql-sum-serial($$53)] [cardinality: 
0.0, doc-size: 0.0, op-cost: 0.0, total-cost: 0.0]
                     -- AGGREGATE  |LOCAL|
                       nested tuple source [cardinality: 0.0, doc-size: 0.0, 
op-cost: 0.0, total-cost: 0.0]
                       -- NESTED_TUPLE_SOURCE  |LOCAL|
-                 } [cardinality: 1495.77, doc-size: 0.0, op-cost: 0.0, 
total-cost: 4487.31]
+                 } [cardinality: 1495.77, doc-size: 0.0, op-cost: 0.0, 
total-cost: 4491.54]
           -- EXTERNAL_GROUP_BY[$$54]  |PARTITIONED|
-            exchange [cardinality: 1495.77, doc-size: 0.0, op-cost: 0.0, 
total-cost: 2991.54]
+            exchange [cardinality: 1495.77, doc-size: 0.0, op-cost: 0.0, 
total-cost: 2995.77]
             -- HASH_PARTITION_EXCHANGE [$$54]  |PARTITIONED|
               group by ([$$54 := $$49]) decor ([]) {
                         aggregate [$$53] <- [sql-count-serial(1)] 
[cardinality: 0.0, doc-size: 0.0, op-cost: 0.0, total-cost: 0.0]
                         -- AGGREGATE  |LOCAL|
                           nested tuple source [cardinality: 0.0, doc-size: 
0.0, op-cost: 0.0, total-cost: 0.0]
                           -- NESTED_TUPLE_SOURCE  |LOCAL|
-                     } [cardinality: 1495.77, doc-size: 0.0, op-cost: 0.0, 
total-cost: 2991.54]
+                     } [cardinality: 1495.77, doc-size: 0.0, op-cost: 0.0, 
total-cost: 2995.77]
               -- EXTERNAL_GROUP_BY[$$49]  |PARTITIONED|
-                exchange [cardinality: 1495.77, doc-size: 0.0, op-cost: 0.0, 
total-cost: 1495.77]
+                exchange [cardinality: 1495.77, doc-size: 0.0, op-cost: 0.0, 
total-cost: 1500.0]
                 -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                  assign [$$49] <- [$$o.getField(4)] project: [$$49] 
[cardinality: 1495.77, doc-size: 0.0, op-cost: 0.0, total-cost: 1495.77]
+                  assign [$$49] <- [$$o.getField(4)] project: [$$49] 
[cardinality: 1495.77, doc-size: 0.0, op-cost: 0.0, total-cost: 1500.0]
                   -- ASSIGN  |PARTITIONED|
-                    project ([$$o]) [cardinality: 1495.77, doc-size: 0.0, 
op-cost: 0.0, total-cost: 1495.77]
+                    project ([$$o]) [cardinality: 1495.77, doc-size: 0.0, 
op-cost: 0.0, total-cost: 1500.0]
                     -- STREAM_PROJECT  |PARTITIONED|
-                      exchange [cardinality: 1495.77, doc-size: 0.0, op-cost: 
0.0, total-cost: 1495.77]
+                      exchange [cardinality: 1495.77, doc-size: 0.0, op-cost: 
0.0, total-cost: 1500.0]
                       -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                        unnest-map [$$50, $$o] <- index-search("Orders", 0, 
"Default", "tpch", "Orders", false, false, 1, $$55, 0, false, true, false) 
[cardinality: 1495.77, doc-size: 0.0, op-cost: 0.0, total-cost: 1495.77]
+                        unnest-map [$$50, $$o] <- index-search("Orders", 0, 
"Default", "tpch", "Orders", false, false, 1, $$55, 0, false, true, false) 
[cardinality: 1495.77, doc-size: 0.0, op-cost: 0.0, total-cost: 1500.0]
                         -- BTREE_SEARCH  |PARTITIONED|
                           exchange [cardinality: 0.0, doc-size: 0.0, op-cost: 
0.0, total-cost: 0.0]
                           -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/results_cbo/cardinality-estimation/single-collection-queries/single-collection-queries.7.plan
 
b/asterixdb/asterix-app/src/test/resources/runtimets/results_cbo/cardinality-estimation/single-collection-queries/single-collection-queries.7.plan
index 7ec6db3..cd177f7 100644
--- 
a/asterixdb/asterix-app/src/test/resources/runtimets/results_cbo/cardinality-estimation/single-collection-queries/single-collection-queries.7.plan
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/results_cbo/cardinality-estimation/single-collection-queries/single-collection-queries.7.plan
@@ -1,38 +1,38 @@
-distribute result [$$51] [cardinality: 136.0, doc-size: 0.0, op-cost: 0.0, 
total-cost: 3965.67]
+distribute result [$$51] [cardinality: 136.0, doc-size: 0.0, op-cost: 0.0, 
total-cost: 8648.78]
 -- DISTRIBUTE_RESULT  |PARTITIONED|
-  exchange [cardinality: 136.0, doc-size: 0.0, op-cost: 0.0, total-cost: 
3965.67]
+  exchange [cardinality: 136.0, doc-size: 0.0, op-cost: 0.0, total-cost: 
8648.78]
   -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-    assign [$$51] <- [{"$1": $$55}] project: [$$51] [cardinality: 136.0, 
doc-size: 0.0, op-cost: 0.0, total-cost: 3965.67]
+    assign [$$51] <- [{"$1": $$55}] project: [$$51] [cardinality: 136.0, 
doc-size: 0.0, op-cost: 0.0, total-cost: 8648.78]
     -- ASSIGN  |PARTITIONED|
-      project ([$$55]) [cardinality: 136.0, doc-size: 0.0, op-cost: 0.0, 
total-cost: 3965.67]
+      project ([$$55]) [cardinality: 136.0, doc-size: 0.0, op-cost: 0.0, 
total-cost: 8648.78]
       -- STREAM_PROJECT  |PARTITIONED|
-        exchange [cardinality: 136.0, doc-size: 0.0, op-cost: 0.0, total-cost: 
3965.67]
+        exchange [cardinality: 136.0, doc-size: 0.0, op-cost: 0.0, total-cost: 
8648.78]
         -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
           group by ([$$l_partkey := $$59]) decor ([]) {
                     aggregate [$$55] <- [sql-sum-serial($$58)] [cardinality: 
0.0, doc-size: 0.0, op-cost: 0.0, total-cost: 0.0]
                     -- AGGREGATE  |LOCAL|
                       nested tuple source [cardinality: 0.0, doc-size: 0.0, 
op-cost: 0.0, total-cost: 0.0]
                       -- NESTED_TUPLE_SOURCE  |LOCAL|
-                 } [cardinality: 136.0, doc-size: 0.0, op-cost: 0.0, 
total-cost: 3965.67]
+                 } [cardinality: 136.0, doc-size: 0.0, op-cost: 0.0, 
total-cost: 8648.78]
           -- EXTERNAL_GROUP_BY[$$59]  |PARTITIONED|
-            exchange [cardinality: 136.0, doc-size: 0.0, op-cost: 0.0, 
total-cost: 2643.78]
+            exchange [cardinality: 136.0, doc-size: 0.0, op-cost: 0.0, 
total-cost: 7326.89]
             -- HASH_PARTITION_EXCHANGE [$$59]  |PARTITIONED|
               group by ([$$59 := $$52]) decor ([]) {
                         aggregate [$$58] <- [sql-count-serial(1)] 
[cardinality: 0.0, doc-size: 0.0, op-cost: 0.0, total-cost: 0.0]
                         -- AGGREGATE  |LOCAL|
                           nested tuple source [cardinality: 0.0, doc-size: 
0.0, op-cost: 0.0, total-cost: 0.0]
                           -- NESTED_TUPLE_SOURCE  |LOCAL|
-                     } [cardinality: 136.0, doc-size: 0.0, op-cost: 0.0, 
total-cost: 2643.78]
+                     } [cardinality: 136.0, doc-size: 0.0, op-cost: 0.0, 
total-cost: 7326.89]
               -- EXTERNAL_GROUP_BY[$$52]  |PARTITIONED|
-                exchange [cardinality: 1321.89, doc-size: 0.0, op-cost: 0.0, 
total-cost: 1321.89]
+                exchange [cardinality: 1321.89, doc-size: 0.0, op-cost: 0.0, 
total-cost: 6005.0]
                 -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                  select (and(gt($$53, 1), gt($$54, 4))) project: [$$52] 
[cardinality: 1321.89, doc-size: 0.0, op-cost: 0.0, total-cost: 1321.89]
+                  select (and(gt($$53, 1), gt($$54, 4))) project: [$$52] 
[cardinality: 1321.89, doc-size: 0.0, op-cost: 0.0, total-cost: 6005.0]
                   -- STREAM_SELECT  |PARTITIONED|
-                    assign [$$52] <- [$$l.getField(1)] project: [$$53, $$54, 
$$52] [cardinality: 1321.89, doc-size: 0.0, op-cost: 0.0, total-cost: 1321.89]
+                    assign [$$52] <- [$$l.getField(1)] project: [$$53, $$54, 
$$52] [cardinality: 1321.89, doc-size: 0.0, op-cost: 0.0, total-cost: 6005.0]
                     -- ASSIGN  |PARTITIONED|
-                      exchange [cardinality: 1321.89, doc-size: 0.0, op-cost: 
0.0, total-cost: 1321.89]
+                      exchange [cardinality: 1321.89, doc-size: 0.0, op-cost: 
0.0, total-cost: 6005.0]
                       -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                        unnest-map [$$53, $$54, $$l] <- 
index-search("LineItem", 0, "Default", "tpch", "LineItem", false, false, 2, 
$$60, $$61, 0, true, true, false) [cardinality: 1321.89, doc-size: 0.0, 
op-cost: 0.0, total-cost: 1321.89]
+                        unnest-map [$$53, $$54, $$l] <- 
index-search("LineItem", 0, "Default", "tpch", "LineItem", false, false, 2, 
$$60, $$61, 0, true, true, false) [cardinality: 1321.89, doc-size: 0.0, 
op-cost: 0.0, total-cost: 6005.0]
                         -- BTREE_SEARCH  |PARTITIONED|
                           exchange [cardinality: 0.0, doc-size: 0.0, op-cost: 
0.0, total-cost: 0.0]
                           -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|

-- 
To view, visit https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/20393?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://asterix-gerrit.ics.uci.edu/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: asterixdb
Gerrit-Branch: phoenix
Gerrit-Change-Id: If2ed184e1dbc941ee53718e09331cbf7011370ae
Gerrit-Change-Number: 20393
Gerrit-PatchSet: 6
Gerrit-Owner: [email protected]
Gerrit-Reviewer: Anon. E. Moose #1000171
Gerrit-Reviewer: Jenkins <[email protected]>
Gerrit-Reviewer: Preetham Poluparthi <[email protected]>

Reply via email to