This is an automated email from the ASF dual-hosted git repository. englefly 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 419f51ca2c [feature](nereids)set nereids cbo weights by session var #21293 419f51ca2c is described below commit 419f51ca2c1f96ed58f5f74803772124060d4ece Author: minghong <engle...@gmail.com> AuthorDate: Thu Jun 29 18:54:04 2023 +0800 [feature](nereids)set nereids cbo weights by session var #21293 good for tune cost model --- .../org/apache/doris/nereids/cost/CostWeight.java | 8 ++--- .../java/org/apache/doris/qe/SessionVariable.java | 39 ++++++++++++++++++++++ 2 files changed, 43 insertions(+), 4 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/cost/CostWeight.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/cost/CostWeight.java index a0bb8c7a87..3c62f88574 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/cost/CostWeight.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/cost/CostWeight.java @@ -34,9 +34,6 @@ import com.google.common.base.Preconditions; * An example is tpch q15. */ public class CostWeight { - static final double CPU_WEIGHT = 1; - static final double MEMORY_WEIGHT = 1; - static final double NETWORK_WEIGHT = 1.5; static final double DELAY = 0.5; final double cpuWeight; @@ -69,7 +66,10 @@ public class CostWeight { } public static CostWeight get() { - return new CostWeight(CPU_WEIGHT, MEMORY_WEIGHT, NETWORK_WEIGHT, + double cpuWeight = ConnectContext.get().getSessionVariable().getCboCpuWeight(); + double memWeight = ConnectContext.get().getSessionVariable().getCboMemWeight(); + double netWeight = ConnectContext.get().getSessionVariable().getCboNetWeight(); + return new CostWeight(cpuWeight, memWeight, netWeight, ConnectContext.get().getSessionVariable().getNereidsCboPenaltyFactor()); } 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 5025eb669b..44788aa2e4 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 @@ -350,6 +350,12 @@ public class SessionVariable implements Serializable, Writable { public static final String EXTERNAL_TABLE_ANALYZE_PART_NUM = "external_table_analyze_part_num"; + public static final String CBO_CPU_WEIGHT = "cbo_cpu_weight"; + + public static final String CBO_MEM_WEIGHT = "cbo_mem_weight"; + + public static final String CBO_NET_WEIGHT = "cbo_net_weight"; + public static final List<String> DEBUG_VARIABLES = ImmutableList.of( SKIP_DELETE_PREDICATE, SKIP_DELETE_BITMAP, @@ -669,6 +675,39 @@ public class SessionVariable implements Serializable, Writable { @VariableMgr.VarAttr(name = BE_NUMBER_FOR_TEST) private int beNumberForTest = -1; + public double getCboCpuWeight() { + return cboCpuWeight; + } + + public void setCboCpuWeight(double cboCpuWeight) { + this.cboCpuWeight = cboCpuWeight; + } + + public double getCboMemWeight() { + return cboMemWeight; + } + + public void setCboMemWeight(double cboMemWeight) { + this.cboMemWeight = cboMemWeight; + } + + public double getCboNetWeight() { + return cboNetWeight; + } + + public void setCboNetWeight(double cboNetWeight) { + this.cboNetWeight = cboNetWeight; + } + + @VariableMgr.VarAttr(name = CBO_CPU_WEIGHT) + private double cboCpuWeight = 1.0; + + @VariableMgr.VarAttr(name = CBO_MEM_WEIGHT) + private double cboMemWeight = 1.0; + + @VariableMgr.VarAttr(name = CBO_NET_WEIGHT) + private double cboNetWeight = 1.5; + @VariableMgr.VarAttr(name = DISABLE_JOIN_REORDER) private boolean disableJoinReorder = false; --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org