-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Minor: allow to build RuntimeEnv from RuntimeConfig #12151
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,7 +22,7 @@ use arrow::{ | |
compute::SortOptions, | ||
record_batch::RecordBatch, | ||
}; | ||
use datafusion::execution::runtime_env::{RuntimeConfig, RuntimeEnv}; | ||
use datafusion::execution::runtime_env::RuntimeConfig; | ||
use datafusion::physical_plan::expressions::PhysicalSortExpr; | ||
use datafusion::physical_plan::memory::MemoryExec; | ||
use datafusion::physical_plan::sorts::sort::SortExec; | ||
|
@@ -136,9 +136,10 @@ impl SortTest { | |
.sort_spill_reservation_bytes, | ||
); | ||
|
||
let runtime_config = RuntimeConfig::new() | ||
.with_memory_pool(Arc::new(GreedyMemoryPool::new(pool_size))); | ||
let runtime = Arc::new(RuntimeEnv::new(runtime_config).unwrap()); | ||
let runtime_env = RuntimeConfig::new() | ||
.with_memory_pool(Arc::new(GreedyMemoryPool::new(pool_size))) | ||
.build(); | ||
let runtime = Arc::new(runtime_env.unwrap()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we should avoid calling There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure. Even for tests, if we have complex chains of unwraps, we can use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (note this is a test so I think it is ok to call unwrap() here) |
||
SessionContext::new_with_config_rt(session_config, runtime) | ||
} else { | ||
SessionContext::new_with_config(session_config) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure why it is env, config is more appropriate imho
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's because a newly introduced method
build
returns env. Please check the rest of this expression in diff below.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with @comphead this now looks a bit strange -- I filed #12156 with an idea of how to improve it