MapReduce服务 MRS-Hive支持ZSTD压缩格式

时间:2023-11-01 16:25:29

Hive支持ZSTD压缩格式

ZSTD(全称为Zstandard)是一种开源的无损数据压缩算法,其压缩性能和压缩比均优于当前Hadoop支持的其他压缩格式,本特性使得Hive支持ZSTD压缩格式的表。Hive支持基于ZSTD压缩的存储格式有常见的ORC,RCFile,TextFile,JsonFile,Parquet,Squence,CSV。

本特性仅适用于MRS 3.1.2及之后版本。

ZSTD压缩格式的建表方式如下:

  • ORC存储格式建表时可指定TBLPROPERTIES("orc.compress"="zstd"):

    create table tab_1(...) stored as orc TBLPROPERTIES("orc.compress"="zstd");

  • Parquet存储格式建表可指定TBLPROPERTIES("parquet.compression"="zstd"):

    create table tab_2(...) stored as parquet TBLPROPERTIES("parquet.compression"="zstd");

  • 其他格式或通用格式建表可执行设置参数指定compress,codec为“org.apache.hadoop.io.compress.ZStandardCode”:

    set hive.exec.compress.output=true;

    set mapreduce.map.output.compress=true;

    set mapreduce.map.output.compress.codec=org.apache.hadoop.io.compress.ZStandardCodec;

    set mapreduce.output.fileoutputformat.compress=true;

    set mapreduce.output.fileoutputformat.compress.codec=org.apache.hadoop.io.compress.ZStandardCodec;

    set hive.exec.compress.intermediate=true;

    create table tab_3(...) stored as textfile;

ZSTD压缩格式的表和其他普通压缩表的SQL操作没有区别,可支持正常的增删查及聚合类SQL操作。

support.huaweicloud.com/cmpntguide-mrs/mrs_01_24121.html