这里分类和汇总了欣宸的全部原创(含配套源码):https://github.com/zq2599/blog_demos
本文是《hive学习笔记》的第五篇,前文学习了分区表,很容易发现分区表的问题:
set hive.enforce.bucketing = true;
接下来先准备外部表t13,往里面添加一些数据,将t13作为后面分桶表的数据源:
create external table t13 (name string, age int, province string, city string)
row format delimited
fields terminated by ','
location '/data/external_t13';
tom,11,guangdong,guangzhou
jerry,12,guangdong,shenzhen
tony,13,shanxi,xian
john,14,shanxi,hanzhong
create table t14 (name string, age int, province string, city string)
clustered by (province, city) into 16 buckets
row format delimited
fields terminated by ',';
from t13
insert overwrite table t14
select name, age, province, city;
执行以下语句,取样查看t14的数据:
hive> select * from t14 tablesample(bucket 1 out of 2 on province, city);
OK
tom 11 guangdong guangzhou
john 14 shanxi hanzhong
Time taken: 0.114 seconds, Fetched: 2 row(s)
如果您不想自己搭建kubernetes环境,推荐使用腾讯云容器服务TKE:无需自建,即可在腾讯云上使用稳定, 安全,高效,灵活扩展的 Kubernetes 容器平台;
如果您希望自己的镜像可以通过外网上传和下载,推荐腾讯云容器镜像服务TCR:像数据加密存储,大镜像多节点快速分发,跨地域镜像同步
微信搜索「程序员欣宸」,我是欣宸,期待与您一同畅游Java世界...
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。