Kikyou1997 commented on code in PR #17790:
URL: https://github.com/apache/doris/pull/17790#discussion_r1136991741
##########
fe/fe-core/src/main/java/org/apache/doris/statistics/Statistics.java:
##########
@@ -72,17 +85,18 @@ public double getRowCount() {
public Statistics withRowCount(double rowCount) {
Statistics statistics = new Statistics(rowCount, new
HashMap<>(expressionToColumnStats), width, penalty);
- statistics.fix(rowCount / StatsMathUtil.nonZeroDivisor(this.rowCount));
+ statistics.fix(rowCount, StatsMathUtil.nonZeroDivisor(this.rowCount));
return statistics;
}
- public void fix(double sel) {
+ public void fix(double newRowCount, double originRowCount) {
+ double sel = newRowCount / originRowCount;
for (Entry<Expression, ColumnStatistic> entry :
expressionToColumnStats.entrySet()) {
ColumnStatistic columnStatistic = entry.getValue();
ColumnStatisticBuilder columnStatisticBuilder = new
ColumnStatisticBuilder(columnStatistic);
-
columnStatisticBuilder.setNdv(Math.min(Math.ceil(columnStatistic.ndv * sel),
rowCount));
-
columnStatisticBuilder.setNumNulls(Math.min(Math.ceil(columnStatistic.numNulls
* sel), rowCount));
-
columnStatisticBuilder.setCount(Math.min(Math.ceil(columnStatistic.count *
sel), rowCount));
+ columnStatisticBuilder.setNdv(computeNdv(columnStatistic.ndv,
newRowCount, originRowCount));
Review Comment:
这把Math.min的逻辑加回来?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]