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

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


The following commit(s) were added to refs/heads/master by this push:
     new 99778fbe541 [fix](oss)Support Aliyun OSS S3-Compatible Public Endpoint 
Format (eg. s3.oss-cn-xxx.aliyuncs.com) (#51894)
99778fbe541 is described below

commit 99778fbe54181e3c4e1732e8fbd6960e4e5427a1
Author: Calvin Kirs <[email protected]>
AuthorDate: Thu Jun 19 09:50:44 2025 +0800

    [fix](oss)Support Aliyun OSS S3-Compatible Public Endpoint Format (eg. 
s3.oss-cn-xxx.aliyuncs.com) (#51894)
    
    ### What problem does this PR solve?
    
    #50238
    
    FYI
    
https://help.aliyun.com/zh/oss/developer-reference/use-amazon-s3-sdks-to-access-oss
    
    ### Release note
    
    None
---
 .../apache/doris/datasource/property/storage/OSSProperties.java   | 7 ++++++-
 .../doris/datasource/property/storage/OSSPropertiesTest.java      | 8 ++++++++
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/datasource/property/storage/OSSProperties.java
 
b/fe/fe-core/src/main/java/org/apache/doris/datasource/property/storage/OSSProperties.java
index b33644cbbf0..52115433a6e 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/datasource/property/storage/OSSProperties.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/datasource/property/storage/OSSProperties.java
@@ -64,9 +64,14 @@ public class OSSProperties extends 
AbstractS3CompatibleProperties {
      * - <a href="http://oss-cn-shenzhen-internal.aliyuncs.com";>...</a> => 
region = cn-shenzhen
      * <p>
      * Group(1) captures the region name (e.g., cn-hangzhou).
+     *<p>
+     * Support S3 compatible endpoints:<a 
href="https://help.aliyun.com/zh/oss/developer-reference/
+     * use-amazon-s3-sdks-to-access-oss">...</a>
+     * - s3.cn-hangzhou.aliyuncs.com              => region = cn-hangzhou
+     * <p>
      */
     private static final Pattern ENDPOINT_PATTERN = Pattern
-            
.compile("^(?:https?://)?oss-([a-z0-9-]+?)(?:-internal)?\\.aliyuncs\\.com$");
+            
.compile("^(?:https?://)?(?:s3\\.)?oss-([a-z0-9-]+?)(?:-internal)?\\.aliyuncs\\.com$");
 
     protected OSSProperties(Map<String, String> origProps) {
         super(Type.OSS, origProps);
diff --git 
a/fe/fe-core/src/test/java/org/apache/doris/datasource/property/storage/OSSPropertiesTest.java
 
b/fe/fe-core/src/test/java/org/apache/doris/datasource/property/storage/OSSPropertiesTest.java
index 222c0f39f14..68611f48a0e 100644
--- 
a/fe/fe-core/src/test/java/org/apache/doris/datasource/property/storage/OSSPropertiesTest.java
+++ 
b/fe/fe-core/src/test/java/org/apache/doris/datasource/property/storage/OSSPropertiesTest.java
@@ -107,6 +107,14 @@ public class OSSPropertiesTest {
         Assertions.assertEquals("oss-cn-hangzhou.aliyuncs.com", 
ossProperties.getEndpoint());
         origProps.put("oss.endpoint", "oss-cn-hangzhou-internal.aliyuncs.com");
         Assertions.assertEquals("cn-hangzhou", ((OSSProperties) 
StorageProperties.createPrimary(origProps)).getRegion());
+        origProps.put("oss.endpoint", "s3.oss-cn-shanghai.aliyuncs.com");
+        Assertions.assertEquals("cn-shanghai", ((OSSProperties) 
StorageProperties.createPrimary(origProps)).getRegion());
+        origProps.put("oss.endpoint", 
"s3.oss-cn-hongkong-internal.aliyuncs.com");
+        Assertions.assertEquals("cn-hongkong", ((OSSProperties) 
StorageProperties.createPrimary(origProps)).getRegion());
+        origProps.put("oss.endpoint", 
"https://s3.oss-cn-hongkong-internal.aliyuncs.com";);
+        Assertions.assertEquals("cn-hongkong", ((OSSProperties) 
StorageProperties.createPrimary(origProps)).getRegion());
+        origProps.put("oss.endpoint", 
"http://s3.oss-cn-hongkong.aliyuncs.com";);
+        Assertions.assertEquals("cn-hongkong", ((OSSProperties) 
StorageProperties.createPrimary(origProps)).getRegion());
     }
 
     @Test


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

Reply via email to