hive中创建外部表&分区表测试
--创建外部表
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/