swuferhong commented on code in PR #20672:
URL: https://github.com/apache/flink/pull/20672#discussion_r953564900
##########
flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/AnalyzeTableUtil.java:
##########
@@ -97,14 +102,28 @@ public static TableResultInternal analyzeTable(
executeSqlAndGenerateStatistics(tableEnv, columns,
statSql);
CatalogTableStatistics tableStat = result.f0;
catalog.alterTableStatistics(objectPath, tableStat, false);
- CatalogColumnStatistics columnStat = result.f1;
- if (columnStat != null) {
- catalog.alterTableColumnStatistics(objectPath, columnStat,
false);
+ CatalogColumnStatistics newColumnStat = result.f1;
+ if (newColumnStat != null) {
+ CatalogColumnStatistics oldColumnStat =
+ catalog.getTableColumnStatistics(objectPath);
+ // merge stats.
+ CatalogColumnStatistics mergedColumnStatistics =
+ mergeColumnStatistics(oldColumnStat.copy(),
newColumnStat);
Review Comment:
> It's better we can move the `copy` operation into `mergeColumnStatistics `
method
Done!
--
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]