This is an automated email from the ASF dual-hosted git repository.
englefly pushed a commit to branch 2.0.15-tebu
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/2.0.15-tebu by this push:
new e5728565739 pick 40084 40200 40178 (#41573)
e5728565739 is described below
commit e57285657391b5d58a100bfca3e1bc9bad3677bb
Author: minghong <[email protected]>
AuthorDate: Thu Oct 10 17:01:44 2024 +0800
pick 40084 40200 40178 (#41573)
## Proposed changes
Issue Number: close #xxx
<!--Describe your changes.-->
---
.../main/java/org/apache/doris/nereids/stats/FilterEstimation.java | 7 ++++++-
fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java | 4 ++++
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/nereids/stats/FilterEstimation.java
b/fe/fe-core/src/main/java/org/apache/doris/nereids/stats/FilterEstimation.java
index 71a4b64c841..9f6620b2948 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/nereids/stats/FilterEstimation.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/nereids/stats/FilterEstimation.java
@@ -47,6 +47,7 @@ import
org.apache.doris.nereids.trees.expressions.visitor.ExpressionVisitor;
import org.apache.doris.nereids.types.DataType;
import org.apache.doris.nereids.types.DateTimeType;
import org.apache.doris.nereids.types.coercion.RangeScalable;
+import org.apache.doris.qe.ConnectContext;
import org.apache.doris.statistics.ColumnStatistic;
import org.apache.doris.statistics.ColumnStatisticBuilder;
import org.apache.doris.statistics.StatisticRange;
@@ -605,10 +606,14 @@ public class FilterEstimation extends
ExpressionVisitor<Statistics, EstimationCo
double sel = leftRange.getDistinctValues() == 0
? 1.0
: intersectRange.getDistinctValues() /
leftRange.getDistinctValues();
+ double lowerBound = RANGE_SELECTIVITY_THRESHOLD;
+ if (ConnectContext.get() != null) {
+ lowerBound =
ConnectContext.get().getSessionVariable().rangeFilterLowerBound;
+ }
if (!(dataType instanceof RangeScalable) && (sel != 0.0 && sel !=
1.0)) {
sel = DEFAULT_INEQUALITY_COEFFICIENT;
} else {
- sel = Math.max(sel, RANGE_SELECTIVITY_THRESHOLD);
+ sel = Math.max(sel, lowerBound);
}
sel = getNotNullSelectivity(leftStats, sel);
updatedStatistics = context.statistics.withSel(sel);
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 8a5c3a85055..8e8ca13d51d 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
@@ -1364,6 +1364,10 @@ public class SessionVariable implements Serializable,
Writable {
public String ignoreRuntimeFilterIds = "";
+ @VariableMgr.VarAttr(name = "range_filter_lower_bound",
+ description = {"", ""})
+
+ public double rangeFilterLowerBound = 0.01;
@VariableMgr.VarAttr(name = STATS_INSERT_MERGE_ITEM_COUNT, flag =
VariableMgr.GLOBAL, description = {
"控制统计信息相关INSERT攒批数量", "Controls the batch size for stats INSERT
merging."
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]