Skip to content

Commit ed12f11

Browse files
authored
Minor: allow to build RuntimeEnv from RuntimeConfig (#12151)
* Allow to build RuntimeEnv from RuntimeConfig * Fix formatting
1 parent 7d49fb3 commit ed12f11

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

datafusion/core/tests/fuzz_cases/sort_fuzz.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use arrow::{
2222
compute::SortOptions,
2323
record_batch::RecordBatch,
2424
};
25-
use datafusion::execution::runtime_env::{RuntimeConfig, RuntimeEnv};
25+
use datafusion::execution::runtime_env::RuntimeConfig;
2626
use datafusion::physical_plan::expressions::PhysicalSortExpr;
2727
use datafusion::physical_plan::memory::MemoryExec;
2828
use datafusion::physical_plan::sorts::sort::SortExec;
@@ -136,9 +136,10 @@ impl SortTest {
136136
.sort_spill_reservation_bytes,
137137
);
138138

139-
let runtime_config = RuntimeConfig::new()
140-
.with_memory_pool(Arc::new(GreedyMemoryPool::new(pool_size)));
141-
let runtime = Arc::new(RuntimeEnv::new(runtime_config).unwrap());
139+
let runtime_env = RuntimeConfig::new()
140+
.with_memory_pool(Arc::new(GreedyMemoryPool::new(pool_size)))
141+
.build();
142+
let runtime = Arc::new(runtime_env.unwrap());
142143
SessionContext::new_with_config_rt(session_config, runtime)
143144
} else {
144145
SessionContext::new_with_config(session_config)

datafusion/execution/src/runtime_env.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,4 +228,9 @@ impl RuntimeConfig {
228228
pub fn with_temp_file_path(self, path: impl Into<PathBuf>) -> Self {
229229
self.with_disk_manager(DiskManagerConfig::new_specified(vec![path.into()]))
230230
}
231+
232+
/// Build a `RuntimeEnv` object from the configuration
233+
pub fn build(self) -> Result<RuntimeEnv> {
234+
RuntimeEnv::new(self)
235+
}
231236
}

0 commit comments

Comments
 (0)