已为特定配置单元表启用压缩

5uzkadbs  于 2021-06-03  发布在  Hadoop
关注(0)|答案(2)|浏览(347)

我需要对一系列表进行基准测试,有些是压缩的,有些不是。我通过设置压缩:

hive> SET hive.exec.compress.output=true;
hive> SET mapred.output.compression.codec=org.apache.hadoop.io.compress.SnappyCodec;

…并使用插入覆盖填充表。有没有办法通过命令行(类似于descripe extended)确认为特定表启用了输出压缩?

mklgxw1f

mklgxw1f1#

当你执行 describe formatted orc_with_compress_setting_table 看到这样的情景: Compressed: No 感觉不舒服。
答案如下:
压缩字段不是表是否包含压缩数据的可靠指示器。它通常总是显示no,因为压缩设置仅在加载数据的会话期间应用,并且不会与表元数据一起永久存储。
发件人:https://www.cloudera.com/documentation/enterprise/5-5-x/topics/impala_describe.html

toe95027

toe950272#

下面将显示hdfs中表文件的路径

desc formatted <tablename>

配置单元>描述测试;确定列名称数据类型注解

列名称数据类型注解

批处理\u sk int none geo \u cd string none环境\u cd string none

详细表格信息

数据库:默认所有者:steve createtime:thu nov 21 23:36:37 pst 2013 lastaccesstime:未知保护模式:无保留:0位置:hdfs://localhost:9000/user/hive/warehouse/cobtest表类型:托管表参数:numfiles 1 numpartitions 0 numrows 0 rawdatasize 0 totalsize 473 transient\u lastdltime 1385105797

存储信息

serde library:org.apache.hadoop.hive.serde2.lazy.lazysimpleserde inputformat:org.apache.hadoop.mapred.textinputformat outputformat:org.apache.hadoop.hive.ql.io.hiveignorekeytextoutputformat compressed:no num bucket:-1 bucket columns:[]sort columns:[]storage desc params:field.delim\t serialization.format\t所用时间:0.203秒,获取:34行
然后您可以执行dfs-lsr,如果文件扩展名被压缩,您会注意到。

hive> dfs -lsr hdfs://localhost:9000/user/hive/warehouse/cobtest ;
-rw-r--r--   1 steve supergroup        473 2013-11-21 23:36 /user/hive/warehouse/cobtest/UDFPafCobIndTest.input**.tsv**

updatesnappy是用于压缩的编解码器。您仍然需要添加以下内容:

SET hive.exec.compress.output=true;
SET mapred.output.compression.codec=org.apache.hadoop.io.compress.SnappyCodec;
SET mapred.output.compression.type=BLOCK;

相关问题