Skip to content

Commit 1bf55bd

Browse files
compheadfindepi
authored andcommitted
Minor: Remove code duplication in memory_limit derivation for datafusion-cli (apache#10814)
* Fix: Sort Merge Join crashes on TPCH Q21 * Fix LeftAnti SMJ join when the join filter is set * rm dbg * Minor: Remove code duplication in `memory_limit` derivation for datafusion-cli
1 parent 0cb2b36 commit 1bf55bd

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

datafusion-cli/src/main.rs

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -177,18 +177,14 @@ async fn main_inner() -> Result<()> {
177177
let rt_config =
178178
// set memory pool size
179179
if let Some(memory_limit) = args.memory_limit {
180+
// unwrap is safe here because is_valid_memory_pool_size already checked the value
180181
let memory_limit = extract_memory_pool_size(&memory_limit).unwrap();
181182
// set memory pool type
182-
if let Some(mem_pool_type) = args.mem_pool_type {
183-
match mem_pool_type {
184-
PoolType::Greedy => rt_config
185-
.with_memory_pool(Arc::new(GreedyMemoryPool::new(memory_limit))),
186-
PoolType::Fair => rt_config
187-
.with_memory_pool(Arc::new(FairSpillPool::new(memory_limit))),
188-
}
189-
} else {
190-
rt_config
191-
.with_memory_pool(Arc::new(GreedyMemoryPool::new(memory_limit)))
183+
match args.mem_pool_type {
184+
Some(PoolType::Fair) => rt_config
185+
.with_memory_pool(Arc::new(FairSpillPool::new(memory_limit))),
186+
_ => rt_config
187+
.with_memory_pool(Arc::new(GreedyMemoryPool::new(memory_limit)))
192188
}
193189
} else {
194190
rt_config

0 commit comments

Comments
 (0)