Clemens Valiente created IMPALA-6864:
----------------------------------------

             Summary: COMPUTE STATS overwrites table schema in Hive Metastore
                 Key: IMPALA-6864
                 URL: https://issues.apache.org/jira/browse/IMPALA-6864
             Project: IMPALA
          Issue Type: Bug
          Components: Catalog
    Affects Versions: Impala 2.9.0
            Reporter: Clemens Valiente


If Impala does not have the latest schema information from Hive, a COMPUTE 
STATS overwrites the table definition stored in Hive Metastore.

short example:

{code:sql}
# Hive
create table cvaliente.testschema (id int);
{code}
{code:sql}
# Impala
INVALIDATE METADATA cvaliente.testschema;
{code}
{code:sql}
# Hive
drop table cvaliente.testschema;
create table cvaliente.testschema (id int, value string);
{code}
{code:sql}
# Impala
COMPUTE STATS cvaliente.testschema;
{code}
{code:sql}
# Hive
show columns from cvaliente.testschema
{code}

In our case, due to the size and scope of our table we did {{REFRESH TABLE 
dbname.tblname PARTITION (partkey = partvalue)}} in impala 
followed by {{COMPUTE INCREMENTAL STATS dbname.tblname PARTITION (partkey = 
partvalue)}}
REFRESH TABLE ... PARTITION does not update the table schema unlike a simple 
REFRESH PARTITION so it kept the old schema and the COMPUTE INCREMENTAL 
STATS... PARTITION then updated the full table back with the old schema in Hive 
metastore.

- a REFRESH TABLE ... PARTITION should still update the table metadata from 
hive metastore
- a COMPUTE STATS should only write column statistics back to the metastore and 
NOT update the table schema.



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

Reply via email to