본문 바로가기
💻Tech/🐘hadoop

kudu 명령어 정리

by _viper_ 2020. 12. 23.
반응형

 테이블 생성 (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;