๐ปTech/๐hadoop
kudu ๋ช ๋ น์ด ์ ๋ฆฌ
_viper_
2020. 12. 23. 11:03
๋ฐ์ํ
โพ ํ ์ด๋ธ ์์ฑ (as select)
CREATE TABLE temp.kudu_cm_audits
PRIMARY KEY (audit_id)
STORED AS KUDU
TBLPROPERTIES ('kudu.num_tablet_replicas' = '1')
AS SELECT * FROM temp.cm_audits
;
โพ ํ ์ด๋ธ ์์ฑ (range partition)
CREATE TABLE IF NOT EXISTS temp.kudu_sample(
gubun string,
seq int,
code string,
description string,
total_emp int,
salary int,
PRIMARY KEY(gubun,seq)
)
PARTITION BY RANGE(gubun)(
PARTITION VALUE = '20210712'
)
COMMENT 'table comm'
STORED AD kudu;
โพ ํ ์ด๋ธ ์์ฑ (hash partition)
- hash ํํฐ์ ์ ์ฐธ๊ณ (For large tables, prefer to use roughly 10 partitions per server in the cluster.)
- https://docs.cloudera.com/cdp-private-cloud-base/7.1.6/impala-reference/topics/impala-kudu-partitioning.html
CREATE TABLE IF NOT EXISTS temp.kudu_sample(
gubun string,
seq int,
code string,
description string,
total_emp int,
salary int,
PRIMARY KEY(gubun,seq)
)
PARTITION BY HASH PARTITIONS 50
COMMENT 'table comm'
STORED AD kudu;
โพ ํํฐ์ ์ถ๊ฐ
ALTER TABLE temp.kudu_sample ADD RANGE PARTITION VALUE = '20210713';
โพ ํํฐ์ ์กฐํ (range)
SHOW RANGE PARTITION temp.kudu_sample;