Skip to content

Commit

Permalink
pick 40084 40200 40178 (#41573)
Browse files Browse the repository at this point in the history
## Proposed changes

Issue Number: close #xxx

<!--Describe your changes.-->
  • Loading branch information
englefly authored Oct 10, 2024
1 parent cd82fc0 commit e572856
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
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;
Expand Down Expand Up @@ -605,10 +606,14 @@ private Statistics estimateBinaryComparisonFilter(Expression leftExpr, DataType
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1364,6 +1364,10 @@ public void setEnableLeftZigZag(boolean enableLeftZigZag) {

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."
}
Expand Down

0 comments on commit e572856

Please sign in to comment.