You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@paimon.apache.org by "QuakeWang (via GitHub)" <gi...@apache.org> on 2026/03/14 16:43:07 UTC

[PR] feat: add OSS storage support. [paimon-rust]

QuakeWang opened a new pull request, #134:
URL: https://github.com/apache/paimon-rust/pull/134

   <!--
   Thank you very much for contributing to Paimon Rust - we are happy that you want to help us improve it. To help the community review your contribution in the best possible way, please go through the checklist below, which will get the contribution into a shape in which it can be best reviewed.
   
   ## Contribution Checklist
   
     - Make sure that the pull request corresponds to a [GitHub issue](https://github.com/apache/paimon-rust/issues). Exceptions are made for typos in documentation or comments, which need no issue.
   
     - Fill out the template below to describe the changes contributed by the pull request. That will give reviewers the context they need to do the review.
   
     - Make sure that the change passes the automated tests, i.e., `cargo test` passes.
   
     - Each pull request should address only one issue, not mix up code from multiple issues.
   
   **(The sections below can be removed for hotfixes or typos)**
   -->
   
   ### Purpose
   
   <!-- Linking this pull request to the issue -->
   Linked issue: close #120 
   
   <!-- What is the purpose of the change -->
   
   ### Brief change log
   
   <!-- Please describe the changes made in this pull request and explain how they address the issue -->
   
   ### Tests
   
   <!-- List unit tests or integration cases to verify this change -->
   
   ### API and Format
   
   <!-- Does this change affect API or storage format -->
   
   ### Documentation
   
   <!-- Does this change introduce a new feature or require documentation updates -->
   


-- 
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: issues-unsubscribe@paimon.apache.org

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


Re: [PR] feat: add OSS storage support. [paimon-rust]

Posted by "QuakeWang (via GitHub)" <gi...@apache.org>.
QuakeWang commented on PR #134:
URL: https://github.com/apache/paimon-rust/pull/134#issuecomment-4062459060

   > @QuakeWang Thanks for the pr. Left minor comments. PTAL
   
   @luoyuxia, I have updated the code according to the review comments.


-- 
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: issues-unsubscribe@paimon.apache.org

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


Re: [PR] feat: add OSS storage support. [paimon-rust]

Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi merged PR #134:
URL: https://github.com/apache/paimon-rust/pull/134


-- 
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: issues-unsubscribe@paimon.apache.org

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


Re: [PR] feat: add OSS storage support. [paimon-rust]

Posted by "luoyuxia (via GitHub)" <gi...@apache.org>.
luoyuxia commented on code in PR #134:
URL: https://github.com/apache/paimon-rust/pull/134#discussion_r2936144486


##########
crates/paimon/src/io/storage_oss.rs:
##########
@@ -0,0 +1,127 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use std::collections::HashMap;
+
+use opendal::services::OssConfig;
+use opendal::Operator;
+use url::Url;
+
+use crate::error::Error;
+use crate::Result;
+
+/// Configuration key for OSS endpoint.
+///
+/// Compatible with paimon-java's `fs.oss.endpoint`.
+const OSS_ENDPOINT: &str = "fs.oss.endpoint";
+
+/// Configuration key for OSS access key ID.
+///
+/// Compatible with paimon-java's `fs.oss.accessKeyId`.
+const OSS_ACCESS_KEY_ID: &str = "fs.oss.accessKeyId";
+
+/// Configuration key for OSS access key secret.
+///
+/// Compatible with paimon-java's `fs.oss.accessKeySecret`.
+const OSS_ACCESS_KEY_SECRET: &str = "fs.oss.accessKeySecret";
+
+/// Parse paimon catalog options into an [`OssConfig`].
+///
+/// Extracts OSS-related configuration keys (endpoint, access key, secret key)
+/// from the provided properties map and maps them to the corresponding
+/// [`OssConfig`] fields.
+pub(crate) fn oss_config_parse(mut props: HashMap<String, String>) -> Result<OssConfig> {
+    let mut cfg = OssConfig::default();
+
+    if let Some(endpoint) = props.remove(OSS_ENDPOINT) {

Review Comment:
   nit: if endpoint, access_key_id, access_key_secret not configured, return error directly



##########
crates/paimon/src/io/storage_oss.rs:
##########
@@ -0,0 +1,127 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use std::collections::HashMap;
+
+use opendal::services::OssConfig;
+use opendal::Operator;
+use url::Url;
+
+use crate::error::Error;
+use crate::Result;
+
+/// Configuration key for OSS endpoint.
+///
+/// Compatible with paimon-java's `fs.oss.endpoint`.
+const OSS_ENDPOINT: &str = "fs.oss.endpoint";
+
+/// Configuration key for OSS access key ID.
+///
+/// Compatible with paimon-java's `fs.oss.accessKeyId`.
+const OSS_ACCESS_KEY_ID: &str = "fs.oss.accessKeyId";
+
+/// Configuration key for OSS access key secret.
+///
+/// Compatible with paimon-java's `fs.oss.accessKeySecret`.
+const OSS_ACCESS_KEY_SECRET: &str = "fs.oss.accessKeySecret";
+
+/// Parse paimon catalog options into an [`OssConfig`].
+///
+/// Extracts OSS-related configuration keys (endpoint, access key, secret key)
+/// from the provided properties map and maps them to the corresponding
+/// [`OssConfig`] fields.
+pub(crate) fn oss_config_parse(mut props: HashMap<String, String>) -> Result<OssConfig> {
+    let mut cfg = OssConfig::default();
+
+    if let Some(endpoint) = props.remove(OSS_ENDPOINT) {
+        cfg.endpoint = Some(endpoint);
+    }
+    if let Some(access_key_id) = props.remove(OSS_ACCESS_KEY_ID) {
+        cfg.access_key_id = Some(access_key_id);
+    }
+    if let Some(access_key_secret) = props.remove(OSS_ACCESS_KEY_SECRET) {
+        cfg.access_key_secret = Some(access_key_secret);
+    }
+
+    Ok(cfg)
+}
+
+/// Build an [`Operator`] for the given OSS path.
+///
+/// Parses the bucket name from the `oss://bucket/key` URL and combines it
+/// with the provided [`OssConfig`] to construct an OpenDAL operator.
+pub(crate) fn oss_config_build(cfg: &OssConfig, path: &str) -> Result<Operator> {
+    let url = Url::parse(path).map_err(|_| Error::ConfigInvalid {
+        message: format!("Invalid OSS url: {path}"),
+    })?;
+
+    let bucket = url.host_str().ok_or_else(|| Error::ConfigInvalid {
+        message: format!("Invalid OSS url: {path}, missing bucket"),
+    })?;
+
+    let mut builder_cfg = cfg.clone();
+    builder_cfg.bucket = bucket.to_string();

Review Comment:
   nit:
   Change to this
   ```
    let builder = cfg.clone().into_builder().bucket(bucket);
       Ok(Operator::new(builder)?.finish())
   ```
   Call method instead of assigning field `bucket` directly looks more safe to me.



-- 
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: issues-unsubscribe@paimon.apache.org

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


Re: [PR] feat: add OSS storage support. [paimon-rust]

Posted by "QuakeWang (via GitHub)" <gi...@apache.org>.
QuakeWang commented on PR #134:
URL: https://github.com/apache/paimon-rust/pull/134#issuecomment-4060857481

   @JingsongLi @luoyuxia PTAL


-- 
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: issues-unsubscribe@paimon.apache.org

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


Re: [PR] feat: add OSS storage support. [paimon-rust]

Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi commented on PR #134:
URL: https://github.com/apache/paimon-rust/pull/134#issuecomment-4065211998

   +1


-- 
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: issues-unsubscribe@paimon.apache.org

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