Skip to content

Commit beb3a0d

Browse files
committed
Set batch size from env by default
1 parent cfb7800 commit beb3a0d

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

benchmarks/src/imdb/run.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ mod tests {
514514
let common = CommonOpt {
515515
iterations: 1,
516516
partitions: Some(2),
517-
batch_size: 8192,
517+
batch_size: Some(8192),
518518
mem_pool_type: "fair".to_string(),
519519
memory_limit: None,
520520
sort_spill_reservation_bytes: None,
@@ -550,7 +550,7 @@ mod tests {
550550
let common = CommonOpt {
551551
iterations: 1,
552552
partitions: Some(2),
553-
batch_size: 8192,
553+
batch_size: Some(8192),
554554
mem_pool_type: "fair".to_string(),
555555
memory_limit: None,
556556
sort_spill_reservation_bytes: None,

benchmarks/src/util/options.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ pub struct CommonOpt {
4141
pub partitions: Option<usize>,
4242

4343
/// Batch size when reading CSV or Parquet files
44-
#[structopt(short = "s", long = "batch-size", default_value = "8192")]
45-
pub batch_size: usize,
44+
#[structopt(short = "s", long = "batch-size")]
45+
pub batch_size: Option<usize>,
4646

4747
/// The memory pool type to use, should be one of "fair" or "greedy"
4848
#[structopt(long = "mem-pool-type", default_value = "fair")]
@@ -70,9 +70,10 @@ impl CommonOpt {
7070
}
7171

7272
/// Modify the existing config appropriately
73-
pub fn update_config(&self, config: SessionConfig) -> SessionConfig {
74-
let mut config = config
75-
.with_batch_size(self.batch_size);
73+
pub fn update_config(&self, mut config: SessionConfig) -> SessionConfig {
74+
if let Some(batch_size) = self.batch_size {
75+
config = config.with_batch_size(batch_size)
76+
}
7677

7778
if let Some(partitions) = self.partitions {
7879
config = config.with_target_partitions(partitions)
@@ -82,6 +83,7 @@ impl CommonOpt {
8283
config =
8384
config.with_sort_spill_reservation_bytes(sort_spill_reservation_bytes);
8485
}
86+
8587
config
8688
}
8789

0 commit comments

Comments
 (0)