使用: Amazon Aws Hive (0.13)
尝试:输出具有snappy压缩的orc文件。
create external table output{
col1 string}
partitioned by (col2 string)
stored as orc
location 's3://mybucket'
tblproperties("orc.compress"="SNAPPY");
set hive.exec.dynamic.partition=true;
set hive.exec.dynamic.partition.mode=nonstrict;
set hive.exec.compress.output = true;
set mapred.output.compression.type = BLOCK;
set mapred.output.compression.codec = org.apache.hadoop.io.compress.SnappyCodec;
insert into table output
partition(col2)
select col1,col2 from input;问题是,当我查看mybucket目录中的输出时,它不是带有SNAPPY扩展的。但是,它是一个二进制文件。我遗漏了什么设置来将这些orc文件转换为压缩并输出一个快速扩展名?
发布于 2015-02-05 22:01:06
OrcFiles是一种特殊格式的二进制文件。指定orc.compress = SNAPPY时,使用Snappy压缩文件的内容。Orc是一种半柱状文件格式。
有关如何布局数据的更多信息,请查看这份文件。
流使用编解码器进行压缩,该编解码器被指定为该表中所有流的表属性,以优化内存的使用,压缩是在每个块生成时逐步完成的。压缩块可以跳过,而无需首先解压扫描。流中的位置由块开始位置和进入块的偏移量表示。
简而言之,您的文件是使用Snappy编解码器进行压缩的,您只是不知道它们是什么,因为文件中的块实际上是压缩的。
发布于 2015-05-07 22:34:17
此外,您还可以使用hive --orcfiledump /apps/hive/warehouse/orc/000000_0查看文件的详细信息。输出将类似于:
Reading ORC rows from /apps/hive/warehouse/orc/000000_0 with {include: null, offset: 0, length: 9223372036854775807}
Rows: 6
Compression: ZLIB
Compression size: 262144
Type: struct<_col0:string,_col1:int>
Stripe Statistics:
Stripe 1:
Column 0: count: 6
Column 1: count: 6 min: Beth max: Owen sum: 29
Column 2: count: 6 min: 1 max: 6 sum: 21
File Statistics:
Column 0: count: 6
Column 1: count: 6 min: Beth max: Owen sum: 29
Column 2: count: 6 min: 1 max: 6 sum: 21
....https://stackoverflow.com/questions/27373535
复制相似问题