查找hive/impala表的压缩细节

jchrr9hc  于 2021-06-26  发布在  Hive
关注(0)|答案(3)|浏览(474)

我将表格从一种格式转换为另一种格式,从未压缩转换为压缩(snappy、gzip等)。
我以为我可以依靠 describe [formatted|extended] tblname 直到我读到这个。描述语句
它说
压缩字段不是表是否包含压缩数据的可靠指示器。它通常总是显示no,因为压缩设置仅在加载数据的会话期间应用,并且不会与表元数据一起永久存储。
如何确定表是否已压缩以及使用了什么编解码器?我不介意用spark来获取信息。

ds97pgxw

ds97pgxw1#

如您所述,“descripe formatted”和“show create table”方法并不总是保证包含正确的压缩格式信息。
识别压缩编解码器和存储格式的最可靠方法是转到表文件的hdfs位置,并查看其扩展名:

hdfs dfs -ls -r /hdfspath/

例如,用snappy压缩的orc文件应该以 .snappy.orc .

e1xvtsh3

e1xvtsh32#

首先要检查此配置单元/mr属性:

hive.exec.compress.output=
mapreduce.output.fileoutputformat.compress=
mapreduce.output.fileoutputformat.compress.codec=   
mapreduce.output.fileoutputformat.compress.type=
slmsl1lt

slmsl1lt3#

回答我的问题:
对于avro数据文件: avro-tools getmeta filename 对于Parquet数据文件: parquet-tools meta filename

相关问题