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

adonisling pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-2.0 by this push:
     new 05acee30f8 [refactor](nereids) convert session var name "beNumForTest" 
#23255 (#23690)
05acee30f8 is described below

commit 05acee30f8cb75902074de501652d94faedcc73e
Author: Adonis Ling <adonis0...@gmail.com>
AuthorDate: Thu Aug 31 08:30:33 2023 +0800

    [refactor](nereids) convert session var name "beNumForTest" #23255 (#23690)
    
    this var is used for test only. So keep "for_test" as suffix.
    
    Co-authored-by: minghong <engle...@gmail.com>
---
 .../java/org/apache/doris/nereids/cost/CostModelV1.java     | 13 ++++++++++++-
 .../src/main/java/org/apache/doris/qe/SessionVariable.java  |  4 ++++
 2 files changed, 16 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 811b2e57fc..1f7255b799 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
@@ -67,7 +67,18 @@ class CostModelV1 extends PlanVisitor<Cost, PlanContext> {
     // the penalty factor is no more than BROADCAST_JOIN_SKEW_PENALTY_LIMIT
     static final double BROADCAST_JOIN_SKEW_RATIO = 30.0;
     static final double BROADCAST_JOIN_SKEW_PENALTY_LIMIT = 2.0;
-    private int beNumber = Math.max(1, 
ConnectContext.get().getEnv().getClusterInfo().getBackendsNumber(true));
+    private int beNumber = 1;
+
+    public CostModelV1() {
+        if (ConnectContext.get().getSessionVariable().isPlayNereidsDump()) {
+            // TODO: @bingfeng refine minidump setting, and pass testMinidumpUt
+            beNumber = 1;
+        } else if 
(ConnectContext.get().getSessionVariable().getBeNumberForTest() != -1) {
+            beNumber = 
ConnectContext.get().getSessionVariable().getBeNumberForTest();
+        } else {
+            beNumber = Math.max(1, 
ConnectContext.get().getEnv().getClusterInfo().getBackendsNumber(true));
+        }
+    }
 
     public static Cost addChildCost(Plan plan, Cost planCost, Cost childCost, 
int index) {
         Preconditions.checkArgument(childCost instanceof CostV1 && planCost 
instanceof CostV1);
diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java 
b/fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java
index 4ed8084d33..af364fe11d 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java
@@ -714,6 +714,10 @@ public class SessionVariable implements Serializable, 
Writable {
         return beNumberForTest;
     }
 
+    public void setBeNumberForTest(int beNumberForTest) {
+        this.beNumberForTest = beNumberForTest;
+    }
+
     @VariableMgr.VarAttr(name = BE_NUMBER_FOR_TEST)
     private int beNumberForTest = -1;
 


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

Reply via email to