-
Notifications
You must be signed in to change notification settings - Fork 198
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
[Ballista] Support to access remote object store, like HDFS, S3, etc #6
Comments
@yahoNanJing fyi @seddonm1 and I have been working on https://github.com/datafusion-contrib/datafusion-objectstore-s3. Still early stages but would be great to have more use cases that we could steer development with. |
This PR would support this use case: apache/datafusion#1677 |
Hi @matthewmturner, thanks for your info. It's really helpful example for creating another independent crate, like datafusion-objectstore-hdfs. However, it would better to avoid new object store registration for cases like providing sql service without any places for users to do manually registration. And it's not a good way to do the registration for each sql or each session, since it's quite stable for the data sources the service provides for. |
Thanks @thinkharderdev. I think it's better for the path to be self-described, like s3://hostname:port/xxx/... or hdfs://hostname:port/xxx/.... Then the object store management service can detect which remote object store will be used. If possible, it's better to provide a way to avoid remote object store registration. |
@yahoNanJing there actually already is a hdfs extension here https://github.com/datafusion-contrib/datafusion-hdfs-native. Understood on your point - in that case what would be your ideal API for accessing S3? I would have thought the service could register the |
Not sure I follow. I agree that the object store should be resolved from the file URI, but we would still have to register an |
Hi @matthewmturner and @thinkharderdev, what I'm thinking is to introduce some remote object store extensions as Datafusion features. These extensions will be inclusive crates and are managed independently so that this solution will not introduce additional maintenance effort for Datafusion. However, this solution is blocked by apache/datafusion#1772. After the datasource module is splitted into an independent crate. Then the remote object store extensions will be able to just depend on that crate. In other places, we can setup whether to enable the extension features or not. By this way, we can avoid cyclic dependency. Further to say, for the default object stores in the ObjectStoreRegistry, maybe better to make it configurable so that we can avoid remote object store registration manually. |
Had a quick look into this issue, and from what I can see, there is not nothing missing on datafusion side to have this functionality (apart from some hard work :)). Team did a great job to add support for object store in datafusion: use std::sync::Arc;
use datafusion::{
datasource::listing::{ListingTable, ListingTableConfig, ListingTableUrl},
prelude::SessionContext,
};
use log::info;
use object_store::aws::AmazonS3Builder;
let ctx = SessionContext::new();
let s3 = AmazonS3Builder::new()
.with_region("us-east-1")
.with_bucket_name("testbucket")
.with_access_key_id("MINIO")
.with_secret_access_key("MINIO/MINIO")
.with_endpoint("http://localhost:9000")
.with_allow_http(true)
.build()
.unwrap();
let s3 = Arc::new(s3);
ctx.runtime_env()
.register_object_store("s3", "localhost:9000", s3);
let url = ListingTableUrl::parse("s3://localhost:9000/testpath/").unwrap();
let config = ListingTableConfig::new(url)
.infer(&ctx.state())
.await
.unwrap();
let table = ListingTable::try_new(config).unwrap();
ctx.register_table("test", Arc::new(table)).unwrap();
ctx.sql("SELECT * FROM test")
.await
.unwrap()
.show()
.await
.unwrap(); I give quick try with ballista Alternatively |
@yahoNanJing this issue seems related to apache/datafusion#3311 where we are working towards allowing users to register |
@avantgardnerio SQL would be perfect fit |
I think the problem is that this must happen dynamically in the case of a DataFusion executor in Ballista. The solution I am proposing is a Edit: by dynamically, I mean the name of the table and the path to it will not be known at compile time. |
Is loading the data from S3 possible with a distributed setup right now? If so, can you provide a small example? I tried with a path on S3 and it failed with "no object store available for s3" error. This happened after I added the s3 feature to my project. Looks like s3 feature hasn't been added to scheduler and executor. |
@saikrishna1-bidgely, here's an example of what I tried and this worked. I'm not 100% sure that this is how it is supposed to be :-)
You may need to define additional
I tested with the following sample code:
The code correctly returns the number of rows in the Parquet file:
Last bit of logging from the
From the
Hope this helps. |
@ahmedriza can you make this into a PR pls. That would be a lot helpful. |
@ahmedriza I tried what you suggested. I built the scheduler and executor with the s3 feature added to ballista-core dependency in cargo.toml. But I'm getting the same error: [package]
name = "ballista-test"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
ballista = "0.11.0"
datafusion = "18.0.0"
tokio = "1.0"
parquet = "29.0.0" |
There is also could be nice to have an uplink support of storj network https://github.com/storj/uplink (Rust bindings for libuplink https://github.com/storj-thirdparty/uplink-rust). It provide a direct access to the storj network avoiding s3 gateway bottleneck. (https://github.com/storj/storj/wiki/Libuplink-Walkthrough) |
@ahmedriza is this going to be fixed? |
Is your feature request related to a problem or challenge? Please describe what you are trying to do.
After introducing the object store API, to support to access remote object store for Ballista executors, there are still some gap. For example, as #22 and #10 mentioned, ballista is not able to support remote object store.
Describe the solution you'd like
Our workaround is to make the file path self described. For example, a local file path should be file://tmp/..., a hdfs file path should hdfs://localhost:xxx:/tmp/...
The text was updated successfully, but these errors were encountered: