hadoop-hive1

测试几种存储格式:

1. mkdir /usr/local/soft/hive-3.1.2/data/

2. 上传数据至data目录中

3.创建TEXTFILE学生信息表
create table students(

  id bigint comment '学生id',

  name string comment '学生姓名',

  age int comment '学生年龄',

  gender string comment '学生性别',

  clazz string comment '学生班级'

) comment '学生信息表' 

ROW FORMAT DELIMITED FIELDS TERMINATED BY ','
STORED AS TEXTFILE;

4.上传数据至HDFS
dfs -put /usr/local/soft/hive-3.1.2/data/ /user/hive/warehouse/filetest.db/students

5.通过查看HDFS路径可以看到数据大小没有发生变化 大小为37M

6.创建RCFile格式的学生信息表
create table students_rcFile(
  id bigint comment '学生id',
  name string comment '学生姓名',
  age int comment '学生年龄',
  gender string comment '学生性别',
  clazz string comment '学生班级'
) comment '学生信息表' 
ROW FORMAT DELIMITED FIELDS TERMINATED BY ','
STORED AS RCFile;

7.插入数据:
insert into table students_rcFile select * from students;

8.通过查看HDFS路径可以看到数据经过压缩大小为26.44 M

9.创建ORCFile格式的学生信息表
create table students_orc(
  id bigint comment '学生id',
  name string comment '学生姓名',
  age int comment '学生年龄',
  gender string comment '学生性别',
  clazz string comment '学生班级'
) comment '学生信息表' 
ROW FORMAT DELIMITED FIELDS TERMINATED BY ','
STORED AS ORC;

10.插入数据:
insert into table students_orc select * from students;

11.通过查看HDFS路径可以看到数据经过压缩大小为 220.38 KB,同时插入数据时与RCFile格式时间相差不大


12.创建Parquet格式的学生信息表
create table students_parquet(
  id bigint comment '学生id',
  name string comment '学生姓名',
  age int comment '学生年龄',
  gender string comment '学生性别',
  clazz string comment '学生班级'
) comment '学生信息表' 
ROW FORMAT DELIMITED FIE

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值