hive分区表
Partition 对应于数据库的 Partition 列的密集索引
在 Hive 中,表中的一个 Partition 对应于表下的一个目录,所有的 Partition 的数据都存储在对应的目录中
- 例如:
- test表中包含 date 和 city 两个 Partition
则对应于date=20130201, city = bj 的 HDFS 子目录为:
/warehouse/test/date=20130201/city=bj
对应于date=20130202, city=sh 的HDFS 子目录为;
/warehouse/test/date=20130202/city=sh
创建表
create table partition_table(id int,name string) partitioned by(age int,high int); alter table partition_table add partition (age=20,high=180); insert into hive_test.partition_table PARTITION (age,high) values (1,'xubin',20,180); insert overwrite table partition_table partition (age=20,high=180) select id,name from external_table where age =20 and high = 180; insert overwrite table partition_table partition (age=21,high=180) select id,name from external_table where age =21 and high = 180;

低调大师中文资讯倾力打造互联网数据资讯、行业资源、电子商务、移动互联网、网络营销平台。
持续更新报道IT业界、互联网、市场资讯、驱动更新,是最及时权威的产业资讯及硬件资讯报道平台。
转载内容版权归作者及来源网站所有,本站原创内容转载请注明来源。
- 上一篇
环境搭建-CentOS服务器之间设置免密码登录
在做大数据项目分布式开发时会用到Hadoop组件,Hadoop集群由Namenode节点和Datanode节点组成,在运行启动集群操作时,需要从Namenode节点登录到Datanode节点,执行相关启动脚本,因此需要配置免密码登录。 1.使用root账户修改shhd_config配置文件 执行命令【vi /etc/ssh/sshd_config】 修改shhd_config配置文件.png 去掉RSAAuthention yes前面的# 去掉PubkeyAuthentication yes前面的# shhd_config.png 然后运行命令【service sshd restart】生效配置 2.使用rsa非对称加密生成密钥 进入用户目录,运行命令【ssh-keygen -t rsa】生成密钥 生成密钥.png 进入【.ssh】目录,会发现生成了如下几个文件: ssh目录.png authorized_keys:存放远程免密登录的公钥,主要通过这个文件记录多台机器的公钥 id_rsa:私钥文件 id_rsa.pub:公钥文件 3.将公钥添加到需要远程登录机器的authorize...
- 下一篇
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值,然后与桶的数量取模。把数据放到对应的文件中。
相关文章
文章评论
共有0条评论来说两句吧...
文章二维码
点击排行
推荐阅读
最新文章
- CentOS7设置SWAP分区,小内存服务器的救世主
- CentOS7编译安装Cmake3.16.3,解决mysql等软件编译问题
- CentOS7,8上快速安装Gitea,搭建Git服务器
- CentOS7编译安装Gcc9.2.0,解决mysql等软件编译问题
- Springboot2将连接池hikari替换为druid,体验最强大的数据库连接池
- CentOS8安装MyCat,轻松搞定数据库的读写分离、垂直分库、水平分库
- Windows10,CentOS7,CentOS8安装Nodejs环境
- CentOS7,CentOS8安装Elasticsearch6.8.6
- CentOS8安装Docker,最新的服务器搭配容器使用
- 设置Eclipse缩进为4个空格,增强代码规范