zhangbutao commented on code in PR #5400:
URL: https://github.com/apache/hive/pull/5400#discussion_r1728165452


##########
ql/src/java/org/apache/hadoop/hive/ql/optimizer/StatsOptimizer.java:
##########
@@ -945,7 +945,10 @@ private Long getRowCnt(
         if (!StatsUtils.areBasicStatsUptoDateForQueryAnswering(tbl, 
tbl.getParameters())) {
           return null;
         }
-        rowCnt = Long.valueOf(tbl.getProperty(StatsSetupConst.ROW_COUNT));
+        Map<String, String> basicStats = 
MetaStoreUtils.isNonNativeTable(tbl.getTTable()) ?
+          tbl.getStorageHandler().getBasicStatistics(tbl) : 
tbl.getParameters();

Review Comment:
   Discuss:
   Shoule we regard the stats is always accurate when statsSource is iceberg?
    If so, we need always to keep the configuration `iceberg.hive.keep.stats` 
true when statsSource is iceberg, so that we can optimization the count(*) when 
statsSource is iceberg by **StatsOptimizer**.  Same idea i wanted to do is 
https://github.com/apache/hive/pull/5215
   
https://github.com/apache/hive/blob/4f7200dc14acf71e189db05376baf4280742ff94/iceberg/iceberg-catalog/src/main/java/org/apache/iceberg/hive/HiveTableOperations.java#L174
   
   
https://github.com/apache/hive/blob/4f7200dc14acf71e189db05376baf4280742ff94/iceberg/iceberg-catalog/src/main/java/org/apache/iceberg/hive/HiveTableOperations.java#L225-L227
   
   
https://github.com/apache/hive/blob/4f7200dc14acf71e189db05376baf4280742ff94/ql/src/java/org/apache/hadoop/hive/ql/optimizer/StatsOptimizer.java#L945



-- 
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-unsubscr...@hive.apache.org

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


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

Reply via email to