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

Error message when moving a partitioned table from one database to another

    Details

      Description

      CREATE DATABASE IF NOT EXISTS db1;
      CREATE DATABASE IF NOT EXISTS db2;
      DROP TABLE IF EXISTS db1.tb1;
      DROP TABLE IF EXISTS db2.tb1;
      CREATE TABLE db1.tb1 ( c1 int ) PARTITIONED BY ( c2 string );

      [localhost.localdomain:21000] > ALTER TABLE db1.tb1 RENAME TO db2.tb1;
      Query: alter TABLE db1.tb1 RENAME TO db2.tb1
      ERROR: 
      ImpalaRuntimeException: Error making 'alter_table' RPC to Hive Metastore: 
      CAUSED BY: MetaException: Column c2 doesn't exist in table tb1 in database db2
      

      Despite the error message, the metastore gets updated...
      INVALIDATE METADATA db1.tb1;
      INVALIDATE METADATA db2.tb1;

      [localhost.localdomain:21000] > SHOW TABLES IN db1 LIKE 'tb1';
      Query: show TABLES IN db1 LIKE 'tb1'
      
      Fetched 0 row(s) in 0.01s
      [localhost.localdomain:21000] > SHOW TABLES IN db2 LIKE 'tb1';
      Query: show TABLES IN db2 LIKE 'tb1'
      +------+
      | name |
      +------+
      | tb1  |
      +------+
      

      The underlying error comes from the Metastore, but this is not a Metastore bug. It appears as though Impala passes an incorrect parameter to the Metastore. See CatalogOpExecutor.alterTableOrViewRename():

      ...
      // Perform the table rename in any case.
      msClient.getHiveClient().alter_table(tableName.getDb(), tableName.getTbl(), msTbl);
      ...
      

        Attachments

          Activity

            People

            • Assignee:
              tianyiwang Tianyi Wang
              Reporter:
              mdominguez@cloudera.com Mariano Dominguez
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: