[fix](Nereids) aggregate always report has 1 row count (#14236)

the data structure of new stats is changed, bug Agg-estimation is not changed
This commit is contained in:
minghong
2022-11-14 16:27:55 +08:00
committed by GitHub
parent 47326f951d
commit bdf7d2779a

View File

@ -331,6 +331,7 @@ public class StatsCalculatorV2 extends DefaultPlanVisitor<StatsDeriveResult, Voi
StatsDeriveResult childStats = groupExpression.childStatistics(0);
Map<Id, ColumnStatistic> childSlotToColumnStats = childStats.getSlotIdToColumnStats();
double resultSetCount = groupByExpressions.stream().flatMap(expr -> expr.getInputSlots().stream())
.map(Slot::getExprId)
.filter(childSlotToColumnStats::containsKey).map(childSlotToColumnStats::get).map(s -> s.ndv)
.reduce(1d, (a, b) -> a * b);
if (resultSetCount <= 0) {