bowenli86 commented on a change in pull request #10380:
[FLINK-14662]Distinguish unknown CatalogTableStatistics and zero
URL: https://github.com/apache/flink/pull/10380#discussion_r352754679
##########
File path:
flink-connectors/flink-connector-hive/src/main/java/org/apache/flink/table/catalog/hive/HiveCatalog.java
##########
@@ -1141,42 +1142,49 @@ public void alterTableColumnStatistics(ObjectPath
tablePath, CatalogColumnStatis
}
/**
- * Determine if statistics is need to be updated, if it needs to be
updated and updated its parameters.
- * @param statistics original ``hive table statistics.
- * @param parameters new catalog table statistics parameters.
- * @return needUpdateStatistics flag which indicates whether need to
update stats.
+ * Determine if statistics need to be updated or not.
+ * @param newTableStats new catalog table statistics.
+ * @param parameters original hive table statistics parameters.
+ * @return whether need to update stats.
*/
- private static boolean
compareAndUpdateStatisticsProperties(CatalogTableStatistics statistics,
Map<String, String> parameters) {
- boolean needUpdateStatistics;
- String oldRowCount =
parameters.getOrDefault(StatsSetupConst.ROW_COUNT,
HiveStatsUtil.DEFAULT_STATS_ZERO_CONST);
- String oldTotalSize =
parameters.getOrDefault(StatsSetupConst.TOTAL_SIZE,
HiveStatsUtil.DEFAULT_STATS_ZERO_CONST);
- String oldNumFiles =
parameters.getOrDefault(StatsSetupConst.NUM_FILES,
HiveStatsUtil.DEFAULT_STATS_ZERO_CONST);
- String oldRawDataSize =
parameters.getOrDefault(StatsSetupConst.RAW_DATA_SIZE,
HiveStatsUtil.DEFAULT_STATS_ZERO_CONST);
- needUpdateStatistics = statistics.getRowCount() !=
Long.parseLong(oldRowCount) || statistics.getTotalSize() !=
Long.parseLong(oldTotalSize)
- || statistics.getFileCount() !=
Integer.parseInt(oldNumFiles) || statistics.getRawDataSize() !=
Long.parseLong(oldRawDataSize);
- if (needUpdateStatistics) {
- parameters.put(StatsSetupConst.ROW_COUNT,
String.valueOf(statistics.getRowCount()));
- parameters.put(StatsSetupConst.TOTAL_SIZE,
String.valueOf(statistics.getTotalSize()));
- parameters.put(StatsSetupConst.NUM_FILES,
String.valueOf(statistics.getFileCount()));
- parameters.put(StatsSetupConst.RAW_DATA_SIZE,
String.valueOf(statistics.getRawDataSize()));
- }
- return needUpdateStatistics;
+ private static boolean needUpdateStatistics(CatalogTableStatistics
newTableStats, Map<String, String> parameters) {
Review comment:
maybe rename to `statsChanged()`?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services