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

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

                Author: ASF GitHub Bot
            Created on: 09/Feb/22 07:42
            Start Date: 09/Feb/22 07:42
    Worklog Time Spent: 10m 
      Work Description: kasakrisz commented on a change in pull request #2991:
URL: https://github.com/apache/hive/pull/2991#discussion_r802348206



##########
File path: ql/src/java/org/apache/hadoop/hive/ql/stats/BasicStatsTask.java
##########
@@ -512,6 +513,9 @@ private String toString(Map<String, String> parameters) {
         if (dpPartSpecs != null) {
           // load the list of DP partitions and return the list of partition 
specs
           list.addAll(dpPartSpecs);
+          // Reload partition metadata because another BasicStatsTask instance 
may have updated the stats.
+          List<String> partNames = 
list.stream().map(Partition::getName).collect(Collectors.toList());

Review comment:
       Initially I didn't want to refactor this method just provide a simple 
fix to the correctness issue.
   Thanks for your suggestions these are small changes and makes sense to me so 
I'm open to expand a bit the scope of this patch.
   
   My last commit is also a refactor: since the stream is created over the 
`dbPartSpecs` the `list` object became unnecessary in this if branch. So I 
decided to remove it completely.
   Let's see how ptest performs with this change.




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


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

    Worklog Id:     (was: 723483)
    Time Spent: 1h 20m  (was: 1h 10m)

> Invalid stats after multi inserting into the same partition
> -----------------------------------------------------------
>
>                 Key: HIVE-25918
>                 URL: https://issues.apache.org/jira/browse/HIVE-25918
>             Project: Hive
>          Issue Type: Sub-task
>          Components: Statistics
>            Reporter: Krisztian Kasa
>            Assignee: Krisztian Kasa
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 1h 20m
>  Remaining Estimate: 0h
>
> {code}
> create table source(p int, key int,value string);
> insert into source(p, key, value) values (101,42,'string42');
> create table stats_part(key int,value string) partitioned by (p int);
> from source
> insert into stats_part select key, value, p
> insert into stats_part select key, value, p;
> select count(*) from stats_part;
> {code}
> In this case {{StatsOptimizer}} helps serving this query because the result 
> should be {{rowNum}} of the partition {{p=101}}. The result is
> {code}
> 1
> {code}
> however it shloud be
> {code}
> 2
> {code}
> because both insert branches inserts 1-1 records.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to