This is an automated email from the ASF dual-hosted git repository.

jonah pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/datafusion.git


The following commit(s) were added to refs/heads/main by this push:
     new 8fcb3e4b8a Minor: Remove code duplication in `memory_limit` derivation 
for datafusion-cli (#10814)
8fcb3e4b8a is described below

commit 8fcb3e4b8a8fe6c4c7f83922dd860c9fa78c0639
Author: Oleks V <[email protected]>
AuthorDate: Thu Jun 6 18:47:03 2024 -0700

    Minor: Remove code duplication in `memory_limit` derivation for 
datafusion-cli (#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
---
 datafusion-cli/src/main.rs | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/datafusion-cli/src/main.rs b/datafusion-cli/src/main.rs
index d81a73df20..187f856894 100644
--- a/datafusion-cli/src/main.rs
+++ b/datafusion-cli/src/main.rs
@@ -177,18 +177,14 @@ async fn main_inner() -> Result<()> {
     let rt_config =
         // set memory pool size
         if let Some(memory_limit) = args.memory_limit {
+            // unwrap is safe here because is_valid_memory_pool_size already 
checked the value
             let memory_limit = 
extract_memory_pool_size(&memory_limit).unwrap();
             // set memory pool type
-            if let Some(mem_pool_type) = args.mem_pool_type {
-                match mem_pool_type {
-                    PoolType::Greedy => rt_config
-                        
.with_memory_pool(Arc::new(GreedyMemoryPool::new(memory_limit))),
-                    PoolType::Fair => rt_config
-                        
.with_memory_pool(Arc::new(FairSpillPool::new(memory_limit))),
-                }
-            } else {
-                rt_config
-                
.with_memory_pool(Arc::new(GreedyMemoryPool::new(memory_limit)))
+            match args.mem_pool_type {
+                Some(PoolType::Fair) => rt_config
+                    
.with_memory_pool(Arc::new(FairSpillPool::new(memory_limit))),
+                _ => rt_config
+                    
.with_memory_pool(Arc::new(GreedyMemoryPool::new(memory_limit)))
             }
         } else {
             rt_config


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to