This is an automated email from the ASF dual-hosted git repository.

yiguolei pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-2.1 by this push:
     new 4f2ca439176 [minor](fe) simplfy some code in HMSExternalTable (#32344) 
(#38675)
4f2ca439176 is described below

commit 4f2ca439176590b3f37d8328b5c1d08622fb8059
Author: Mingyu Chen <[email protected]>
AuthorDate: Fri Aug 2 11:27:10 2024 +0800

    [minor](fe) simplfy some code in HMSExternalTable (#32344) (#38675)
    
    bp #32344
    
    Co-authored-by: DuRipeng <[email protected]>
---
 .../org/apache/doris/datasource/hive/HMSExternalTable.java    | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/datasource/hive/HMSExternalTable.java
 
b/fe/fe-core/src/main/java/org/apache/doris/datasource/hive/HMSExternalTable.java
index 76f2f6c4b39..8b0fee92ad8 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/datasource/hive/HMSExternalTable.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/datasource/hive/HMSExternalTable.java
@@ -543,8 +543,7 @@ public class HMSExternalTable extends ExternalTable 
implements MTMVRelatedTableI
 
     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();
+        return parameters.keySet().stream().anyMatch(k -> 
k.startsWith(SPARK_COL_STATS + colName + "."));
     }
 
     public boolean fillColumnStatistics(String colName, Map<StatsType, String> 
statsTypes, Map<String, String> stats) {
@@ -556,12 +555,8 @@ public class HMSExternalTable extends ExternalTable 
implements MTMVRelatedTableI
         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)
-                stats.put(statsTypes.get(type), "NULL");
-            }
+            // 'NULL' should not happen, spark would have all type (except 
histogram)
+            stats.put(statsTypes.get(type), parameters.getOrDefault(key, 
"NULL"));
         }
         return true;
     }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to