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

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

                Author: ASF GitHub Bot
            Created on: 12/Jan/21 11:22
            Start Date: 12/Jan/21 11:22
    Worklog Time Spent: 10m 
      Work Description: deniskuzZ commented on a change in pull request #1834:
URL: https://github.com/apache/hive/pull/1834#discussion_r555698743



##########
File path: ql/src/java/org/apache/hadoop/hive/ql/parse/TaskCompiler.java
##########
@@ -412,12 +419,27 @@ private String extractTableFullName(StatsTask tsk) throws 
SemanticException {
         .getInputFormatClass();
     Table table = tableScan.getConf().getTableMetadata();
     List<Partition> partitions = new ArrayList<>();
+    AcidUtils.TableSnapshot tableSnapshot = null;
+    if (HiveConf.getBoolVar(conf, HiveConf.ConfVars.HIVE_STATS_TASK_OPTIMIZE)) 
{
+      tableSnapshot = AcidUtils.getTableSnapshot(conf, table, true);
+    }
     if (table.isPartitioned()) {
-      
partitions.addAll(parseContext.getPrunedPartitions(tableScan).getPartitions());
-      for (Partition partn : partitions) {
+      for (Partition partn : 
parseContext.getPrunedPartitions(tableScan).getPartitions()) {
         LOG.trace("adding part: " + partn);
+        if (tableSnapshot != null && 
ColStatsProcessor.canSkipStatsGeneration(table.getDbName(), 
table.getTableName(),
+                FileUtils.makePartName(table.getPartColNames(), 
partn.getTPartition().getValues()),
+                partn.getTPartition().getWriteId(), 
tableSnapshot.getValidWriteIdList())) {
+          continue;
+        }
+        partitions.add(partn);
         outputs.add(new WriteEntity(partn, WriteEntity.WriteType.DDL_NO_LOCK));
       }
+      if (partitions.isEmpty()) {
+        return null;

Review comment:
       could we refactor to return Optional 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.

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


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

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

> Analyze table job can be skipped when stats populated are already accurate
> --------------------------------------------------------------------------
>
>                 Key: HIVE-24515
>                 URL: https://issues.apache.org/jira/browse/HIVE-24515
>             Project: Hive
>          Issue Type: Improvement
>            Reporter: Rajesh Balamohan
>            Assignee: mahesh kumar behera
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> For non-partitioned tables, stats detail should be present in table level,
> e.g
> {noformat}
> COLUMN_STATS_ACCURATE={"BASIC_STATS":"true","COLUMN_STATS":{"d_current_day":"true"...
>  }}
>   {noformat}
> For partitioned tables, stats detail should be present in partition level,
> {noformat}
> store_sales(ss_sold_date_sk=2451819)
> {totalSize=0, numRows=0, rawDataSize=0, 
> COLUMN_STATS_ACCURATE={"BASIC_STATS":"true","COLUMN_STATS":{"ss_addr_sk":"true"....}}
>  
>  {noformat}
> When stats populated are already accurate, {{analyze table tn compute 
> statistics for columns}} should skip launching the job.
>  
> For ACID tables, stats are auto computed and it can skip computing stats 
> again when stats are accurate.
>  
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to