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值,然后与桶的数量取模。把数据放到对应的文件中。
本站文章为和通数据库网友分享或者投稿,欢迎任何形式的转载,但请务必注明出处.
同时文章内容如有侵犯了您的权益,请联系QQ:970679559,我们会在尽快处理。