This is an automated email from the ASF dual-hosted git repository.

tustvold pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow-datafusion.git


The following commit(s) were added to refs/heads/master by this push:
     new a2be1dc39 Remove ObjectStoreRegistry::clone (#2941)
a2be1dc39 is described below

commit a2be1dc397fde42a1b24e810c14bb1ed109a304a
Author: Raphael Taylor-Davies <[email protected]>
AuthorDate: Mon Jul 18 14:13:47 2022 -0400

    Remove ObjectStoreRegistry::clone (#2941)
---
 datafusion/core/src/datasource/object_store.rs | 5 ++---
 datafusion/core/src/execution/runtime_env.rs   | 6 +++---
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/datafusion/core/src/datasource/object_store.rs 
b/datafusion/core/src/datasource/object_store.rs
index 65f390009..3ec3a6639 100644
--- a/datafusion/core/src/datasource/object_store.rs
+++ b/datafusion/core/src/datasource/object_store.rs
@@ -89,10 +89,9 @@ pub trait ObjectStoreProvider: Send + Sync + 'static {
 }
 
 /// Object store registry
-#[derive(Clone)]
 pub struct ObjectStoreRegistry {
     /// A map from scheme to object store that serve list / read operations 
for the store
-    object_stores: Arc<RwLock<HashMap<String, Arc<dyn ObjectStore>>>>,
+    object_stores: RwLock<HashMap<String, Arc<dyn ObjectStore>>>,
     provider: Option<Arc<dyn ObjectStoreProvider>>,
 }
 
@@ -125,7 +124,7 @@ impl ObjectStoreRegistry {
         let mut map: HashMap<String, Arc<dyn ObjectStore>> = HashMap::new();
         map.insert("file://".to_string(), Arc::new(LocalFileSystem::new()));
         Self {
-            object_stores: Arc::new(RwLock::new(map)),
+            object_stores: RwLock::new(map),
             provider,
         }
     }
diff --git a/datafusion/core/src/execution/runtime_env.rs 
b/datafusion/core/src/execution/runtime_env.rs
index 36159db8e..87375b733 100644
--- a/datafusion/core/src/execution/runtime_env.rs
+++ b/datafusion/core/src/execution/runtime_env.rs
@@ -63,7 +63,7 @@ impl RuntimeEnv {
         Ok(Self {
             memory_manager: MemoryManager::new(memory_manager),
             disk_manager: DiskManager::try_new(disk_manager)?,
-            object_store_registry: Arc::new(object_store_registry),
+            object_store_registry,
         })
     }
 
@@ -123,7 +123,7 @@ pub struct RuntimeConfig {
     /// MemoryManager to limit access to memory
     pub memory_manager: MemoryManagerConfig,
     /// ObjectStoreRegistry to get object store based on url
-    pub object_store_registry: ObjectStoreRegistry,
+    pub object_store_registry: Arc<ObjectStoreRegistry>,
 }
 
 impl RuntimeConfig {
@@ -147,7 +147,7 @@ impl RuntimeConfig {
     /// Customize object store registry
     pub fn with_object_store_registry(
         mut self,
-        object_store_registry: ObjectStoreRegistry,
+        object_store_registry: Arc<ObjectStoreRegistry>,
     ) -> Self {
         self.object_store_registry = object_store_registry;
         self

Reply via email to