morningman commented on code in PR #28525:
URL: https://github.com/apache/doris/pull/28525#discussion_r1438832009
##########
fe/fe-core/src/main/java/org/apache/doris/catalog/external/HMSExternalTable.java:
##########
@@ -531,6 +553,31 @@ private void initPartitionColumns(List<Column> schema) {
LOG.debug("get {} partition columns for table: {}",
partitionColumns.size(), name);
}
+ public boolean hasColumnStatistics(String colName) {
+ Map<String, String> parameters = remoteTable.getParameters();
+ return parameters.keySet().stream()
+ .filter(k -> k.startsWith(SPARK_COL_STATS + colName +
".")).findAny().isPresent();
+ }
+
+ public boolean fillColumnStatistics(String colName, Map<StatsType, String>
statsTypes, Map<String, String> stats) {
+ makeSureInitialized();
+ if (!hasColumnStatistics(colName)) {
+ return false;
+ }
+
+ Map<String, String> parameters = remoteTable.getParameters();
+ for (StatsType type : statsTypes.keySet()) {
+ String key = SPARK_COL_STATS + colName +
MAP_SPARK_STATS_TO_DORIS.getOrDefault(type, "-");
+ if (parameters.containsKey(key)) {
+ stats.put(statsTypes.get(type), parameters.get(key));
+ } else {
+ // should not happen, spark would have all type (except
histogram)
+ return false;
Review Comment:
How about put a default value(eg, `-`) in `stats` instead of `return false`?
In case that some properties are missing accidentally.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]