HIVE的分区表,
1. External表, 照样可以建分区
2. 分区表的路径不需要符合 /path/date=20120101的PATTERN
---------------------------------------------- DEMO ----------------------------------------------
准备测试数据(HIVE版本为0.7)
HDFS路径/test/ylb/hive_partition_new/下2个目录part1,part2
文件的数据
建表
|
create external table hive_partition_new (id int,name string) partitioned by (p string) row format delimited fields terminated by '\t' stored as textfile; |
导入分区数据
|
alter table hive_partition_new add partition (p='part1') location '/test/ylb/hive_partition_new/part1' ; alter table hive_partition_new add partition (p='part2) location '/test/ylb/hive_partition_new/part2 ; |
验证
|
select * from hive_partition_new where p='part2'; |
本站文章为和通数据库网友分享或者投稿,欢迎任何形式的转载,但请务必注明出处.
同时文章内容如有侵犯了您的权益,请联系QQ:970679559,我们会在尽快处理。