>From Preetham Poluparthi <[email protected]>:

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


Change subject: [ASTERIXDB-3559][COMP] Fix incorrect 0.0 cost annotation for 
GROUP BY and ORDER BY operators
......................................................................

[ASTERIXDB-3559][COMP] Fix incorrect 0.0 cost annotation for GROUP BY and ORDER 
BY operators

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

Details:  The cost annotation logic could incorrectly assign a cost of zero to 
GROUP BY and ORDER BY operators, resulting in inaccurate operator cost 
reporting.

Ext-ref: MB-70177

Change-Id: I27c7f3ab2993cbf797547a1a3cf45f2a4c0c9ce2
---
M 
asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/cbo/EstimatedCostComputationVisitor.java
1 file changed, 5 insertions(+), 2 deletions(-)



  git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb 
refs/changes/09/21309/1

diff --git 
a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/cbo/EstimatedCostComputationVisitor.java
 
b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/cbo/EstimatedCostComputationVisitor.java
index 1e70fa7..21c4669 100644
--- 
a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/cbo/EstimatedCostComputationVisitor.java
+++ 
b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/cbo/EstimatedCostComputationVisitor.java
@@ -18,6 +18,8 @@
  */
 package org.apache.asterix.optimizer.rules.cbo;

+import static 
org.apache.hyracks.algebricks.core.algebra.base.OperatorAnnotations.OP_COST_LOCAL;
+
 import java.util.Map;

 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
@@ -115,7 +117,7 @@
         double totalCost = cardSizeCost.getCost() + groupByDistinctCost;
         cardSizeCost.setCost(totalCost);
         annotateOp(op, cardSizeCost);
-
+        op.getAnnotations().put(OperatorAnnotations.OP_COST_LOCAL, 
groupByDistinctCost);
         return cardSizeCost;
     }

@@ -162,6 +164,7 @@
         op.getAnnotations().put(OperatorAnnotations.OP_COST_TOTAL, (double) 
Math.round(totalCost * 100) / 100);
         cardSizeCost.setCost(totalCost);
         annotateOp(op, cardSizeCost);
+        op.getAnnotations().put(OperatorAnnotations.OP_COST_TOTAL, orderCost);

         return cardSizeCost;
     }
@@ -496,4 +499,4 @@
             this.cost = cost;
         }
     }
-}
\ No newline at end of file
+}

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

Gerrit-MessageType: newchange
Gerrit-Project: asterixdb
Gerrit-Branch: lumina
Gerrit-Change-Id: I27c7f3ab2993cbf797547a1a3cf45f2a4c0c9ce2
Gerrit-Change-Number: 21309
Gerrit-PatchSet: 1
Gerrit-Owner: Preetham Poluparthi <[email protected]>

Reply via email to