建表语句
CREATE TABLE my_first_table
(
id BIGINT,
name STRING,
PRIMARY KEY(id)
)
PARTITION BY HASH PARTITIONS 16
STORED AS KUDU;
CREATE TABLE kudu_testdb.perf_test_t1
(
id string ENCODING PLAIN_ENCODING COMPRESSION SNAPPY,
int_value int,
bigint_value bigint,
timestamp_value timestamp,
bool_value int,
PRIMARY KEY (histdate,id)
)
PARTITION BY HASH (histdate,id) PARTITIONS 2
STORED AS KUDU
TBLPROPERTIES (
'kudu.table_name' = 'testdb.perf_test_t1',
'kudu.master_addresses' = '192.172.2.2:7051,192.172.2.3:7051,192.172.2.4:7051'
);
CREATE TABLE testinkudu(…………)
partition by hash partitions 8
STORED AS KUDU [AS SELECT * FROM OTHER_TABLE];
# insert 针对已存在的主键不更新
insert into testinkudu values('a', 12);
insert into testinkudu values('a', 12),('b', 13),('c', 14);
insert into testinkudu select * from other_table;
# upsert 先更新再插入
upsert into testinkudu values('a', 12);
hi