You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@hive.apache.org by "ayushtkn (via GitHub)" <gi...@apache.org> on 2023/06/02 04:52:04 UTC

[GitHub] [hive] ayushtkn commented on a diff in pull request #4348: HIVE-27355: Iceberg: Create table can be slow due to file listing for…

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


##########
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:
   does ``envContext.putToProperties()`` work?



##########
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:
   Use logger format
   ```
   LOG.debug(STATS_CALC_CALL_LOG_MSG {}.{}.{}, tbl.getCatName(), tbl.getDbName(), tbl.getTableName()));
   ```
   I don't think the constant STATS_CALC_CALL_LOG_MSG is required, can directly put the text over here



-- 
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: gitbox-unsubscribe@hive.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org