Search code examples
sqlhadoopimpalaparquet

Trying to copy data from Impala Parquet table to a non-parquet table


I am moving data around within Impala, not my design, and I have lost some data. I need to copy the data from the parquet tables back to their original non-parquet tables. Originally, the developers had done this with a simple one liner in a script. Since I don't know anything about databases and especially about Impala I was hoping you could help me out. This is the one line that is used to translate to a parquet table that I need to be reversed.

impalaShell -i <ipaddr> use db INVALIDATE METADATA <text_table>; 
CREATE TABLE <parquet_table> LIKE <text_table> STORED AS PARQUET TABLE;
INSERT OVERWRITE <parquet_table> SELECT * FROM <text_table>;

Thanks.


Solution

  • Have you tried simply doing

     CREATE TABLE <text_table> 
         AS 
     SELECT * 
       FROM <parquet_table>
    

    Per the Cloudera documentation, this should be possible.

    NOTE: Ensure that your does not exist or use a table name that does not already exist so that you do not accidentally overwrite other data.