Skip to content
Closed
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
31 changes: 3 additions & 28 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ arrow = { version = "57.1.0", optional = true }
hyper-util = { version = "0.1.16", optional = true }
pretty_assertions = { version = "1.4", optional = true }
reqwest = { version = "0.12", optional = true }
zip = { version = "6.0", optional = true }
zip = { version = "4.0", optional = true }
tonic-prost = "0.14.2"

[features]
Expand Down Expand Up @@ -83,5 +83,5 @@ tokio-stream = "0.1.17"
hyper-util = "0.1.16"
pretty_assertions = "1.4"
reqwest = "0.12"
zip = "6.0"
zip = "4.0"
test-case = "3.3.1"
46 changes: 46 additions & 0 deletions src/distributed_ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,24 @@ pub trait DistributedExt: Sized {
&mut self,
compression: Option<CompressionType>,
) -> Result<(), DataFusionError>;

/// How many rows to collect in each record batch before sending it over the wire in a
/// shuffle operation. This value defaults to the same as `datafusion.execution.batch_size`.
///
/// Setting it to something smaller than `datafusion.execution.batch_size` has no effect.
///
/// It's preferable to set `datafusion.execution.batch_size` directly instead of this
/// parameter if the specific use case allows it.
fn with_distributed_shuffle_batch_size(
self,
batch_size: usize,
) -> Result<Self, DataFusionError>;

/// Same as [DistributedExt::with_distributed_shuffle_batch_size] but with an in-place mutation.
fn set_distributed_shuffle_batch_size(
&mut self,
batch_size: usize,
) -> Result<(), DataFusionError>;
}

impl DistributedExt for SessionConfig {
Expand Down Expand Up @@ -565,6 +583,15 @@ impl DistributedExt for SessionConfig {
Ok(())
}

fn set_distributed_shuffle_batch_size(
&mut self,
batch_size: usize,
) -> Result<(), DataFusionError> {
let d_cfg = DistributedConfig::from_config_options_mut(self.options_mut())?;
d_cfg.shuffle_batch_size = batch_size;
Ok(())
}

delegate! {
to self {
#[call(set_distributed_option_extension)]
Expand Down Expand Up @@ -618,6 +645,10 @@ impl DistributedExt for SessionConfig {
#[call(set_distributed_compression)]
#[expr($?;Ok(self))]
fn with_distributed_compression(mut self, compression: Option<CompressionType>) -> Result<Self, DataFusionError>;

#[call(set_distributed_shuffle_batch_size)]
#[expr($?;Ok(self))]
fn with_distributed_shuffle_batch_size(mut self, batch_size: usize) -> Result<Self, DataFusionError>;
}
}
}
Expand Down Expand Up @@ -689,6 +720,11 @@ impl DistributedExt for SessionStateBuilder {
#[call(set_distributed_compression)]
#[expr($?;Ok(self))]
fn with_distributed_compression(mut self, compression: Option<CompressionType>) -> Result<Self, DataFusionError>;

fn set_distributed_shuffle_batch_size(&mut self, batch_size: usize) -> Result<(), DataFusionError>;
#[call(set_distributed_shuffle_batch_size)]
#[expr($?;Ok(self))]
fn with_distributed_shuffle_batch_size(mut self, batch_size: usize) -> Result<Self, DataFusionError>;
}
}
}
Expand Down Expand Up @@ -760,6 +796,11 @@ impl DistributedExt for SessionState {
#[call(set_distributed_compression)]
#[expr($?;Ok(self))]
fn with_distributed_compression(mut self, compression: Option<CompressionType>) -> Result<Self, DataFusionError>;

fn set_distributed_shuffle_batch_size(&mut self, batch_size: usize) -> Result<(), DataFusionError>;
#[call(set_distributed_shuffle_batch_size)]
#[expr($?;Ok(self))]
fn with_distributed_shuffle_batch_size(mut self, batch_size: usize) -> Result<Self, DataFusionError>;
}
}
}
Expand Down Expand Up @@ -831,6 +872,11 @@ impl DistributedExt for SessionContext {
#[call(set_distributed_compression)]
#[expr($?;Ok(self))]
fn with_distributed_compression(self, compression: Option<CompressionType>) -> Result<Self, DataFusionError>;

fn set_distributed_shuffle_batch_size(&mut self, batch_size: usize) -> Result<(), DataFusionError>;
#[call(set_distributed_shuffle_batch_size)]
#[expr($?;Ok(self))]
fn with_distributed_shuffle_batch_size(self, batch_size: usize) -> Result<Self, DataFusionError>;
}
}
}
Loading