Details
-
Sub-task
-
Status: Resolved
-
Blocker
-
Resolution: Fixed
-
Kudu_Impala
Description
The current syntax is very verbose and has non-standard table properties that the user needs to lookup in the documentation. Instead Impala should try to use standard sql for table creation.
Current syntax
CREATE TABLE <Hive metastore name> [...] TBLPROPERTIES( 'storage_handler' = 'com.cloudera.kudu.hive.KuduStorageHandler', 'kudu.table_name' = <Kudu name>, 'kudu.master_addresses' = <addrs>, 'kudu.key_columns' = <col, …>, [‘kudu.num_tablet_replicas’ = <num>])
Proposed syntax
1) Add PRIMARY KEY and STORED AS KUDU
CREATE TABLE ... [(<col>, …, PRIMARY KEY (<col>, …))] | [(<col> PRIMARY KEY, …)] STORED AS KUDU
2) Add Impala (catalogd?) startup flag to list the default Kudu master addresses
-default_kudu_master_addresses
What actually happens
CREATE TABLE <Hive metastore name> [...] TBLPROPERTIES ( 'storage_handler' = 'com.cloudera.kudu.hive.KuduStorageHandler', 'kudu.table_name' = [<Hive metastore db name>.]<Hive metastore name>, 'kudu.master_addresses' = <FLAG_default_kudu_master_addresses>, 'kudu.key_columns' = <PRIMARY KEY cols>)
The default TBLPROPERTIES are set and the user can still override them.
Examples
Old way
CREATE TABLE foo (key INT, value STRING) TBLPROPERTIES( 'storage_handler' = 'com.cloudera.kudu.hive.KuduStorageHandler', 'kudu.table_name' = ‘foo’, 'kudu.master_addresses' = ‘127.0.0.1’, 'kudu.key_columns' = ‘key’)
New way
CREATE TABLE foo (key INT PRIMARY KEY, value STRING) STORED AS KUDU
Override an option
CREATE TABLE foo (key INT PRIMARY KEY, value STRING) STORED AS KUDU TBLPROPERTIES('kudu.table_name' = ‘bar’)
Composite Key
CREATE TABLE foo (key_1 INT, key_2 INT, value STRING, PRIMARY KEY(key_1, key_2)) STORED AS KUDU