Apache DataFusion SQL Query Engine
Create try_new and change calls to new (#12566)
OussamaSaoudi72a1053006b8
diff --git a/datafusion-cli/src/main.rs b/datafusion-cli/src/main.rsindex 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.rsindex 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;