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

JingsongLi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/paimon.git


The following commit(s) were added to refs/heads/master by this push:
     new 8be22d9791 [cosn] Support alternative COSN authentication options 
(#10130)
8be22d9791 is described below

commit 8be22d97910a5c89fb72cce9f1d6462ba28416b7
Author: Eunbin Son <[email protected]>
AuthorDate: Thu Sep 24 11:44:29 2026 +0900

    [cosn] Support alternative COSN authentication options (#10130)
---
 .../java/org/apache/paimon/cosn/COSNLoader.java    |  4 +-
 .../org/apache/paimon/cosn/COSNLoaderTest.java     | 69 ++++++++++++++++++++++
 2 files changed, 70 insertions(+), 3 deletions(-)

diff --git 
a/paimon-filesystems/paimon-cosn/src/main/java/org/apache/paimon/cosn/COSNLoader.java
 
b/paimon-filesystems/paimon-cosn/src/main/java/org/apache/paimon/cosn/COSNLoader.java
index 887ea479be..96235989fd 100644
--- 
a/paimon-filesystems/paimon-cosn/src/main/java/org/apache/paimon/cosn/COSNLoader.java
+++ 
b/paimon-filesystems/paimon-cosn/src/main/java/org/apache/paimon/cosn/COSNLoader.java
@@ -54,9 +54,7 @@ public class COSNLoader implements FileIOLoader {
     @Override
     public List<String[]> requiredOptions() {
         List<String[]> options = new ArrayList<>();
-        options.add(new String[] {"fs.cosn.bucket.region"});
-        options.add(new String[] {"fs.cosn.userinfo.secretId"});
-        options.add(new String[] {"fs.cosn.userinfo.secretKey"});
+        options.add(new String[] {"fs.cosn.bucket.region", 
"fs.cosn.bucket.endpoint_suffix"});
         return options;
     }
 
diff --git 
a/paimon-filesystems/paimon-cosn/src/test/java/org/apache/paimon/cosn/COSNLoaderTest.java
 
b/paimon-filesystems/paimon-cosn/src/test/java/org/apache/paimon/cosn/COSNLoaderTest.java
new file mode 100644
index 0000000000..3d816d3903
--- /dev/null
+++ 
b/paimon-filesystems/paimon-cosn/src/test/java/org/apache/paimon/cosn/COSNLoaderTest.java
@@ -0,0 +1,69 @@
+/*
+ * 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.
+ */
+
+package org.apache.paimon.cosn;
+
+import org.apache.paimon.catalog.CatalogContext;
+import org.apache.paimon.fs.FileIO;
+import org.apache.paimon.fs.Path;
+import org.apache.paimon.fs.PluginFileIO;
+import org.apache.paimon.options.Options;
+
+import org.junit.jupiter.api.Test;
+
+import java.io.IOException;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+/** Tests for {@link COSNLoader}. */
+public class COSNLoaderTest {
+
+    private static final Path COSN_PATH = new Path("cosn://bucket/path");
+
+    @Test
+    public void testEndpointSuffixSelectsPluginWithDefaultCredentialChain() 
throws IOException {
+        Options options = new Options();
+        options.set("fs.cosn.bucket.endpoint_suffix", "cos.example.com");
+
+        assertCosnPluginSelected(options);
+    }
+
+    @Test
+    public void testEndpointSuffixSelectsPluginWithCustomCredentialProvider() 
throws IOException {
+        Options options = new Options();
+        options.set("fs.cosn.bucket.endpoint_suffix", "cos.example.com");
+        options.set("fs.cosn.credentials.provider", 
"example.CustomCredentialsProvider");
+
+        assertCosnPluginSelected(options);
+    }
+
+    @Test
+    public void testRegionSelectsPluginWithoutStaticCredentials() throws 
IOException {
+        Options options = new Options();
+        options.set("fs.cosn.bucket.region", "ap-test");
+
+        assertCosnPluginSelected(options);
+    }
+
+    private static void assertCosnPluginSelected(Options options) throws 
IOException {
+        FileIO fileIO = FileIO.get(COSN_PATH, CatalogContext.create(options));
+
+        assertThat(fileIO).isInstanceOf(PluginFileIO.class);
+        
assertThat(fileIO.getClass().getEnclosingClass()).isEqualTo(COSNLoader.class);
+    }
+}

Reply via email to