This is an automated email from the ASF dual-hosted git repository.
alamb 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 72a1053006 Create try_new and change calls to new (#12566)
72a1053006 is described below
commit 72a1053006b8a714c6ebbe7572de532882d8b0c8
Author: OussamaSaoudi <[email protected]>
AuthorDate: Sun Sep 22 04:32:03 2024 -0700
Create try_new and change calls to new (#12566)
---
datafusion-cli/src/main.rs | 2 +-
datafusion/execution/src/runtime_env.rs | 10 +++++++---
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/datafusion-cli/src/main.rs b/datafusion-cli/src/main.rs
index cdefada5e2..4c6c352ff3 100644
--- a/datafusion-cli/src/main.rs
+++ b/datafusion-cli/src/main.rs
@@ -232,7 +232,7 @@ async fn main_inner() -> Result<()> {
}
fn create_runtime_env(rn_config: RuntimeConfig) -> Result<RuntimeEnv> {
- RuntimeEnv::new(rn_config)
+ RuntimeEnv::try_new(rn_config)
}
fn parse_valid_file(dir: &str) -> Result<String, String> {
diff --git a/datafusion/execution/src/runtime_env.rs
b/datafusion/execution/src/runtime_env.rs
index 574d387ae6..4022eb07de 100644
--- a/datafusion/execution/src/runtime_env.rs
+++ b/datafusion/execution/src/runtime_env.rs
@@ -66,8 +66,12 @@ impl Debug for RuntimeEnv {
}
impl RuntimeEnv {
- /// Create env based on configuration
+ #[deprecated(note = "please use `try_new` instead")]
pub fn new(config: RuntimeConfig) -> Result<Self> {
+ Self::try_new(config)
+ }
+ /// Create env based on configuration
+ pub fn try_new(config: RuntimeConfig) -> Result<Self> {
let RuntimeConfig {
memory_pool,
disk_manager,
@@ -100,7 +104,7 @@ impl RuntimeEnv {
/// # use std::sync::Arc;
/// # use url::Url;
/// # use datafusion_execution::runtime_env::RuntimeEnv;
- /// # let runtime_env = RuntimeEnv::new(Default::default()).unwrap();
+ /// # let runtime_env = RuntimeEnv::try_new(Default::default()).unwrap();
/// let url = Url::try_from("file://").unwrap();
/// let object_store = object_store::local::LocalFileSystem::new();
/// // register the object store with the runtime environment
@@ -115,7 +119,7 @@ impl RuntimeEnv {
/// # use std::sync::Arc;
/// # use url::Url;
/// # use datafusion_execution::runtime_env::RuntimeEnv;
- /// # let runtime_env = RuntimeEnv::new(Default::default()).unwrap();
+ /// # let runtime_env = RuntimeEnv::try_new(Default::default()).unwrap();
/// # // use local store for example as http feature is not enabled
/// # let http_store = object_store::local::LocalFileSystem::new();
/// // create a new object store via object_store::http::HttpBuilder;
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]