You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opendal.apache.org by "meteorgan (via GitHub)" <gi...@apache.org> on 2025/01/13 12:02:12 UTC

[PR] example(integration/object_store): add example for datafusion [opendal]

meteorgan opened a new pull request, #5543:
URL: https://github.com/apache/opendal/pull/5543

   # Which issue does this PR close?
   
   <!--
   We generally require a GitHub issue to be filed for all bug fixes and enhancements. You can link an issue to this PR using the GitHub syntax. For example `Closes #123` indicates that this PR will close issue #123.
   -->
   
   Part of: https://github.com/apache/opendal/issues/4599
   
   # Rationale for this change
   
   <!--
   Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed.
   Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes.
   -->
   
   # What changes are included in this PR?
   
   <!--
   There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR.
   -->
   
   # Are there any user-facing changes?
   
   
   <!--
   If there are user-facing changes then we may require documentation to be updated before approving the PR.
   -->
   
   <!---
   If there are any breaking changes to public APIs, please add the `breaking-changes` label.
   -->
   


-- 
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: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] docs(integration/object_store): add example for datafusion [opendal]

Posted by "Xuanwo (via GitHub)" <gi...@apache.org>.
Xuanwo commented on code in PR #5543:
URL: https://github.com/apache/opendal/pull/5543#discussion_r1914971991


##########
integrations/object_store/README.md:
##########
@@ -78,6 +80,77 @@ async fn main() {
 }
 ```
 
+### 2. querying data in a S3 bucket using DataFusion
+
+Add the following dependencies to your `Cargo.toml` with correct version:
+
+```toml
+[dependencies]
+object_store = "0.11.0"
+object_store_opendal = "0.49.0"
+opendal = { version = "0.51.0", features = ["services-s3"] }

Review Comment:
   Perfect!



-- 
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: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] docs(integration/object_store): add example for datafusion [opendal]

Posted by "Xuanwo (via GitHub)" <gi...@apache.org>.
Xuanwo merged PR #5543:
URL: https://github.com/apache/opendal/pull/5543


-- 
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: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] docs(integration/object_store): add example for datafusion [opendal]

Posted by "Xuanwo (via GitHub)" <gi...@apache.org>.
Xuanwo commented on PR #5543:
URL: https://github.com/apache/opendal/pull/5543#issuecomment-2586950856

   Hi, this example is excellent. Could we include it in the README to make it more visible?


-- 
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: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] docs(integration/object_store): add example for datafusion [opendal]

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on code in PR #5543:
URL: https://github.com/apache/opendal/pull/5543#discussion_r1914821230


##########
integrations/object_store/examples/datafusion.rs:
##########
@@ -0,0 +1,52 @@
+use datafusion::error::DataFusionError;
+use datafusion::error::Result;
+use datafusion::prelude::*;
+use opendal::services::S3;
+use opendal::Operator;
+use std::sync::Arc;
+use url::Url;
+
+/// This example demonstrates querying data in a S3 bucket using DataFusion and `object_store_opendal`
+#[tokio::main]
+async fn main() -> Result<()> {
+    let ctx = SessionContext::new();
+
+    // Configure OpenDAL for S3
+    let region = "my_region";
+    let bucket_name = "my_bucket";
+    let builder = S3::default()
+        .endpoint("my_endpoint")
+        .bucket(bucket_name)
+        .region(region)
+        .access_key_id("my_access_key")
+        .secret_access_key("my_secret_key");
+    let op = Operator::new(builder)
+        .map_err(|err| DataFusionError::External(Box::new(err)))?
+        .finish();
+    let store = object_store_opendal::OpendalStore::new(op);

Review Comment:
   ❤️  this is very cool



-- 
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: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] docs(integration/object_store): add example for datafusion [opendal]

Posted by "Xuanwo (via GitHub)" <gi...@apache.org>.
Xuanwo commented on code in PR #5543:
URL: https://github.com/apache/opendal/pull/5543#discussion_r1913387173


##########
integrations/object_store/README.md:
##########
@@ -78,6 +80,77 @@ async fn main() {
 }
 ```
 
+### 2. querying data in a S3 bucket using DataFusion
+
+Add the following dependencies to your `Cargo.toml` with correct version:
+
+```toml
+[dependencies]
+object_store = "0.11.0"
+object_store_opendal = "0.49.0"
+opendal = { version = "0.51.0", features = ["services-s3"] }

Review Comment:
   > These versions aren't correct. we need to wait for the next release to get the correct available versions. Should we include them here ?
   
   Perhaps we should avoid referencing the version directly, as it's quite difficult to keep it sync. Do you have any suggestions?



-- 
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: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] docs(integration/object_store): add example for datafusion [opendal]

Posted by "meteorgan (via GitHub)" <gi...@apache.org>.
meteorgan commented on code in PR #5543:
URL: https://github.com/apache/opendal/pull/5543#discussion_r1914941025


##########
integrations/object_store/README.md:
##########
@@ -78,6 +80,77 @@ async fn main() {
 }
 ```
 
+### 2. querying data in a S3 bucket using DataFusion
+
+Add the following dependencies to your `Cargo.toml` with correct version:
+
+```toml
+[dependencies]
+object_store = "0.11.0"
+object_store_opendal = "0.49.0"
+opendal = { version = "0.51.0", features = ["services-s3"] }

Review Comment:
   How about this ?
   <img width="910" alt="image" src="https://github.com/user-attachments/assets/9510bc34-e0eb-48bc-ae6a-5323b26ea400" />
   



-- 
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: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] docs(integration/object_store): add example for datafusion [opendal]

Posted by "meteorgan (via GitHub)" <gi...@apache.org>.
meteorgan commented on PR #5543:
URL: https://github.com/apache/opendal/pull/5543#issuecomment-2586961501

   Forgot to attach the result of this example:
   ![Xnip2025-01-13_19-58-49](https://github.com/user-attachments/assets/fa13d1f7-e2f2-47bc-9d8e-15cebdac5075)
   


-- 
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: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] docs(integration/object_store): add example for datafusion [opendal]

Posted by "meteorgan (via GitHub)" <gi...@apache.org>.
meteorgan commented on PR #5543:
URL: https://github.com/apache/opendal/pull/5543#issuecomment-2586956761

   > Hi, this example is excellent. Could we include it in the README to make it more visible?
   
   Ok, I'll add it later.


-- 
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: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] docs(integration/object_store): add example for datafusion [opendal]

Posted by "meteorgan (via GitHub)" <gi...@apache.org>.
meteorgan commented on code in PR #5543:
URL: https://github.com/apache/opendal/pull/5543#discussion_r1913308183


##########
integrations/object_store/README.md:
##########
@@ -78,6 +80,77 @@ async fn main() {
 }
 ```
 
+### 2. querying data in a S3 bucket using DataFusion
+
+Add the following dependencies to your `Cargo.toml` with correct version:
+
+```toml
+[dependencies]
+object_store = "0.11.0"
+object_store_opendal = "0.49.0"
+opendal = { version = "0.51.0", features = ["services-s3"] }

Review Comment:
   These versions aren't correct. we need to wait for the next release to get the correct available versions. Should we include them here ?



-- 
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: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org