tustvold commented on code in PR #260:
URL: https://github.com/apache/arrow-ballista/pull/260#discussion_r978332581


##########
ballista/rust/core/src/utils.rs:
##########
@@ -54,9 +58,47 @@ use std::time::Duration;
 use std::{fs::File, pin::Pin};
 use tonic::codegen::StdError;
 use tonic::transport::{Channel, Error, Server};
+use url::Url;
 
-/// Stream data to disk in Arrow IPC format
+/// Default session builder using the provided configuration
+pub fn default_session_builder(config: SessionConfig) -> SessionState {
+    SessionState::with_config_rt(
+        config,
+        Arc::new(
+            
RuntimeEnv::new(with_object_store_provider(RuntimeConfig::default()))
+                .unwrap(),
+        ),
+    )
+}
 
+/// Get a RuntimeConfig with specific ObjectStoreDetector in the 
ObjectStoreRegistry
+pub fn with_object_store_provider(config: RuntimeConfig) -> RuntimeConfig {
+    
config.with_object_store_registry(Arc::new(ObjectStoreRegistry::new_with_provider(
+        Some(Arc::new(FeatureBasedObjectStoreProvider)),
+    )))
+}
+
+/// An object store detector based on which features are enable for different 
kinds of object stores
+pub struct FeatureBasedObjectStoreProvider;
+
+impl ObjectStoreProvider for FeatureBasedObjectStoreProvider {
+    /// Detector a suitable object store based on its url if possible
+    /// Return the key and object store
+    #[allow(unused_variables)]
+    fn get_by_url(&self, url: &Url) -> Option<Arc<dyn ObjectStore>> {
+        #[cfg(feature = "hdfs")]

Review Comment:
   Being able to enable/disable object stores based on features sounds 
sensible, but I would recommend supporting multiple based on the scheme. Having 
to recompile different binaries for different backends is unfortunate. It's 
possible you intend to do this anyway, but thought I would mention



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to