You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by mo...@apache.org on 2023/04/19 04:15:02 UTC

[doris] branch master updated: [opt](nereids) estimate broadcast cost by a new formula (#18744)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 446db3def6 [opt](nereids) estimate broadcast cost by a new formula (#18744)
446db3def6 is described below

commit 446db3def60665b63b97069da81dce2a6925f164
Author: minghong <en...@gmail.com>
AuthorDate: Wed Apr 19 12:14:55 2023 +0800

    [opt](nereids) estimate broadcast cost by a new formula (#18744)
    
    estimate broadcast cost by an experience formula: beNumber^0.5 * rowCount
    1. sender number and receiver number is not available at RBO stage now, so we use beNumber
    2. senders and receivers work in parallel, that why we use square of beNumber
---
 .../src/main/java/org/apache/doris/nereids/cost/CostModelV1.java     | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/cost/CostModelV1.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/cost/CostModelV1.java
index 60a1f9c9b1..38bbd52a3e 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/nereids/cost/CostModelV1.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/cost/CostModelV1.java
@@ -174,10 +174,13 @@ class CostModelV1 extends PlanVisitor<Cost, PlanContext> {
                     || childStatistics.getRowCount() > rowsLimit) {
                 return CostV1.of(Double.MAX_VALUE, Double.MAX_VALUE, Double.MAX_VALUE);
             }
+            // estimate broadcast cost by an experience formula: beNumber^0.5 * rowCount
+            // - sender number and receiver number is not available at RBO stage now, so we use beNumber
+            // - senders and receivers work in parallel, that why we use square of beNumber
             return CostV1.of(
                     0,
                     0,
-                    childStatistics.getRowCount() * beNumber);
+                    childStatistics.getRowCount() * Math.pow(beNumber, 0.5));
 
         }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org