Skip to content

Commit

Permalink
[opt](nereids) refine operator estimation
Browse files Browse the repository at this point in the history
  • Loading branch information
zhongjian.xzj authored and zhongjian.xzj committed Sep 23, 2024
1 parent 1fc65d3 commit d80fcb3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -626,11 +626,7 @@ private Statistics estimateColumnToConstantRange(Expression leftExpr, DataType d
double sel = leftRange.getDistinctValues() == 0
? 1.0
: intersectRange.getDistinctValues() / leftRange.getDistinctValues();
if (sel != 0.0 && sel != 1.0) {
sel = Math.max(sel, RANGE_SELECTIVITY_THRESHOLD);
} else {
sel = DEFAULT_INEQUALITY_COEFFICIENT;
}
sel = Math.max(sel, RANGE_SELECTIVITY_THRESHOLD);
sel = getNotNullSelectivity(leftStats.numNulls, context.statistics.getRowCount(), leftStats.ndv, sel);
updatedStatistics = context.statistics.withSel(sel);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -424,9 +424,7 @@ private Statistics computeOlapScan(OlapScan olapScan) {
for (Slot slot : ((Relation) olapScan).getOutput()) {
if (derivedStats.findColumnStatistics(slot) == null) {
derivedStats.addColumnStats(slot,
new ColumnStatisticBuilder(ColumnStatistic.UNKNOWN, derivedRowCount)
//.setAvgSizeByte(slot.getDataType().width())
.build());
new ColumnStatisticBuilder(ColumnStatistic.UNKNOWN, derivedRowCount).build());
}
}
return derivedStats;
Expand All @@ -453,9 +451,7 @@ private Statistics computeOlapScan(OlapScan olapScan) {
// get row count from any visible slotReference's colStats
for (Slot slot : ((Plan) olapScan).getOutput()) {
builder.putColumnStatistics(slot,
new ColumnStatisticBuilder(ColumnStatistic.UNKNOWN, tableRowCount)
//.setAvgSizeByte(slot.getDataType().width())
.build());
new ColumnStatisticBuilder(ColumnStatistic.UNKNOWN, tableRowCount).build());
}
setHasUnknownColStatsInStatementContext();
return builder.setRowCount(tableRowCount).build();
Expand Down

0 comments on commit d80fcb3

Please sign in to comment.