File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed
main/java/org/apache/doris/datasource/property/storage
test/java/org/apache/doris/datasource/property/storage Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -64,9 +64,14 @@ public class OSSProperties extends AbstractS3CompatibleProperties {
6464 * - <a href="http://oss-cn-shenzhen-internal.aliyuncs.com">...</a> => region = cn-shenzhen
6565 * <p>
6666 * Group(1) captures the region name (e.g., cn-hangzhou).
67+ *<p>
68+ * Support S3 compatible endpoints:<a href="https://help.aliyun.com/zh/oss/developer-reference/
69+ * use-amazon-s3-sdks-to-access-oss">...</a>
70+ * - s3.cn-hangzhou.aliyuncs.com => region = cn-hangzhou
71+ * <p>
6772 */
6873 private static final Pattern ENDPOINT_PATTERN = Pattern
69- .compile ("^(?:https?://)?oss-([a-z0-9-]+?)(?:-internal)?\\ .aliyuncs\\ .com$" );
74+ .compile ("^(?:https?://)?(?:s3 \\ .)? oss-([a-z0-9-]+?)(?:-internal)?\\ .aliyuncs\\ .com$" );
7075
7176 protected OSSProperties (Map <String , String > origProps ) {
7277 super (Type .OSS , origProps );
Original file line number Diff line number Diff line change @@ -107,6 +107,14 @@ public void testGetRegion() throws UserException {
107107 Assertions .assertEquals ("oss-cn-hangzhou.aliyuncs.com" , ossProperties .getEndpoint ());
108108 origProps .put ("oss.endpoint" , "oss-cn-hangzhou-internal.aliyuncs.com" );
109109 Assertions .assertEquals ("cn-hangzhou" , ((OSSProperties ) StorageProperties .createPrimary (origProps )).getRegion ());
110+ origProps .put ("oss.endpoint" , "s3.oss-cn-shanghai.aliyuncs.com" );
111+ Assertions .assertEquals ("cn-shanghai" , ((OSSProperties ) StorageProperties .createPrimary (origProps )).getRegion ());
112+ origProps .put ("oss.endpoint" , "s3.oss-cn-hongkong-internal.aliyuncs.com" );
113+ Assertions .assertEquals ("cn-hongkong" , ((OSSProperties ) StorageProperties .createPrimary (origProps )).getRegion ());
114+ origProps .put ("oss.endpoint" , "https://s3.oss-cn-hongkong-internal.aliyuncs.com" );
115+ Assertions .assertEquals ("cn-hongkong" , ((OSSProperties ) StorageProperties .createPrimary (origProps )).getRegion ());
116+ origProps .put ("oss.endpoint" , "http://s3.oss-cn-hongkong.aliyuncs.com" );
117+ Assertions .assertEquals ("cn-hongkong" , ((OSSProperties ) StorageProperties .createPrimary (origProps )).getRegion ());
110118 }
111119
112120 @ Test
You can’t perform that action at this time.
0 commit comments