-
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
Deprecate RuntimeConfig
, update code to use new builder style
#13635
Conversation
.with_memory_pool(Arc::new(FairSpillPool::new(mem_limit as usize))) | ||
.build_arc()?; | ||
let ctx = SessionContext::new_with_config_rt(config, runtime_config); | ||
let state = SessionStateBuilder::new() |
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.
this follows the new builder style model more fully
} | ||
} else { | ||
rt_config | ||
let mut rt_builder = RuntimeEnvBuilder::new(); |
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 think this code is now clearer -- previously the rt_config
was actually a builder and used as such, but that was someone confusing given the code style
@@ -984,12 +983,10 @@ mod tests { | |||
async fn query_compress_data( | |||
file_compression_type: FileCompressionType, | |||
) -> Result<()> { | |||
let runtime = Arc::new(RuntimeEnvBuilder::new().build()?); |
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.
This simply creates a default RuntimeEnv which the SessionStateBuilder already does, so there is no need to do it again
@@ -1932,14 +1931,12 @@ mod tests { | |||
let path = path.join("tests/tpch-csv"); | |||
let url = format!("file://{}", path.display()); | |||
|
|||
let runtime = RuntimeEnvBuilder::new().build_arc()?; |
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.
likewise here, this is the default runtime env, it isn't needed
/// following resource management functionality: | ||
/// | ||
/// * [`MemoryPool`]: Manage memory | ||
/// * [`DiskManager`]: Manage temporary files on local disk | ||
/// * [`CacheManager`]: Manage temporary cache data during the session lifetime | ||
/// * [`ObjectStoreRegistry`]: Manage mapping URLs to object store instances | ||
/// | ||
/// # Example: Create default `RuntimeEnv` |
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.
new doc examples
pub fn try_new(config: RuntimeConfig) -> Result<Self> { | ||
let RuntimeConfig { |
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.
this code is literally the same as RuntimeConfig::build so just call that directly
let runtime = RuntimeEnvBuilder::new() | ||
.build_arc() | ||
.expect("default runtime created successfully"); | ||
let runtime = Arc::new(RuntimeEnv::default()); |
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.
this does the same thing, just makes the intent clearer
32113c9
to
d043f63
Compare
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.
lgtm thanks @alamb
Thanks again for the review @comphead |
…he#13635) * Deprecate `RuntimeConfig`, update code to use new builder style * Update datafusion/execution/src/runtime_env.rs --------- Co-authored-by: Oleks V <[email protected]>
Which issue does this PR close?
Follow on to
RuntimeEnvBuilder
rather thanRuntimeConfig
#12156Rationale for this change
I hit this while working on #13424 and was a bit confused
@devanbenz added a nice builder style API to the
RuntimeEnv
as well as some backwards compatibility APIs which is greatHowever all the examples and code still use the old pattern, which means we aren't getting the benefit of the new API
What changes are included in this PR?
Changes:
Are these changes tested?
By existing tests and new doc tests
Are there any user-facing changes?
Some APIs are now deprecated, but no APIs are removed