背景:
经过测试发现:
SR insert into files 写出的 orc 文件
SR 的 insert hive_catalog.xx.xx 到 hive 表(orc 格式)产生的文件
比 hive 原生 sql 运行后的文件 要大 2.5 倍左右
场景:
使用SR 的 insert into files 写文件到 hdfs ,
使用SR 的 insert hive_catalog.xx.xx 到 hive 表
希望能够支持指定压缩算法的压缩率, 和压缩算法对应的一些常用参数
例如:
1. 写到 hdfs 文件
INSERT INTO FILES(
"format" = "parquet",
"single" = "false",
"compression" = "orc",
"target_max_file_size" = "1073741824",
"path" = "hdfs://xxx/xxx",
-- 增加些参数
"orc.compression.code" = "zlib",
"orc.compression.ratio" = "xxx"
)
select * from xxx
. 写到 hive catalog
set session connector_sink_compression_codec='zlib'
set session connector_sink_compression_ratio='xxxx'
INSERT INTO hive_catalog.olap_db.olap_tbl SELECT * FROM xxx
# 或者
INSERT INTO hive_catalog.olap_db.olap_tbl
SELECT
/*+ SET_VAR
(
connector_sink_compression_codec = 'zlib',
connector_sink_compression_ratio='xxxx'
)
*/
a,
b,
c
FROM xxx