๐Ÿ’ป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)

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;