[fix](statistics)Fix alter column stats bug (#27093)
Encode the min and max value with base64 encoder while inject the column stats.
This commit is contained in:
@ -35,6 +35,8 @@ import org.apache.commons.text.StringSubstitutor;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Base64;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
@ -269,8 +271,10 @@ public class StatisticsRepository {
|
||||
params.put("count", String.valueOf(columnStatistic.count));
|
||||
params.put("ndv", String.valueOf(columnStatistic.ndv));
|
||||
params.put("nullCount", String.valueOf(columnStatistic.numNulls));
|
||||
params.put("min", min == null ? "NULL" : min);
|
||||
params.put("max", max == null ? "NULL" : max);
|
||||
params.put("min", min == null ? "NULL" :
|
||||
Base64.getEncoder().encodeToString(min.getBytes(StandardCharsets.UTF_8)));
|
||||
params.put("max", max == null ? "NULL" :
|
||||
Base64.getEncoder().encodeToString(max.getBytes(StandardCharsets.UTF_8)));
|
||||
params.put("dataSize", String.valueOf(columnStatistic.dataSize));
|
||||
|
||||
if (partitionIds.isEmpty()) {
|
||||
@ -278,7 +282,7 @@ public class StatisticsRepository {
|
||||
params.put("partId", "NULL");
|
||||
StatisticsUtil.execUpdate(INSERT_INTO_COLUMN_STATISTICS, params);
|
||||
Env.getCurrentEnv().getStatisticsCache()
|
||||
.updateColStatsCache(objects.table.getId(), -1, colName, builder.build());
|
||||
.updateColStatsCache(objects.table.getId(), -1, colName, columnStatistic);
|
||||
} else {
|
||||
// update partition granularity statistics
|
||||
for (Long partitionId : partitionIds) {
|
||||
|
||||
Reference in New Issue
Block a user