Hive ORC压缩

时间:2014-05-08 14:57:51

标签: hadoop compression hive cloudera snappy

我在hive v0.12.0中运行以下代码,我希望使用不同的方法压缩三个表,因此文件的大小和内容应该不同

--- Create table and compress it with ZLIB
create table zzz_test_szlib
  stored as orc
  tblproperties ("orc.compress"="ZLIB")
  as
select * from uk_pers_dev.orc_dib_trans limit 100000000;

--- Create table and compress it with SNAPPY
create table zzz_test_ssnap
  stored as orc
  tblproperties ("orc.compress"="SNAPPY")
  as
select * from uk_pers_dev.orc_dib_trans limit 100000000;

--- Create table and DO NOT compress it
create table zzz_test_snone
  stored as orc
  tblproperties ("orc.compress"="NONE")
  as
select * from uk_pers_dev.orc_dib_trans limit 100000000;

当我使用describe或Hue检查表元数据时,我得到:

Name             Value                                            Value                                            Value
---------------- ------------------------------------------------ ------------------------------------------------ ------------------------------------------------
tableName        test_orc_zlib                                    test_orc_snappy                                  test_orc_none
location:hdfs    /user/hive/warehouse/test_orc_zlib               /user/hive/warehouse/test_orc_snappy             /user/hive/warehouse/test_orc_none
inputFormat      org.apache.hadoop.hive.ql.io.orc.OrcInputFormat  org.apache.hadoop.hive.ql.io.orc.OrcInputFormat  org.apache.hadoop.hive.ql.io.orc.OrcInputFormat
outputFormat     org.apache.hadoop.hive.ql.io.orc.OrcOutputFormat org.apache.hadoop.hive.ql.io.orc.OrcOutputFormat org.apache.hadoop.hive.ql.io.orc.OrcOutputFormat
compressed       FALSE                                            FALSE                                            FALSE
serializationLib org.apache.hadoop.hive.ql.io.orc.OrcSerde        org.apache.hadoop.hive.ql.io.orc.OrcSerde        org.apache.hadoop.hive.ql.io.orc.OrcSerde
orc.compress     ZLIB                                             SNAPPY                                           NONE
numFiles         1                                                1                                                1
totalSize        289970088                                        289970088                                        289970088
tableType        MANAGED_TABLE                                    MANAGED_TABLE                                    MANAGED_TABLE

在元数据中显示 compressed = FALSE ,但我不知道如何更改它以及这将如何影响。

但如果我比较表的数据,他们所有二进制相同

[~]$ hadoop fs -ls /user/hive/warehouse/test_orc_*
-rw-r--r--   3 andrey supergroup  289970088 2014-05-07 13:19 /user/hive/warehouse/test_orc_none/000000_0
-rw-r--r--   3 andrey supergroup  289970088 2014-05-07 12:34 /user/hive/warehouse/test_orc_snappy/000000_0
-rw-r--r--   3 andrey supergroup  289970088 2014-05-07 11:48 /user/hive/warehouse/test_orc_zlib/000000_0

我尝试更改/删除这些选项,但没有区别:

SET hive.exec.compress.intermediate=true;
SET hive.exec.compress.output=true;
SET mapred.output.compression.type=BLOCK;

另外我尝试使用不同的源表(存储为TEXTFILE),没有区别。

有任何想法或建议吗?

1 个答案:

答案 0 :(得分:2)

我认为这是由于0.12中的一个已知错误 看看这个Jira HIVE-6083