Skip to content

Commit

Permalink
Create try_new and change calls to new (#12566)
Browse files Browse the repository at this point in the history
  • Loading branch information
OussamaSaoudi authored Sep 22, 2024
1 parent 300a39b commit 72a1053
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion datafusion-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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> {
Expand Down
10 changes: 7 additions & 3 deletions datafusion/execution/src/runtime_env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand All @@ -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;
Expand Down

0 comments on commit 72a1053

Please sign in to comment.