Use CREATE TABLE AS SELECT
You can create a table by querying any other table or tables in Impala, using a
CREATE TABLE ... AS SELECT
statement.
The
following example imports all rows from an existing table, old_table
, into a new Kudu table, new_table
. The columns in new_table
will have the same names and types as
the columns in old_table
, but you will
need to additionally specify the primary key and partitioning schema.
CREATE TABLE new_table
PRIMARY KEY (ts, name)
PARTITION BY HASH(name) PARTITIONS 8
STORED AS KUDU
AS SELECT ts, name, value FROM old_table;
You can refine the SELECT
statement to only match the rows and
columns you want to be inserted into the new table. You can also rename the columns
by using syntax like SELECT name as new_col_name
.