kasakrisz commented on code in PR #4228:
URL: https://github.com/apache/hive/pull/4228#discussion_r1182556113


##########
ql/src/java/org/apache/hadoop/hive/ql/ddl/table/create/CreateTableDesc.java:
##########
@@ -921,14 +925,23 @@ public Table toTable(HiveConf conf) throws HiveException {
     // When replicating the statistics for a table will be obtained from the 
source. Do not
     // reset it on replica.
     if (replicationSpec == null || !replicationSpec.isInReplicationScope()) {
-      if (!this.isCTAS && (tbl.getPath() == null || (!isExternal() && 
tbl.isEmpty()))) {
-        if (!tbl.isPartitioned() && 
conf.getBoolVar(HiveConf.ConfVars.HIVESTATSAUTOGATHER)) {
-          
StatsSetupConst.setStatsStateForCreateTable(tbl.getTTable().getParameters(),
-                  MetaStoreUtils.getColumnNames(tbl.getCols()), 
StatsSetupConst.TRUE);
-        }
-      } else {
-        
StatsSetupConst.setStatsStateForCreateTable(tbl.getTTable().getParameters(), 
null,
-                StatsSetupConst.FALSE);
+      // Remove COLUMN_STATS_ACCURATE=true from table's parameter, let the HMS 
determine if
+      // there is need to add column stats dependent on the table's location.
+      
StatsSetupConst.setStatsStateForCreateTable(tbl.getTTable().getParameters(), 
null,
+          StatsSetupConst.FALSE);
+      if (!this.isCTAS && !tbl.isPartitioned() && !tbl.isTemporary() &&
+          conf.getBoolVar(HiveConf.ConfVars.HIVESTATSAUTOGATHER)) {
+        // Put the flag into the dictionary in order not to pollute the table,
+        // ObjectDictionary is meant to convey repeatitive messages.
+        ObjectDictionary dictionary = tbl.getTTable().isSetDictionary() ?
+            tbl.getTTable().getDictionary() : new ObjectDictionary();
+        List<ByteBuffer> buffers = new ArrayList<>();
+        String statsSetup = 
StatsSetupConst.ColumnStatsSetup.getStatsSetupAsString(true,
+            tbl.isIcebergTable() ? "metadata" : null, // Skip metadata 
directory for Iceberg table

Review Comment:
   Please remove the method `isIcebergTable()` from the `Table` class. The 
information which files/directories has to be filtered out should come from the 
`HiveStorageHandler` if the `Table.getStorageHandler` is not null.



-- 
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