CREATE DATABASE IF NOT EXISTS db_nm;
1) external table 만들기
CREATE EXTERNAL TABLE IF NOT EXISTS db_nm.tb_nm (
repotype string,
repo string,
requser string,
tags array<string>
)
PARTITIONED BY (dt string)
ROW FORMAT SERDE 'org.apache.hive.hcatalog.data.JsonSerDe'
STORED AS TEXTFILE
LOCATION 'hdfs://name/tmp/log'
;
2) managed table 만들기
CREATE TABLE IF NOT EXISTS db_nm.tb_nm (
repotype string,
repo string,
requser string,
tags array<string>
)
PARTITIONED BY (dt string)
ROW FORMAT SERDE 'org.apache.hive.hcatalog.data.JsonSerDe'
STORED AS TEXTFILE
LOCATION 'hdfs://name/tmp/log'
;
ALTER TABLE db_nm.tb_nm ADD PARTITION (dt='20200326') LOCATION '/tmp/log/20200326';