IMPALA-2810: Remove column stats restoration when altering table

This patch removes most code introduced in IMPALA-1711, which triggers
an error message and causes catalog inconsistency when a partitioned
table is moved to a different database.
IMPALA-1711 is a workaround for HIVE-9720, in which column stats is not
properly updated when a table is moved across databases. Hive-9720 has
been resolved in Hive 1.2.0 so the workaround is no longer needed.
A test case moving a partitioned table to a different database is added
to alter-table.test.

Change-Id: I0ca7063ca1aa9faceed9568d22740d91b6dc20d3
Reviewed-on: http://gerrit.cloudera.org:8080/7857
Reviewed-by: Alex Behm <alex.behm@cloudera.com>
Tested-by: Impala Public Jenkins
This commit is contained in:
Tianyi Wang
2017-08-25 17:41:13 -07:00
committed by Impala Public Jenkins
parent 9ce691af22
commit f8e7c31b2c
2 changed files with 59 additions and 36 deletions

View File

@@ -771,14 +771,15 @@ invalidate metadata $DATABASE2.mv2
---- RESULTS
====
---- QUERY
show tables in $DATABASE like '%mv%'
show tables in $DATABASE like '*mv*'
---- RESULTS
---- TYPES
STRING
====
---- QUERY
show tables in $DATABASE2 like '%mv%'
show tables in $DATABASE2 like '*mv*'
---- RESULTS
'mv2'
---- TYPES
STRING
====
@@ -802,7 +803,61 @@ drop table $DATABASE2.mv2
---- RESULTS
====
---- QUERY
show tables in $DATABASE2 like '%mv%'
show tables in $DATABASE2 like '*mv*'
---- RESULTS
---- TYPES
STRING
====
---- QUERY
# Tests that renaming a partitioned table with column stats across databases
# succeeds and preserves table and column stats, and allows the renamed table
# to be dropped (IMPALA-2810).
create table $DATABASE.mv (x int) partitioned by (y string);
insert into $DATABASE.mv partition(y='a') values(1);
insert into $DATABASE.mv partition(y='b') values(2);
insert into $DATABASE.mv partition(y=NULL) values(NULL);
compute stats $DATABASE.mv;
alter table $DATABASE.mv rename to $DATABASE2.mv2;
invalidate metadata $DATABASE2.mv2
---- RESULTS
====
---- QUERY
show tables in $DATABASE like '*mv*'
---- RESULTS
---- TYPES
STRING
====
---- QUERY
show tables in $DATABASE2 like '*mv*'
---- RESULTS
'mv2'
---- TYPES
STRING
====
---- QUERY
show table stats $DATABASE2.mv2
---- RESULTS: VERIFY_IS_EQUAL_SORTED
'NULL',1,1,'3B','NOT CACHED','NOT CACHED','TEXT','false',regex:.*
'a',1,1,'2B','NOT CACHED','NOT CACHED','TEXT','false',regex:.*
'b',1,1,'2B','NOT CACHED','NOT CACHED','TEXT','false',regex:.*
'Total',3,3,'7B','0B','','','',''
---- TYPES
STRING, BIGINT, BIGINT, STRING, STRING, STRING, STRING, STRING, STRING
====
---- QUERY
show column stats $DATABASE2.mv2
---- RESULTS: VERIFY_IS_EQUAL_SORTED
'x','INT',2,-1,4,4
'y','STRING',3,1,-1,-1
---- TYPES
STRING, STRING, BIGINT, BIGINT, BIGINT, DOUBLE
====
---- QUERY
drop table $DATABASE2.mv2
---- RESULTS
====
---- QUERY
show tables in $DATABASE2 like '*mv*'
---- RESULTS
---- TYPES
STRING