表结构:
create table if not exists china_partition(
ProvinceID int,
ProvinceName string,
CityID int,
CityName string,
ZipCode int,
DistrictID int,
DistrictName string)
partitioned by ( Province string,City string )
row format delimited fields terminated by ','
;
加载数据:
hive> load data local inpath '/home/hadoop/china_data/tianjin.txt' into table china_partition partition(province='tianjin',city='tianjin');
如果分区目录不存在,该命令会创建目录,然后把数据拷贝到该目录下。
同时加入过个分区:
from china
insert overwrite table china_partition
partition(province='hebeisheng',city='ts')
select * whe