如何检查配置单元表中是否启用了 ZLIB 压缩?

How to check if ZLIB compression is enabled in hive tables?

我在描述中看到压缩属性设置为 no。

我是如何创建的table:

创建 table 临时 (.....) 存储为兽人 tblproperties("orc.compress"="ZLIB")

您可以使用 orcfiledump 实用程序:

hive --orcfiledump hdfs://table_location 

它将打印 orc 文件元数据、统计信息、压缩信息。

压缩信息如下所示:

Rows: 95
Compression: SNAPPY
Compression size: 262144

在此处查看手册:ORC File Dump Utility

hive 命令 describe formatted table_name 打印 Table 个参数并且有 orc.compress 个参数。

你的问题的答案是 describe formatted 陈述。

当您使用以下语法触发此命令时

describe formatted <your table name>

您将在屏幕上看到一些输出,其中一部分如下所示。

# Detailed Table Information             
Database:               default                  
Owner:                  edureka_268377           
CreateTime:             Thu Feb 22 04:56:05 UTC 2018     
LastAccessTime:         UNKNOWN                  
Protect Mode:           None                     
Retention:              0                        
Location:               hdfs://nameservice1/user/hive/warehouse/tests3   
Table Type:             MANAGED_TABLE            
Table Parameters:                
        orc.compress            ZLIB                
        transient_lastDdlTime   1519275365          

# Storage Information            
SerDe Library:          org.apache.hadoop.hive.ql.io.orc.OrcSerde        
InputFormat:            org.apache.hadoop.hive.ql.io.orc.OrcInputFormat  
OutputFormat:           org.apache.hadoop.hive.ql.io.orc.OrcOutputFormat         
Compressed:             No                       
Num Buckets:            -1                       
Bucket Columns:         []                       
Sort Columns:           []                       
Storage Desc Params:             
        serialization.format    1     

注意 Table 参数 部分。它有一个名为 orc.compress 的 属性。它说 ZLIB。所以 ZLIB 是你的压缩编解码器。如果它是 SNAPPY 或其他东西,它会在那里提到。 如果为空,则压缩编码为ZLIB,默认!

希望对您有所帮助!