Skip to content

Commit

Permalink
Move hdfs-native-object-store dependency to cloud feature
Browse files Browse the repository at this point in the history
  • Loading branch information
SchutteJan committed Jul 12, 2024
1 parent 54364dd commit 3b718f5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
2 changes: 1 addition & 1 deletion kernel/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ cloud = [
"object_store/azure",
"object_store/gcp",
"object_store/http",
"hdfs-native-object-store",
]
default = ["sync-engine"]
default-engine = [
Expand All @@ -77,7 +78,6 @@ default-engine = [
"parquet/object_store",
"reqwest",
"tokio",
"hdfs-native-object-store"
]

developer-visibility = []
Expand Down
22 changes: 13 additions & 9 deletions kernel/src/engine/default/storage.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#[cfg(feature = "cloud")]
use hdfs_native_object_store::HdfsObjectStore;
use object_store::parse_url_opts as object_store_parse_url_opts;
use object_store::path::Path;
Expand All @@ -10,15 +11,18 @@ where
K: AsRef<str>,
V: Into<String>,
{
let scheme = url.scheme();
if scheme == "hdfs" || scheme == "viewfs" {
let options_map = options
.into_iter()
.map(|(k, v)| (k.as_ref().to_string(), v.into()))
.collect();
let store = HdfsObjectStore::with_config(url.as_str(), options_map)?;
let path = Path::parse(url.path())?;
return Ok((Box::new(store), path));
#[cfg(feature = "cloud")]
{
let scheme = url.scheme();
if scheme == "hdfs" || scheme == "viewfs" {
let options_map = options
.into_iter()
.map(|(k, v)| (k.as_ref().to_string(), v.into()))
.collect();
let store = HdfsObjectStore::with_config(url.as_str(), options_map)?;
let path = Path::parse(url.path())?;
return Ok((Box::new(store), path));
}
}

object_store_parse_url_opts(url, options)
Expand Down

0 comments on commit 3b718f5

Please sign in to comment.