[ 
https://issues.apache.org/jira/browse/HIVE-20143?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Sergey Shelukhin updated HIVE-20143:
------------------------------------
    Description: 
Discovered while looking at txn stats. This applies for non-txn tables;  works 
fine for truncate+analyze for non-partitioned tables, but not for partitions:
{noformat}
set hive.stats.dbclass=fs;
set hive.stats.fetch.column.stats=true;
set hive.stats.autogather=true;
set hive.stats.column.autogather=true;
set hive.compute.query.using.stats=true;
set hive.mapred.mode=nonstrict;
set hive.explain.user=false;
set hive.fetch.task.conversion=none;
set hive.query.results.cache.enabled=false;

create table stats_part1(key int,value string) partitioned by (p int);
insert into table stats_part1 partition(p=101) values (1, "foo");
insert into table stats_part1 partition(p=102) values (2, "bar");
explain select count(key) from stats_part1; -- from stats

truncate table stats_part1 partition(p=101);
explain select count(key) from stats_part1; -- not from stats, ok

analyze table stats_part1 partition(p) compute statistics for columns;
explain select count(key) from stats_part1; -- not from stats still
{noformat}


  was:
Discovered while looking at txn stats. This works fine for truncate+analyze for 
non-partitioned tables, but not for partitions:
{noformat}
set hive.stats.dbclass=fs;
set hive.stats.fetch.column.stats=true;
set hive.stats.autogather=true;
set hive.stats.column.autogather=true;
set hive.compute.query.using.stats=true;
set hive.mapred.mode=nonstrict;
set hive.explain.user=false;
set hive.fetch.task.conversion=none;
set hive.query.results.cache.enabled=false;

create table stats_part1(key int,value string) partitioned by (p int);
insert into table stats_part1 partition(p=101) values (1, "foo");
insert into table stats_part1 partition(p=102) values (2, "bar");
explain select count(key) from stats_part1; -- from stats

truncate table stats_part1 partition(p=101);
explain select count(key) from stats_part1; -- not from stats, ok

analyze table stats_part1 partition(p) compute statistics for columns;
explain select count(key) from stats_part1; -- not from stats still
{noformat}



> analyze doesn't mark partition column stats as accurate after truncate
> ----------------------------------------------------------------------
>
>                 Key: HIVE-20143
>                 URL: https://issues.apache.org/jira/browse/HIVE-20143
>             Project: Hive
>          Issue Type: Bug
>          Components: Statistics
>            Reporter: Sergey Shelukhin
>            Priority: Major
>
> Discovered while looking at txn stats. This applies for non-txn tables;  
> works fine for truncate+analyze for non-partitioned tables, but not for 
> partitions:
> {noformat}
> set hive.stats.dbclass=fs;
> set hive.stats.fetch.column.stats=true;
> set hive.stats.autogather=true;
> set hive.stats.column.autogather=true;
> set hive.compute.query.using.stats=true;
> set hive.mapred.mode=nonstrict;
> set hive.explain.user=false;
> set hive.fetch.task.conversion=none;
> set hive.query.results.cache.enabled=false;
> create table stats_part1(key int,value string) partitioned by (p int);
> insert into table stats_part1 partition(p=101) values (1, "foo");
> insert into table stats_part1 partition(p=102) values (2, "bar");
> explain select count(key) from stats_part1; -- from stats
> truncate table stats_part1 partition(p=101);
> explain select count(key) from stats_part1; -- not from stats, ok
> analyze table stats_part1 partition(p) compute statistics for columns;
> explain select count(key) from stats_part1; -- not from stats still
> {noformat}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to