【发布时间】:2015-03-05 14:40:44
【问题描述】:
我想创建一个有 2 个分区的 hive 分区表。 一个分数小于 300,另一个分数大于 300。
create table parttab(id int,name string) partitioned by (score int) row format delimited fields terminated by '\t' stored as textfile;
load data local inpath '/data/hive/input' into table newtab partition (score<300);
load data local inpath '/data/hive/newinput' into table newtab partition (score>300);
但是,由于“>”和“
我之所以给出这种方式是因为在查询时 select * from parttab where score
如果我给那个分区命名,例如:
load data local inpath '/data/hive/input' into table newtab partition (score='lessthan300');
然后,在查询时,我必须记住分区的名称!! :(
select * from parttab where score='lessthan300';
这听起来不太好!那么,有没有更好的方式以优雅的方式对其进行分区呢?
【问题讨论】:
标签: hadoop hive hdfs bigdata hiveql