This is an automated email from the ASF dual-hosted git repository.

comphead pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/datafusion.git


The following commit(s) were added to refs/heads/main by this push:
     new 3a795a41d6 Minor: Improve ObjectStoreUrl docs + examples (#10619)
3a795a41d6 is described below

commit 3a795a41d688f509b328131e0a0edb43983e0fa6
Author: Andrew Lamb <[email protected]>
AuthorDate: Sun May 26 15:06:01 2024 -0400

    Minor: Improve ObjectStoreUrl docs + examples (#10619)
---
 datafusion/execution/src/object_store.rs | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/datafusion/execution/src/object_store.rs 
b/datafusion/execution/src/object_store.rs
index 7697c01d63..3ba21e399f 100644
--- a/datafusion/execution/src/object_store.rs
+++ b/datafusion/execution/src/object_store.rs
@@ -27,7 +27,12 @@ use object_store::ObjectStore;
 use std::sync::Arc;
 use url::Url;
 
-/// A parsed URL identifying a particular [`ObjectStore`]
+/// A parsed URL identifying a particular [`ObjectStore`] instance
+///
+/// For example:
+/// * `file://` for local file system
+/// * `s3://bucket` for AWS S3 bucket
+/// * `oss://bucket` for Aliyun OSS bucket
 #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
 pub struct ObjectStoreUrl {
     url: Url,
@@ -35,6 +40,19 @@ pub struct ObjectStoreUrl {
 
 impl ObjectStoreUrl {
     /// Parse an [`ObjectStoreUrl`] from a string
+    ///
+    /// # Example
+    /// ```
+    /// # use url::Url;
+    /// # use datafusion_execution::object_store::ObjectStoreUrl;
+    /// let object_store_url = ObjectStoreUrl::parse("s3://bucket").unwrap();
+    /// assert_eq!(object_store_url.as_str(), "s3://bucket/");
+    /// // can also access the underlying `Url`
+    /// let url: &Url = object_store_url.as_ref();
+    /// assert_eq!(url.scheme(), "s3");
+    /// assert_eq!(url.host_str(), Some("bucket"));
+    /// assert_eq!(url.path(), "/");
+    /// ```
     pub fn parse(s: impl AsRef<str>) -> Result<Self> {
         let mut parsed =
             Url::parse(s.as_ref()).map_err(|e| 
DataFusionError::External(Box::new(e)))?;


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to