[Fix](statistics)Fix alter column stats data size is always 0 bug (#24891)
Fix alter column stats data size is always 0 bug.
This commit is contained in:
@ -190,7 +190,7 @@ public class ColumnStatisticBuilder {
|
||||
}
|
||||
|
||||
public ColumnStatistic build() {
|
||||
dataSize = Math.max((count - numNulls + 1) * avgSizeByte, 0);
|
||||
dataSize = dataSize > 0 ? dataSize : Math.max((count - numNulls + 1) * avgSizeByte, 0);
|
||||
if (original == null && !isUnknown) {
|
||||
original = new ColumnStatistic(count, ndv, null, avgSizeByte, numNulls,
|
||||
dataSize, minValue, maxValue, minExpr, maxExpr,
|
||||
|
||||
@ -248,7 +248,14 @@ public class StatisticsRepository {
|
||||
builder.setMaxValue(StatisticsUtil.convertToDouble(column.getType(), max));
|
||||
}
|
||||
if (dataSize != null) {
|
||||
builder.setDataSize(Double.parseDouble(dataSize));
|
||||
double size = Double.parseDouble(dataSize);
|
||||
double rows = Double.parseDouble(rowCount);
|
||||
if (size > 0) {
|
||||
builder.setDataSize(size);
|
||||
if (rows > 0) {
|
||||
builder.setAvgSizeByte(size / rows);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ColumnStatistic columnStatistic = builder.build();
|
||||
|
||||
Reference in New Issue
Block a user