Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add GCS and Azure support #308

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions ballista/rust/client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ tempfile = "3"
tokio = "1.0"

[features]
azure = ["ballista-core/azure"]
default = []
gcs = ["ballista-core/gcs"]
hdfs = ["ballista-core/hdfs"]
s3 = ["ballista-core/s3"]
standalone = ["ballista-executor", "ballista-scheduler"]
11 changes: 6 additions & 5 deletions ballista/rust/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

[package]
name = "ballista-core"
description = "Ballista Distributed Compute"
Expand All @@ -31,16 +30,17 @@ build = "build.rs"
rustc-args = ["--cfg", "docsrs"]

[features]
azure = ["object_store/azure"]
# Used for testing ONLY: causes all values to hash to the same value (test for collisions)
force_hash_collisions = ["datafusion/force_hash_collisions"]
gcs = ["object_store/gcp"]
# Used to enable hdfs to be registered in the ObjectStoreRegistry by default
hdfs = ["datafusion-objectstore-hdfs"]
s3 = ["object_store/aws"]
simd = ["datafusion/simd"]

[dependencies]
ahash = { version = "0.8", default-features = false }

arrow-flight = { version = "23.0.0", features = ["flight-sql-experimental"] }
async-trait = "0.1.41"
chrono = { version = "0.4", default-features = false }
Expand All @@ -50,13 +50,11 @@ datafusion-objectstore-hdfs = { version = "0.1.0", optional = true }
datafusion-proto = { git = "https://github.com/apache/arrow-datafusion", rev = "06a4f79f02fcb6ea85303925b7c5a9b0231e3fee" }
futures = "0.3"
hashbrown = "0.12"

itertools = "0.10"
libloading = "0.7.3"
log = "0.4"
object_store = "0.5.0"
once_cell = "1.9.0"

parking_lot = "0.12"
parse_arg = "0.1.3"
prost = "0.11"
Expand All @@ -76,4 +74,7 @@ tempfile = "3"

[build-dependencies]
rustc_version = "0.4.0"
tonic-build = { version = "0.8", default-features = false, features = ["transport", "prost"] }
tonic-build = { version = "0.8", default-features = false, features = [
"transport",
"prost",
] }
28 changes: 28 additions & 0 deletions ballista/rust/core/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ use futures::StreamExt;
use log::error;
#[cfg(feature = "s3")]
use object_store::aws::AmazonS3Builder;
#[cfg(feature = "azure")]
use object_store::azure::MicrosoftAzureBuilder;
#[cfg(feature = "gcs")]
use object_store::gcp::GoogleCloudStorageBuilder;
use object_store::ObjectStore;
use std::io::{BufWriter, Write};
use std::marker::PhantomData;
Expand Down Expand Up @@ -109,6 +113,30 @@ impl ObjectStoreProvider for FeatureBasedObjectStoreProvider {
}
}

#[cfg(feature = "gcs")]
{
if url.to_string().starts_with("gcs://") {
if let Some(bucket_name) = url.host_str() {
let store = GoogleCloudStorageBuilder::from_env()
.with_bucket_name(bucket_name)
.build()?;
return Ok(Arc::new(store));
}
}
}

#[cfg(feature = "azure")]
{
if url.to_string().starts_with("azure://") {
if let Some(bucket_name) = url.host_str() {
let store = MicrosoftAzureBuilder::from_env()
.with_container_name(bucket_name)
.build()?;
return Ok(Arc::new(store));
}
}
}

Err(DataFusionError::Execution(format!(
"No object store available for {}",
url
Expand Down