This is an automated email from the ASF dual-hosted git repository.
englefly 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 34389823eec [opt](nereids) set lower bound for range-selectivity(2.0)
(#41060)
34389823eec is described below
commit 34389823eec7293d282c122a4507841b02e788ad
Author: minghong <[email protected]>
AuthorDate: Sun Sep 22 13:13:12 2024 +0800
[opt](nereids) set lower bound for range-selectivity(2.0) (#41060)
## Proposed changes
pick #40089
Issue Number: close #xxx
<!--Describe your changes.-->
---
.../main/java/org/apache/doris/nereids/stats/FilterEstimation.java | 5 +++++
1 file changed, 5 insertions(+)
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 6f6e768caae..faa9fd323d6 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
@@ -69,6 +69,9 @@ import java.util.function.Predicate;
*/
public class FilterEstimation extends ExpressionVisitor<Statistics,
EstimationContext> {
public static final double DEFAULT_INEQUALITY_COEFFICIENT = 0.5;
+ // "Range selectivity is prone to producing outliers, so we add this
threshold limit.
+ // The threshold estimation is calculated based on selecting one month out
of fifty years."
+ public static final double RANGE_SELECTIVITY_THRESHOLD = 0.0016;
public static final double DEFAULT_IN_COEFFICIENT = 1.0 / 3.0;
public static final double DEFAULT_HAVING_COEFFICIENT = 0.01;
@@ -602,6 +605,8 @@ public class FilterEstimation extends
ExpressionVisitor<Statistics, EstimationCo
double sel = leftRange.overlapPercentWith(rightRange);
if (!(dataType instanceof RangeScalable) && (sel != 0.0 && sel !=
1.0)) {
sel = DEFAULT_INEQUALITY_COEFFICIENT;
+ } else if (sel < RANGE_SELECTIVITY_THRESHOLD) {
+ sel = RANGE_SELECTIVITY_THRESHOLD;
}
sel = getNotNullSelectivity(leftStats, sel);
updatedStatistics = context.statistics.withSel(sel);
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]