Uploaded image for project: 'IMPALA'
  1. IMPALA
  2. IMPALA-6375

Allow setting 'kudu.table_name' and 'EXTERNAL' table properties in one step

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: Impala 2.10.0
    • Fix Version/s: None
    • Component/s: Catalog
    • Labels:
    • Epic Color:
      ghx-label-4

      Description

      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:
      https://github.com/apache/impala/blob/master/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.

      // 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));
      }
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                BoglarkaEgyed Boglarka Egyed
                Reporter:
                gaborkaszab Gabor Kaszab
              • Votes:
                2 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated: