[ 
https://issues.apache.org/jira/browse/HIVE-27007?focusedWorklogId=842566&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-842566
 ]

ASF GitHub Bot logged work on HIVE-27007:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 31/Jan/23 12:45
            Start Date: 31/Jan/23 12:45
    Worklog Time Spent: 10m 
      Work Description: kasakrisz commented on code in PR #4000:
URL: https://github.com/apache/hive/pull/4000#discussion_r1091850767


##########
ql/src/java/org/apache/hadoop/hive/ql/stats/StatsUtils.java:
##########
@@ -277,23 +277,31 @@ private static Statistics collectStatistics(HiveConf 
conf, PrunedPartitionList p
     boolean metaTable = table.getMetaTable() != null;
 
     if (!table.isPartitioned()) {
+      long ds, nr, fs;
+      if (table.isNonNative() && 
table.getStorageHandler().canProvideBasicStatistics()) {
+        Map<String, String> icebergBasicStatMap = 
table.getStorageHandler().getBasicStatistics(Partish.buildFor(table));
+        ds = Long.parseLong(icebergBasicStatMap.get("totalSize"));
+        nr = Long.parseLong(icebergBasicStatMap.get("numRows"));
+        fs = Long.parseLong(icebergBasicStatMap.get("numFiles"));

Review Comment:
   Should a null check be added here and/or handle NumberFormatException?
   
   What would be the stats values if it can not be extracted via storage 
handler?
   In case of non-storage handler path there are so called `enhancers` to 
estimate and fix the values:
   ```
   basicStatsFactory.addEnhancer(new 
BasicStats.RowNumEstimator(estimateRowSizeFromSchema(conf, schema)));
   basicStatsFactory.addEnhancer(new BasicStats.SetMinRowNumber01());
   ```



##########
ql/src/java/org/apache/hadoop/hive/ql/stats/StatsUtils.java:
##########
@@ -277,23 +277,31 @@ private static Statistics collectStatistics(HiveConf 
conf, PrunedPartitionList p
     boolean metaTable = table.getMetaTable() != null;
 
     if (!table.isPartitioned()) {
+      long ds, nr, fs;

Review Comment:
   Could you please declare each variable in separate lines.





Issue Time Tracking
-------------------

    Worklog Id:     (was: 842566)
    Time Spent: 20m  (was: 10m)

> Iceberg: Use BasicStats from iceberg table's currrentSnapshot.summary() for 
> query planning
> ------------------------------------------------------------------------------------------
>
>                 Key: HIVE-27007
>                 URL: https://issues.apache.org/jira/browse/HIVE-27007
>             Project: Hive
>          Issue Type: Improvement
>            Reporter: Simhadri Govindappa
>            Assignee: Simhadri Govindappa
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 20m
>  Remaining Estimate: 0h
>




--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to