hive表多种存储格式的文件大小差异,无重复数据
-- 重点,目标表无重复数据
-- dbName.num_result 无重复记录
-- 插入数据
CREATE TABLE dbName.test_textfile(
`key` string,
`value` string,
`p_key` string,
`p_key2` string)
STORED AS textfile
;
insert overwrite table dbName.test_textfile select * from dbName.num_result where p_key='' and p_key2=''; drop table dbName.test_orcfile;
CREATE TABLE dbName.test_orcfile(
`key` string,
`value` string,
`p_key` string,
`p_key2` string)
STORED AS orc
;
insert overwrite table dbName.test_orcfile select * from test_textfile; CREATE TABLE dbName.test_rcfile(
`key` string,
`value` string,
`p_key` string,
`p_key2` string)
STORED AS rcfile
;
insert overwrite table dbName.test_rcfile select * from test_textfile; CREATE TABLE dbName.test_parquet(
`key` string,
`value` string,
`p_key` string,
`p_key2` string)
STORED AS parquet
;
insert overwrite table dbName.test_parquet select * from test_textfile; -- 统计数据量
select count(1) as cnt from dbName.test_textfile;
select count(1) as cnt from dbName.test_orcfile;
select count(1) as cnt from dbName.test_rcfile;
select count(1) as cnt from dbName.test_parquet; -- 统计文件大小
dfs -du -s -h hdfs://nameservice1/user/hive/warehouse/dbName.db/test_text*;
dfs -du -s -h hdfs://nameservice1/user/hive/warehouse/dbName.db/test_par*;
dfs -du -s -h hdfs://nameservice1/user/hive/warehouse/dbName.db/test_rc*;
dfs -du -s -h hdfs://nameservice1/user/hive/warehouse/dbName.db/test_orc*;
1.0 G 3.1 G hdfs://nameNode/user/hive/warehouse/dbName.db/test_textfile
1.1 G 3.3 G hdfs://nameNode/user/hive/warehouse/dbName.db/test_parquet
984.0 M 2.9 G hdfs://nameNode/user/hive/warehouse/dbName.db/test_rcfile
470.0 M 1.4 G hdfs://nameNode/user/hive/warehouse/dbName.db/test_orcfile
从结果可以看出,在无重复数据的情况下,parquet的压缩无用武之地,占用空间比textfile还大,ORC是压缩最强的文件模式。
hive (dbName)> dfs -du -s hdfs://nameNode/user/hive/warehouse/dbName.db/test_text*;
1110741501 3332224503 hdfs://nameNode/user/hive/warehouse/dbName.db/test_textfile
hive (dbName)> dfs -du -s hdfs://nameNode/user/hive/warehouse/dbName.db/test_par*;
1167366639 3502099917 hdfs://nameNode/user/hive/warehouse/dbName.db/test_parquet
hive (dbName)> dfs -du -s hdfs://nameNode/user/hive/warehouse/dbName.db/test_rc*;
1031774688 3095324064 hdfs://nameNode/user/hive/warehouse/dbName.db/test_rcfile
hive (dbName)> dfs -du -s hdfs://nameNode/user/hive/warehouse/dbName.db/test_orc*;
492795434 1478386302 hdfs://nameNode/user/hive/warehouse/dbName.db/test_orcfile
hive表多种存储格式的文件大小差异,无重复数据的更多相关文章
- hive表的存储格式; ORC格式的使用
hive表的源文件存储格式有几类: 1.TEXTFILE 默认格式,建表时不指定默认为这个格式,导入数据时会直接把数据文件拷贝到hdfs上不进行处理.源文件可以直接通过hadoop fs -cat 查 ...
- hive 表新增字段后更新分区无法显示数据
解决方案: 1.删除分区后重新跑数据 alter table drop partition(分区字段=“”): 2.新增字段运行程序后其实数据已经有了,只是查询hive的时候无法显示出来, 这个时候只 ...
- SQLServer 表连接时使用top 1 去除重复数据
left join SM_SOLine soline on soline.SO=so.ID and soline.DocLineNo=(select MAX(DocLineNo) from SM_SO ...
- hive 压缩全解读(hive表存储格式以及外部表直接加载压缩格式数据);HADOOP存储数据压缩方案对比(LZO,gz,ORC)
数据做压缩和解压缩会增加CPU的开销,但可以最大程度的减少文件所需的磁盘空间和网络I/O的开销,所以最好对那些I/O密集型的作业使用数据压缩,cpu密集型,使用压缩反而会降低性能. 而hive中间结果 ...
- 如何快速把hdfs数据动态导入到hive表
1. hdfs 文件 {"retCode":1,"retMsg":"Success","data":[{" ...
- 疯狂位图之——位图生成12GB无重复随机乱序大整数集
上一篇讲述了用位图实现无重复数据的排序,排序算法一下就写好了,想弄个大点数据测试一下,因为小数据在内存中快排已经很快. 一.生成的数据集要求 1.数据为0--2147483647(2^31-1)范围内 ...
- Hive表的几种存储格式
Hive的文件存储格式: textFile textFile为默认格式 存储方式:行存储 缺点:磁盘开销大:数据解析开销大:压缩的text文件,hive无法进行合并和拆分 sequencefile 二 ...
- 大数据:Hive - ORC 文件存储格式
一.ORC File文件结构 ORC的全称是(Optimized Row Columnar),ORC文件格式是一种Hadoop生态圈中的列式存储格式,它的产生早在2013年初,最初产生自Apache ...
- Hive - ORC 文件存储格式【转】
一.ORC File文件结构 ORC的全称是(Optimized Row Columnar),ORC文件格式是一种Hadoop生态圈中的列式存储格式,它的产生早在2013年初,最初产生自Apache ...
随机推荐
- 第3章 springboot接口返回json 3-1 SpringBoot构造并返回一个json对象
数据的使用主要还是以JSON为主,我们不会去使用XML. 这个时候我们先不使用@RestController,我们使用之前SpringMVC的那种方式,就是@Controller. @Respons ...
- 【总结整理】openlayer加载搜狗地图,qq地图,mapabc
qq http://www.cnblogs.com/gisvip/archive/2012/11/01/2750493.html mapabc http://www.cnblogs.com ...
- 九款常用的JS代码高亮工具
代码高亮很重要,特别是当我们想要在网站或博客中展示我们的代码的时候.通过在网站或博客中启用代码高亮,读者更方便的读取代码块. 有很多免费而且有用的代码高亮脚本.这些脚本大部分由Javascripts编 ...
- 项目一:在线下单(补充) activeMQ使用(重点) 重构客户注册功能,发短信功能分离
1 课程计划 1.在线下单(补充) 2.activeMQ使用(重点) n 简介和安装 n activeMQ入门案例 n spring整合activeMQ应用 3.重构客户注册功能,发短信功能分离 n ...
- ZROI2018提高day6t2
传送门 分析 将所有字母分别转化为1~26,之后将字符串的空位补全为0,?设为-1,我们设dp[p][c][le][ri]表示考虑le到ri个字符串且从第p位开始考虑,这一位最小填c的方案数,具体转移 ...
- 51NOD1052 最大M字段和
传送门 分析 一眼看去我们自然会想到dp[i][j][k]表示区间[i,j]中选k个子段的最大值.然后我们考虑降去一维.我们设dp[i][j]表示考虑了前i个数,在选了a[i]的情况下共有j个子段的最 ...
- 85D Sum of Medians
传送门 题目 In one well-known algorithm of finding the k-th order statistics we should divide all element ...
- Luogu 1514 [NOIP2010] 引水入城
我就是过来开心一下……这道题从开坑以来已经堆积了大半年了……今天才发现广搜一直写挂…… 丢个线段覆盖的模板,设$f_{i}$表示覆盖区间[1, i]的最小代价,$g_{i, j}$表示覆盖区间[i, ...
- oracle获取列的备注和数据类型
select column_name, data_type, data_precision, data_scale, nvl((select t_s.comments from all_col_com ...
- C#中如何防止Excel做科学计算法转换
C#中如何防止Excel做科学计算法转换 string style = @"<style>.text{mso-number-format:\@;}</style>& ...