mirror of
https://github.com/apache/impala.git
synced 2026-01-23 12:00:26 -05:00
Hive depends on property COLUMN_STATS_ACCURATE to tell if the stored statistics accurate. After Impala inserts data, it does not set statistics values up-to-date(for example numRows). Impala should unset COLUMN_STATS_ACCURATE to tell Hive the stored stats are no longer accurate. The patch impletes: After Impala insert data, Remove COLUMN_STATS_ACCURATE from table properties if it exists Remove COLUMN_STATS_ACCURATE from partition params if it exists Add helper methods to handle alter table/partition for acid tables. Implements the stats changes above for both acid/non-acid tables. Tests: Manual tests. Run core tests. Add ee tests to test interop with Hive for acid/external tables. Change-Id: I13f4a77022a7112e10a07314359f927eae083deb Reviewed-on: http://gerrit.cloudera.org:8080/14037 Reviewed-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com> Tested-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
46 lines
1.3 KiB
Plaintext
46 lines
1.3 KiB
Plaintext
====
|
|
---- HIVE_QUERY
|
|
use $DATABASE;
|
|
create external table ext_nopart_colstats (x int);
|
|
insert into ext_nopart_colstats values (1);
|
|
analyze table ext_nopart_colstats compute statistics for columns;
|
|
create external table ext_nopart_colstatschg (x int);
|
|
insert into ext_nopart_colstatschg values (1);
|
|
analyze table ext_nopart_colstatschg compute statistics for columns;
|
|
create external table ext_part_colstats (x int) partitioned by (ds string);
|
|
alter table ext_part_colstats add partition (ds='2010-01-01');
|
|
alter table ext_part_colstats add partition (ds='2010-01-02');
|
|
insert into ext_part_colstats partition (ds='2010-01-01') values (1);
|
|
analyze table ext_part_colstats partition(ds='2010-01-01')
|
|
compute statistics for columns;
|
|
====
|
|
---- QUERY
|
|
invalidate metadata ext_nopart_colstats;
|
|
show create table ext_nopart_colstats;
|
|
---- RESULTS
|
|
row_regex: .*COLUMN_STATS_ACCURATE.*
|
|
====
|
|
---- QUERY
|
|
invalidate metadata ext_nopart_colstatschg;
|
|
insert into ext_nopart_colstatschg values (2);
|
|
show create table ext_nopart_colstatschg;
|
|
---- RESULTS
|
|
row_regex: (?!.*COLUMN_STATS_ACCURATE)
|
|
====
|
|
---- QUERY
|
|
select x from ext_nopart_colstatschg;
|
|
---- RESULTS
|
|
1
|
|
2
|
|
====
|
|
---- QUERY
|
|
invalidate metadata ext_part_colstats;
|
|
insert into ext_part_colstats partition (ds='2010-01-01') values (2);
|
|
select x from ext_part_colstats where ds='2010-01-01';
|
|
---- RESULTS
|
|
1
|
|
2
|
|
---- TYPES
|
|
int
|
|
====
|