difin commented on code in PR #4348:
URL: https://github.com/apache/hive/pull/4348#discussion_r1214446712


##########
standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java:
##########
@@ -1454,6 +1454,16 @@ public void createTable(CreateTableRequest request) 
throws
       request.setProcessorIdentifier(processorIdentifier);
     }
 
+    EnvironmentContext envContext = request.getEnvContext();
+    envContext = Optional.ofNullable(envContext).orElse(new 
EnvironmentContext());
+
+    Map<String, String> props = 
Optional.ofNullable(envContext.getProperties()).orElse(new HashMap<>());
+    props.put(StatsSetupConst.HIVE_ICEBERG_STATS_SOURCE, 
+            conf.get(StatsSetupConst.HIVE_ICEBERG_STATS_SOURCE, 
HiveMetaHook.ICEBERG.toLowerCase()));
+
+    envContext.setProperties(props);

Review Comment:
   Yes, it is a good improvement. Done.



##########
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/utils/MetaStoreServerUtils.java:
##########
@@ -546,7 +553,11 @@ public static void 
updateTableStatsForCreateTable(Warehouse wh, Database db, Tab
       }
     }
 
-    if (MetastoreConf.getBoolVar(conf, 
MetastoreConf.ConfVars.STATS_AUTO_GATHER)) {
+    String statsSource = Optional.ofNullable(envContext).orElse(new 
EnvironmentContext(Collections.emptyMap()))
+            .getProperties().getOrDefault(HIVE_ICEBERG_STATS_SOURCE, 
HiveMetaHook.ICEBERG.toLowerCase()).toLowerCase();
+    if (MetastoreConf.getBoolVar(conf, 
MetastoreConf.ConfVars.STATS_AUTO_GATHER) && 
+        !(isIcebergTable && 
statsSource.equals(HiveMetaHook.ICEBERG.toLowerCase()))) {
+      LOG.debug(STATS_CALC_CALL_LOG_MSG + tbl.getCatName() + "." + 
tbl.getDbName() + "." + tbl.getTableName());

Review Comment:
   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]


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

Reply via email to