Gabor Kaszab created IMPALA-6375: ------------------------------------ Summary: Allow setting 'kudu.table_name' and 'EXTERNAL' table properties in one step Key: IMPALA-6375 URL: https://issues.apache.org/jira/browse/IMPALA-6375 Project: IMPALA Issue Type: Bug Components: Catalog Affects Versions: Impala 2.10.0 Reporter: Gabor Kaszab Priority: Minor
+Background:+ It is not allowed to modify 'kudu.table_name' table property for managed Kudu tables since https://issues.apache.org/jira/browse/IMPALA-5654 Meanwhile, it is valid to modify this property on external Kudu tables. +Issue:+ There is one scenario when the user changes a managed table to be external and change the 'kudu.table_name' in the same step, that is actually rejected by Impala/Catalog. However, this should be a valid scenario. +Steps to reproduce:+ 1) Create a managed Kudu table: my_table1 (Kudu table name: impala::db_name.my_table1) 2) Create another managed Kudu table: my_table2 (impala::db_name.my_table2) 3) Alter my_table2 to external and point it's kudu.table_name to my_table1 in the same step: alter table my_table2 set tblproperties('EXTERNAL'='TRUE', 'kudu.table_name'='impala::db_name.my_table1'); Error is displayed here saying that the table already exists as Impala tries to change the kudu.table_name first before modifying the table to external. Note, that executing this in 2 steps succeeds: 1) 2) Same as above 3) alter table my_table2 set tblproperties('EXTERNAL'='TRUE'); 4) alter table my_table2 set tblproperties('kudu.table_name'='impala::db_name.my_table1'); +Fix proposal:+ http://github.mtv.cloudera.com/CDH/Impala/blob/cdh5-trunk/fe/src/main/java/org/apache/impala/service/CatalogOpExecutor.java private void alterTableSetTblProperties This code tries to modify kudu.table_name and expects it to be unique. However, if we also change the table from managed to external then we should allow to change. {code:java} // If 'kudu.table_name' is specified and this is a managed table, rename // the underlying Kudu table. if (properties.containsKey(KuduTable.KEY_TABLE_NAME) && !properties.get(KuduTable.KEY_TABLE_NAME).equals( msTbl.getParameters().get(KuduTable.KEY_TABLE_NAME)) && !Table.isExternalTable(msTbl)) { KuduCatalogOpExecutor.renameTable((KuduTable) tbl, properties.get(KuduTable.KEY_TABLE_NAME)); } {code} -- This message was sent by Atlassian JIRA (v6.4.14#64029)