怎么建立一個(gè)網(wǎng)站?互聯(lián)網(wǎng)營銷怎么做
ZSTD(全稱為Zstandard)是一種開源的無損數(shù)據(jù)壓縮算法,其壓縮性能和壓縮比均優(yōu)于當(dāng)前Hadoop支持的其他壓縮格式,本特性使得Hive支持ZSTD壓縮格式的表。Hive支持基于ZSTD壓縮的存儲(chǔ)格式有常見的ORC,RCFile,TextFile,JsonFile,Parquet,Squence,CSV。
ZSTD壓縮格式的建表方式如下:
ORC存儲(chǔ)格式建表時(shí)可指定TBLPROPERTIES(“orc.compress”=“zstd”):
create table tab_1(...) stored as orc TBLPROPERTIES("orc.compress"="zstd");
Parquet存儲(chǔ)格式建表可指定TBLPROPERTIES(“parquet.compression”=“zstd”):
create table tab_2(...) stored as parquet TBLPROPERTIES("parquet.compression"="zstd");
其他格式或通用格式建表可執(zhí)行設(shè)置參數(shù)指定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操作沒有區(qū)別,可支持正常的增刪查及聚合類SQL操作。
寫出的文件使用zstd壓縮,spark3才開始支持
–conf spark.sql.parquet.compression.codec=zstd