Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions native-engine/blaze-jni-bridge/src/conf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ define_conf!(BooleanConf, PARTIAL_AGG_SKIPPING_SKIP_SPILL);
define_conf!(BooleanConf, PARQUET_ENABLE_PAGE_FILTERING);
define_conf!(BooleanConf, PARQUET_ENABLE_BLOOM_FILTER);
define_conf!(StringConf, SPARK_IO_COMPRESSION_CODEC);
define_conf!(IntConf, SPARK_IO_COMPRESSION_ZSTD_LEVEL);
define_conf!(IntConf, TOKIO_WORKER_THREADS_PER_CPU);
define_conf!(IntConf, SPARK_TASK_CPUS);
define_conf!(StringConf, SPILL_COMPRESSION_CODEC);
Expand Down
12 changes: 9 additions & 3 deletions native-engine/datafusion-ext-plans/src/common/ipc_compression.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@
use std::io::{BufReader, Read, Take, Write};

use arrow::{array::ArrayRef, datatypes::SchemaRef};
use blaze_jni_bridge::{conf, conf::StringConf, is_jni_bridge_inited};
use blaze_jni_bridge::{
conf,
conf::{IntConf, StringConf},
is_jni_bridge_inited,
};
use byteorder::{LittleEndian, ReadBytesExt, WriteBytesExt};
use datafusion::common::Result;
use datafusion_ext_commons::{
Expand All @@ -28,7 +32,6 @@ use datafusion_ext_commons::{
use once_cell::sync::OnceCell;

pub const DEFAULT_SHUFFLE_COMPRESSION_TARGET_BUF_SIZE: usize = 4194304;
const ZSTD_LEVEL: i32 = 1;

pub struct IpcCompressionWriter<W: Write> {
output: W,
Expand Down Expand Up @@ -181,7 +184,10 @@ impl<W: Write> IoCompressionWriter<W> {
pub fn try_new(codec: &str, inner: W) -> Result<Self> {
match codec {
"lz4" => Ok(Self::LZ4(lz4_flex::frame::FrameEncoder::new(inner))),
"zstd" => Ok(Self::ZSTD(zstd::Encoder::new(inner, ZSTD_LEVEL)?)),
"zstd" => Ok(Self::ZSTD(zstd::Encoder::new(
inner,
conf::SPARK_IO_COMPRESSION_ZSTD_LEVEL.value().unwrap_or(1),
)?)),
_ => df_execution_err!("unsupported codec: {}", codec),
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ public enum BlazeConf {
// spark io compression codec
SPARK_IO_COMPRESSION_CODEC("spark.io.compression.codec", "lz4"),

// spark io compression zstd level
SPARK_IO_COMPRESSION_ZSTD_LEVEL("spark.io.compression.zstd.level", 1),

// tokio worker threads per cpu (spark.task.cpus), 0 for auto detection
TOKIO_WORKER_THREADS_PER_CPU("spark.blaze.tokio.worker.threads.per.cpu", 0),

Expand Down