我的数据
01 jj01
02 jj02
03 jj03
04 jj04
05 jj05
06 jj06
07 jj07
08 jj08
09 jj09
10 jj10
11 jj11
12 jj12
13 jj13
14 jj14
15 jj15
16 jj16
17 jj17
18 jj18
创建一张临时表并添加数据
create table if not exists stu_temp(
uid int,
uname string,
)
row format delimited fields terminated by ' '
;
load data local inpath '/root/hivetest/stu.txt' into table stu_temp;
创建分桶表
create table if not exists dy_buc(
uid int,uname string
)
clustered by (uid) into 4 buckets
row format delimited fields terminated by ' '
;
设置reduce个数为4个(与分桶数相同)
set mapreduce.job.reduces=4;
插入数据
insert into dy_buc
select uid,uname from stu_temp
cluster by (uid)
;
分桶表中的数据
hive (db1)> select * from dy_buc;
OK
4 jj04
8 jj08
12<

本文详细介绍了在Hive中如何对分桶表进行抽样调查,探讨了抽样参数x和y的影响,展示了不同抽样设置下的结果,并总结了查询特定桶数据的策略和利用y值进行数据重新分桶的方法。

2万+

被折叠的 条评论
为什么被折叠?



