Creating a new Kudu table from Impala
Creating a new table in Kudu from Impala is similar to mapping an existing Kudu table to an Impala table, except that you need to specify the schema and partitioning information yourself. Use the examples in this section as a guideline. Impala first creates the table, then creates the mapping.
CREATE TABLE statement, the columns that comprise the primary
key must be listed first. Additionally, primary key columns are implicitly considered
CREATE TABLE example distributes the table into 16
partitions by hashing the
id column, for simplicity.
CREATE TABLE my_first_table ( id BIGINT, name STRING, PRIMARY KEY(id) ) PARTITION BY HASH PARTITIONS 16 STORED AS KUDU;
By default, Kudu tables created through Impala use a tablet replication factor of 3.
To specify the replication factor for a Kudu table, add a
TBLPROPERTIES clause to the
CREATE TABLE statement
as shown below where
is the replication factor you want to
TBLPROPERTIES ('kudu.num_tablet_replicas' = 'n')
A replication factor must be an odd number.
kudu.num_tablet_replicas table property using the
ALTER TABLE currently has no effect.
The Impala SQL Reference CREATE TABLE topic has more details and examples.