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

morningman 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 f34b46a366e [fix](glue) support amazonaws.com.cn endpoint (#29128)
f34b46a366e is described below

commit f34b46a366ef2ce698df224a50943d91c175fd05
Author: Mingyu Chen <morning...@163.com>
AuthorDate: Fri Dec 29 13:50:30 2023 +0800

    [fix](glue) support amazonaws.com.cn endpoint (#29128)
---
 .../doris/datasource/property/PropertyConverter.java |  6 +++++-
 .../datasource/property/PropertyConverterTest.java   | 20 +++++++++++---------
 2 files changed, 16 insertions(+), 10 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/datasource/property/PropertyConverter.java
 
b/fe/fe-core/src/main/java/org/apache/doris/datasource/property/PropertyConverter.java
index a6cad308839..66396e2c337 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/datasource/property/PropertyConverter.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/datasource/property/PropertyConverter.java
@@ -550,7 +550,11 @@ public class PropertyConverter {
         String region = S3Properties.getRegionOfEndpoint(endpoint);
         if (!Strings.isNullOrEmpty(region)) {
             props.put(S3Properties.REGION, region);
-            String s3Endpoint = "s3." + region + ".amazonaws.com";
+            String suffix = ".amazonaws.com";
+            if (endpoint.endsWith(".amazonaws.com.cn")) {
+                suffix = ".amazonaws.com.cn";
+            }
+            String s3Endpoint = "s3." + region + suffix;
             if (isGlueIceberg) {
                 s3Endpoint = "https://"; + s3Endpoint;
             }
diff --git 
a/fe/fe-core/src/test/java/org/apache/doris/datasource/property/PropertyConverterTest.java
 
b/fe/fe-core/src/test/java/org/apache/doris/datasource/property/PropertyConverterTest.java
index cbd4b9b113d..573ff48b99f 100644
--- 
a/fe/fe-core/src/test/java/org/apache/doris/datasource/property/PropertyConverterTest.java
+++ 
b/fe/fe-core/src/test/java/org/apache/doris/datasource/property/PropertyConverterTest.java
@@ -432,25 +432,27 @@ public class PropertyConverterTest extends 
TestWithFeService {
         String catalogName = "hms_glue_old";
         CreateCatalogStmt analyzedStmt = createStmt(queryOld);
         HMSExternalCatalog catalog = createAndGetCatalog(analyzedStmt, 
catalogName);
-        Map<String, String> properties = 
catalog.getCatalogProperty().getProperties();
+        Map<String, String> properties = catalog.getProperties();
         Assertions.assertEquals(properties.size(), 20);
+        Assertions.assertEquals("s3.us-east-1.amazonaws.com", 
properties.get(S3Properties.ENDPOINT));
 
         Map<String, String> hdProps = 
catalog.getCatalogProperty().getHadoopProperties();
         Assertions.assertEquals(hdProps.size(), 29);
 
         String query = "create catalog hms_glue properties (\n"
-                    + "    'type'='hms',\n"
-                    + "    'hive.metastore.type'='glue',\n"
-                    + "    'hive.metastore.uris' = 
'thrift://172.21.0.1:7004',\n"
-                    + "    'glue.endpoint' = 'glue.us-east-1.amazonaws.com',\n"
-                    + "    'glue.access_key' = 'akk',\n"
-                    + "    'glue.secret_key' = 'skk'\n"
-                    + ");";
+                + "    'type'='hms',\n"
+                + "    'hive.metastore.type'='glue',\n"
+                + "    'hive.metastore.uris' = 'thrift://172.21.0.1:7004',\n"
+                + "    'glue.endpoint' = 'glue.us-east-1.amazonaws.com.cn',\n"
+                + "    'glue.access_key' = 'akk',\n"
+                + "    'glue.secret_key' = 'skk'\n"
+                + ");";
         catalogName = "hms_glue";
         CreateCatalogStmt analyzedStmtNew = createStmt(query);
         HMSExternalCatalog catalogNew = createAndGetCatalog(analyzedStmtNew, 
catalogName);
-        Map<String, String> propertiesNew = 
catalogNew.getCatalogProperty().getProperties();
+        Map<String, String> propertiesNew = catalogNew.getProperties();
         Assertions.assertEquals(propertiesNew.size(), 20);
+        Assertions.assertEquals("s3.us-east-1.amazonaws.com.cn", 
propertiesNew.get(S3Properties.ENDPOINT));
 
         Map<String, String> hdPropsNew = 
catalogNew.getCatalogProperty().getHadoopProperties();
         Assertions.assertEquals(hdPropsNew.size(), 29);


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to