欢迎投稿

今日深度:

hive分桶表,hive桶表

hive分桶表,hive桶表


桶表是对数据进行哈希取值,然后放到不同文件中存储

创建一个桶表

create table bucket_table(id int,name string) clustered by(id) into 4 buckets;

加载数据

set hive.enforce.bucketing = true; 
insert into table bucket_table select name from stu; 
insert overwrite table bucket_table select name from stu;

PS:数据加载到桶表时,会对字段取hash值,然后与桶的数量取模。把数据放到对应的文件中。

www.htsjk.Com true http://www.htsjk.com/hive/10998.html NewsArticle hive分桶表,hive桶表 桶表是对数据进行哈希取值,然后放到不同文件中存储 创建一个桶表 create table bucket_table(id int ,name string) clustered by (id) into 4 buckets; 加载数据 set hive.enforce.bucketing...
评论暂时关闭