我的数据如下:
Wban Number, YearMonthDay, Time, Hourly Precip
03011,20060301,0050,0现在这个文件有超过1个million+行。因此,我创建了一个包含分区(在wbannumber上)和存储桶(在年月日)的表:
create table hpd_bkt
(
YearMonthDay INT,
Time INT,
HourlyPrecip float
)
partitioned by (wbannum int)
clustered by (yearmonthday) sorted by (yearmonthday) into 31 buckets
row format delimited
fields terminated by ','
lines terminated by '\n'
stored as textfile;然后:
insert overwrite table hpd_bkt partition(wbannum)
Select yearmonthday,time,hourlyprecip,wbannum from hpd;现在,我使用以下查询来获取不同的wbannumber(对于partition+bucket表):
select count(distinct wbannum) from hpd_bkt;总共花了103秒来处理这个( 13秒CPU时间)
但从普通数据表中查询时,总共需要21秒(8秒CPU时间)
谁能解释一下,我在这里可能做错了什么?
发布于 2015-09-19 07:13:10
一种可能性是,使用bucketing进行分区可能会产生许多较小的文件。理想情况下,您的文件大小应至少为块大小,才能获得良好的性能。
观察这两种情况下调度的映射器的数量。在分区和分组的情况下,您可能会注意到更多的映射器,每个映射器对应于较小的数据集。
https://stackoverflow.com/questions/32656517
复制相似问题