--創建外部表 CREATE EXTERNAL TABLE my_report( last_update string, col_a string) PARTITIONED BY ( par_dt string)ROW FORMAT DELIMITED FIELDS TERMINATED BY ', ...
--創建外部表
CREATE EXTERNAL TABLE my_report(
last_update string,
col_a string)
PARTITIONED BY (
par_dt string)ROW FORMAT DELIMITED FIELDS TERMINATED BY ',' location '/user/hive/warehouse/zyz.db/my_report';
-----添加分區
alter table my_daily_report add partition (par_dt='20170101') location '/user/hive/warehouse/zyz.db/my_report/20170101';
--上傳測試數據
[zkpk@master ~]$cat test.txt
20160101,zyz
[zkpk@master ~]hadoop fs -put ./test.txt /user/hive/warehouse/zyz.db/my_report/20170101/