diff --git a/datafusion-cli/src/main.rs b/datafusion-cli/src/main.rs index cdefada5e24ae..4c6c352ff3395 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::new(rn_config) + RuntimeEnv::try_new(rn_config) } fn parse_valid_file(dir: &str) -> Result { diff --git a/datafusion/execution/src/runtime_env.rs b/datafusion/execution/src/runtime_env.rs index 574d387ae697f..4022eb07de0c7 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::try_new(config) + } + /// Create env based on configuration + pub fn try_new(config: RuntimeConfig) -> Result { 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;