HIVE学习笔记:HIVE内置的三种表格式与表的划分
来源:互联网 发布:新浪微盾网络异常 编辑:程序博客网 时间:2024/05/16 15:49
textfile
create table test_txt(name string,val string) stored as textfile;desc formatted test_txt;
sequencefile
create table test_seq(name string,val string) stored as sequencefile;desc formatted test_seq;
rcfile
create table test_rc(name string,val string) stored as rcfile;desc formatted test_rc;
自建类
create table XXX(name string,val string) stored as inputformat 'XXX' outputformat 'XXX';
(待补充)
表的分区
首先新建一个分区表并导入数据:
create table if not exists employees(name string,salary float,subordinates array<string>,deductions map<string,float>,address struct<street:string,city:string,state:string,zip:int>)partitioned by (dt string,type string)row format delimitedfields terminated by '\t'collection items terminated by ','map keys terminated by ':'lines terminated by '\n'stored as textfile;load data local inpath '/home/daya/test/test.txt' overwrite into table employees;
增加分区:
alter table employees add if not exists partition(dt='20170906',type='test');
在HDFS中可以看到表在数据库中产生了如下的目录结构:
HIVE表的分区实际上就是在表的大小达到一定程度时,为了便于管理与查询,而把表中的数据按不同的子文件夹进行归类。
再添加一个分区并输出表的分区信息:
alter table employees add if not exists partition(dt='20170905',type='test');show partitions employees;
表的分桶
分桶是对表更细粒度的划分,提供更快的查询。
(待补充)
阅读全文
0 0
- HIVE学习笔记:HIVE内置的三种表格式与表的划分
- HIVE的学习笔记
- Hive的学习笔记
- Hive学习笔记 --- Hive的数据类型
- Hive 学习笔记(1)---hive的配置
- Hive学习笔记 --- Hive的Beeline使用
- Hive学习笔记 --- Hive分区表的操作
- Hive学习笔记 2 Hive的数据类型
- hive学习笔记-hive的基本语法
- Hive学习笔记 --- Hortonworks 的hive 与 原生hive的差别
- Hive的内置数据类型
- Hive 的内置数据类型
- Hive的内置数据类型
- hive的内置函数
- hive学习笔记——Hive表的创建
- [Hive学习笔记]hive命令的3种调用方式
- Hive学习笔记 --- 执行Hive操作的几种方法
- Hive学习笔记(三) 创建数据库与表
- AVFrame 与 yuv420那些事
- vps环境搭建+vultr
- html截取显示部分的img图片
- MDK软件Go TO Definition 'xxxxx' 时出现No Browese information available in'X:\...\...\output\'
- WebDriver下载地址
- HIVE学习笔记:HIVE内置的三种表格式与表的划分
- 【linux】信号量
- mybatis错误:Invalid bound statement (not found)
- 51Nod-1371-填数字
- JDBC编程-优化程序(六)
- Hdu 5875 Function 线段树
- 建立J2EE开发环境
- 字符串trim()
- [ElasticStack系列]docker部署logstash