You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by "wsjz (via GitHub)" <gi...@apache.org> on 2023/03/21 13:58:17 UTC

[GitHub] [doris] wsjz opened a new pull request, #18005: [feature-wip](multi-catalog)add properties converter

wsjz opened a new pull request, #18005:
URL: https://github.com/apache/doris/pull/18005

   # Proposed changes
   
   Issue Number: close #xxx
   
   ## Problem summary
   
   Describe your changes.
   
   ## Checklist(Required)
   
   * [ ] Does it affect the original behavior
   * [ ] Has unit tests been added
   * [ ] Has document been added or modified
   * [ ] Does it need to update dependencies
   * [ ] Is this PR support rollback (If NO, please explain WHY)
   
   ## Further comments
   
   If this is a relatively large or complex change, kick off the discussion at [dev@doris.apache.org](mailto:dev@doris.apache.org) by explaining why you chose the solution you did and what alternatives you considered, etc...
   
   


-- 
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: commits-unsubscribe@doris.apache.org

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


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


[GitHub] [doris] wsjz commented on a diff in pull request #18005: [feature-wip](multi-catalog)add properties converter

Posted by "wsjz (via GitHub)" <gi...@apache.org>.
wsjz commented on code in PR #18005:
URL: https://github.com/apache/doris/pull/18005#discussion_r1154370150


##########
docs/zh-CN/docs/lakehouse/multi-catalog/hive.md:
##########
@@ -114,23 +116,85 @@ CREATE CATALOG hive PROPERTIES (
 );
 ```
 
-hive元数据存储在Glue,数据存储在S3,示例如下:
+### Hive On S3
+
+数据存储在S3,示例如下:
 
 ```sql
 CREATE CATALOG hive PROPERTIES (
     "type"="hms",
     "hive.metastore.type" = "glue",
-    "aws.region" = "us-east-1",
-    "aws.glue.access-key" = "ak",
-    "aws.glue.secret-key" = "sk",
-    "AWS_ENDPOINT" = "s3.us-east-1.amazonaws.com",
-    "AWS_REGION" = "us-east-1",
-    "AWS_ACCESS_KEY" = "ak",
-    "AWS_SECRET_KEY" = "sk",
+    "s3.endpoint" = "s3.us-east-1.amazonaws.com",
+    "s3.access-key" = "ak",
+    "s3.secret-key" = "sk"
     "use_path_style" = "true"
 );
 ```
 
+可选属性:
+
+* s3.connection.maximum: s3最大连接数,默认50
+* s3.connection.request.timeout:s3请求超时时间,默认3000ms
+* s3.connection.timeout: s3连接超时时间,默认1000ms
+
+### Hive On OSS
+
+数据存储在OSS,示例如下:
+
+```sql
+CREATE CATALOG hive PROPERTIES (
+    "type"="hms",
+    "hive.metastore.uris" = "thrift://172.21.0.44:7004",
+    "oss.endpoint" = "oss.oss-cn-beijing.aliyuncs.com",
+    "oss.access-key" = "ak",
+    "oss.secret-key" = "sk"
+);
+```
+
+### Hive On OBS
+
+数据存储在OBS,示例如下:
+
+```sql
+CREATE CATALOG hive PROPERTIES (
+    "type"="hms",
+    "hive.metastore.uris" = "thrift://172.21.0.44:7004",
+    "obs.endpoint" = "obs.cn-north-4.myhuaweicloud.com",
+    "obs.access-key" = "ak",
+    "obs.secret-key" = "sk"
+);
+```
+
+### Hive On COS
+
+数据存储在COS,示例如下:
+
+```sql
+CREATE CATALOG hive PROPERTIES (
+    "type"="hms",
+    "hive.metastore.uris" = "thrift://172.21.0.44:7004",
+    "cos.endpoint" = "cos.ap-beijing.myqcloud.com",
+    "cos.access-key" = "ak",
+    "cos.secret-key" = "sk"
+);
+```
+
+### Hive With Glue
+
+元数据存储在Glue,示例如下:
+
+```sql
+CREATE CATALOG hive PROPERTIES (
+    "type"="hms",
+    "hive.metastore.type" = "glue",
+    "glue.endpoint" = "https://glue.us-east-1.amazonaws.com",
+    "glue.access-key" = "ak",
+    "glue.secret-key" = "sk"

Review Comment:
   https://github.com/apache/doris/pull/18287



-- 
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: commits-unsubscribe@doris.apache.org

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


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


[GitHub] [doris] wsjz commented on pull request #18005: [feature-wip](multi-catalog)add properties converter

Posted by "wsjz (via GitHub)" <gi...@apache.org>.
wsjz commented on PR #18005:
URL: https://github.com/apache/doris/pull/18005#issuecomment-1495452441

   run p0


-- 
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: commits-unsubscribe@doris.apache.org

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


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


[GitHub] [doris] wsjz commented on pull request #18005: [feature-wip](multi-catalog)add properties converter

Posted by "wsjz (via GitHub)" <gi...@apache.org>.
wsjz commented on PR #18005:
URL: https://github.com/apache/doris/pull/18005#issuecomment-1491793374

   run buildall


-- 
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: commits-unsubscribe@doris.apache.org

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


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


[GitHub] [doris] wsjz commented on pull request #18005: [feature-wip](multi-catalog)add properties converter

Posted by "wsjz (via GitHub)" <gi...@apache.org>.
wsjz commented on PR #18005:
URL: https://github.com/apache/doris/pull/18005#issuecomment-1495508412

   run clickbench


-- 
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: commits-unsubscribe@doris.apache.org

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


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


[GitHub] [doris] wsjz commented on a diff in pull request #18005: [feature-wip](multi-catalog)add properties converter

Posted by "wsjz (via GitHub)" <gi...@apache.org>.
wsjz commented on code in PR #18005:
URL: https://github.com/apache/doris/pull/18005#discussion_r1148507619


##########
fe/fe-core/src/main/java/org/apache/doris/datasource/property/BeAWSProperties.java:
##########
@@ -0,0 +1,60 @@
+// 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.doris.datasource.property;
+
+import org.apache.doris.datasource.property.constants.S3Properties;
+
+import org.apache.hadoop.fs.obs.OBSConstants;
+import org.apache.hadoop.fs.s3a.Constants;
+
+import java.util.Map;
+
+public class BeAWSProperties {

Review Comment:
   BeS3ClientProperties



-- 
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: commits-unsubscribe@doris.apache.org

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


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


[GitHub] [doris] wsjz commented on pull request #18005: [feature-wip](multi-catalog)add properties converter

Posted by "wsjz (via GitHub)" <gi...@apache.org>.
wsjz commented on PR #18005:
URL: https://github.com/apache/doris/pull/18005#issuecomment-1493327524

   run bulidall


-- 
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: commits-unsubscribe@doris.apache.org

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


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


[GitHub] [doris] wsjz commented on pull request #18005: [feature-wip](multi-catalog)add properties converter

Posted by "wsjz (via GitHub)" <gi...@apache.org>.
wsjz commented on PR #18005:
URL: https://github.com/apache/doris/pull/18005#issuecomment-1495474899

   run p0


-- 
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: commits-unsubscribe@doris.apache.org

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


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


[GitHub] [doris] wsjz commented on a diff in pull request #18005: [feature-wip](multi-catalog)add properties converter

Posted by "wsjz (via GitHub)" <gi...@apache.org>.
wsjz commented on code in PR #18005:
URL: https://github.com/apache/doris/pull/18005#discussion_r1148677243


##########
fe/fe-core/src/main/java/org/apache/doris/datasource/property/BeAWSProperties.java:
##########
@@ -0,0 +1,60 @@
+// 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.doris.datasource.property;
+
+import org.apache.doris.datasource.property.constants.S3Properties;
+
+import org.apache.hadoop.fs.obs.OBSConstants;
+import org.apache.hadoop.fs.s3a.Constants;
+
+import java.util.Map;
+
+public class BeAWSProperties {
+
+    public static void setBeAWSPropertiesFromS3(Map<String, String> properties) {
+        String endpoint = properties.get(Constants.ENDPOINT);
+        properties.put(S3Properties.Environment.ENDPOINT, endpoint);
+        String region = PropertyConverter.getRegionOfEndpoint(endpoint);
+        properties.put(S3Properties.Environment.REGION, properties.getOrDefault(Constants.AWS_REGION, region));
+        if (properties.containsKey(Constants.ACCESS_KEY)) {
+            properties.put(S3Properties.Environment.ACCESS_KEY, properties.get(Constants.ACCESS_KEY));
+        }
+        if (properties.containsKey(Constants.SECRET_KEY)) {
+            properties.put(S3Properties.Environment.SECRET_KEY, properties.get(Constants.SECRET_KEY));
+        }
+        if (properties.containsKey(Constants.SESSION_TOKEN)) {
+            properties.put(S3Properties.Environment.TOKEN, properties.get(Constants.SESSION_TOKEN));
+        }
+    }
+
+    public static void setBeAWSPropertiesFromObs(Map<String, String> properties) {
+        String endpoint = properties.get(OBSConstants.ENDPOINT);
+        properties.put(S3Properties.Environment.ENDPOINT, endpoint);
+        String region = PropertyConverter.getRegionOfEndpoint(endpoint);
+        properties.put(S3Properties.Environment.REGION, region);
+        if (properties.containsKey(OBSConstants.ACCESS_KEY)) {
+            properties.put(S3Properties.Environment.ACCESS_KEY, properties.get(OBSConstants.ACCESS_KEY));
+        }
+        if (properties.containsKey(OBSConstants.SECRET_KEY)) {
+            properties.put(S3Properties.Environment.SECRET_KEY, properties.get(OBSConstants.SECRET_KEY));
+        }
+        if (properties.containsKey("fs.obs.session.token")) {

Review Comment:
   define it in ObsProperties as our properties



-- 
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: commits-unsubscribe@doris.apache.org

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


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


[GitHub] [doris] wsjz commented on pull request #18005: [feature-wip](multi-catalog)add properties converter

Posted by "wsjz (via GitHub)" <gi...@apache.org>.
wsjz commented on PR #18005:
URL: https://github.com/apache/doris/pull/18005#issuecomment-1491718126

   run buildall


-- 
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: commits-unsubscribe@doris.apache.org

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


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


[GitHub] [doris] wsjz commented on pull request #18005: [feature-wip](multi-catalog)add properties converter

Posted by "wsjz (via GitHub)" <gi...@apache.org>.
wsjz commented on PR #18005:
URL: https://github.com/apache/doris/pull/18005#issuecomment-1494334487

   run p0


-- 
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: commits-unsubscribe@doris.apache.org

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


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


[GitHub] [doris] wsjz commented on pull request #18005: [feature-wip](multi-catalog)add properties converter

Posted by "wsjz (via GitHub)" <gi...@apache.org>.
wsjz commented on PR #18005:
URL: https://github.com/apache/doris/pull/18005#issuecomment-1495256239

   run buildall


-- 
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: commits-unsubscribe@doris.apache.org

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


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


[GitHub] [doris] wsjz commented on pull request #18005: [feature-wip](multi-catalog)add properties converter

Posted by "wsjz (via GitHub)" <gi...@apache.org>.
wsjz commented on PR #18005:
URL: https://github.com/apache/doris/pull/18005#issuecomment-1493852105

   run buildall


-- 
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: commits-unsubscribe@doris.apache.org

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


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


[GitHub] [doris] wsjz commented on pull request #18005: [feature-wip](multi-catalog)add properties converter

Posted by "wsjz (via GitHub)" <gi...@apache.org>.
wsjz commented on PR #18005:
URL: https://github.com/apache/doris/pull/18005#issuecomment-1495536454

   run buildall


-- 
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: commits-unsubscribe@doris.apache.org

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


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


[GitHub] [doris] wsjz commented on pull request #18005: [feature-wip](multi-catalog)add properties converter

Posted by "wsjz (via GitHub)" <gi...@apache.org>.
wsjz commented on PR #18005:
URL: https://github.com/apache/doris/pull/18005#issuecomment-1495212075

   run clickbench


-- 
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: commits-unsubscribe@doris.apache.org

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


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


[GitHub] [doris] wsjz commented on pull request #18005: [feature-wip](multi-catalog)add properties converter

Posted by "wsjz (via GitHub)" <gi...@apache.org>.
wsjz commented on PR #18005:
URL: https://github.com/apache/doris/pull/18005#issuecomment-1493778772

   run buildall


-- 
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: commits-unsubscribe@doris.apache.org

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


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


[GitHub] [doris] morningman merged pull request #18005: [feature-wip](multi-catalog)add properties converter

Posted by "morningman (via GitHub)" <gi...@apache.org>.
morningman merged PR #18005:
URL: https://github.com/apache/doris/pull/18005


-- 
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: commits-unsubscribe@doris.apache.org

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


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


[GitHub] [doris] wsjz commented on pull request #18005: [feature-wip](multi-catalog)add properties converter

Posted by "wsjz (via GitHub)" <gi...@apache.org>.
wsjz commented on PR #18005:
URL: https://github.com/apache/doris/pull/18005#issuecomment-1495453979

   run p0


-- 
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: commits-unsubscribe@doris.apache.org

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


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


[GitHub] [doris] wsjz commented on pull request #18005: [feature-wip](multi-catalog)add properties converter

Posted by "wsjz (via GitHub)" <gi...@apache.org>.
wsjz commented on PR #18005:
URL: https://github.com/apache/doris/pull/18005#issuecomment-1493015471

   run buildall


-- 
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: commits-unsubscribe@doris.apache.org

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


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


[GitHub] [doris] wsjz commented on pull request #18005: [feature-wip](multi-catalog)add properties converter

Posted by "wsjz (via GitHub)" <gi...@apache.org>.
wsjz commented on PR #18005:
URL: https://github.com/apache/doris/pull/18005#issuecomment-1493721249

   run buildall


-- 
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: commits-unsubscribe@doris.apache.org

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


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


[GitHub] [doris] wsjz commented on a diff in pull request #18005: [feature-wip](multi-catalog)add properties converter

Posted by "wsjz (via GitHub)" <gi...@apache.org>.
wsjz commented on code in PR #18005:
URL: https://github.com/apache/doris/pull/18005#discussion_r1148508126


##########
fe/fe-core/src/main/java/org/apache/doris/datasource/property/BeAWSProperties.java:
##########
@@ -0,0 +1,60 @@
+// 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.doris.datasource.property;
+
+import org.apache.doris.datasource.property.constants.S3Properties;
+
+import org.apache.hadoop.fs.obs.OBSConstants;
+import org.apache.hadoop.fs.s3a.Constants;
+
+import java.util.Map;
+
+public class BeAWSProperties {
+
+    public static void setBeAWSPropertiesFromS3(Map<String, String> properties) {
+        String endpoint = properties.get(Constants.ENDPOINT);
+        properties.put(S3Properties.Environment.ENDPOINT, endpoint);
+        String region = PropertyConverter.getRegionOfEndpoint(endpoint);
+        properties.put(S3Properties.Environment.REGION, properties.getOrDefault(Constants.AWS_REGION, region));
+        if (properties.containsKey(Constants.ACCESS_KEY)) {
+            properties.put(S3Properties.Environment.ACCESS_KEY, properties.get(Constants.ACCESS_KEY));
+        }
+        if (properties.containsKey(Constants.SECRET_KEY)) {
+            properties.put(S3Properties.Environment.SECRET_KEY, properties.get(Constants.SECRET_KEY));
+        }
+        if (properties.containsKey(Constants.SESSION_TOKEN)) {
+            properties.put(S3Properties.Environment.TOKEN, properties.get(Constants.SESSION_TOKEN));
+        }
+    }
+
+    public static void setBeAWSPropertiesFromObs(Map<String, String> properties) {
+        String endpoint = properties.get(OBSConstants.ENDPOINT);
+        properties.put(S3Properties.Environment.ENDPOINT, endpoint);
+        String region = PropertyConverter.getRegionOfEndpoint(endpoint);
+        properties.put(S3Properties.Environment.REGION, region);
+        if (properties.containsKey(OBSConstants.ACCESS_KEY)) {
+            properties.put(S3Properties.Environment.ACCESS_KEY, properties.get(OBSConstants.ACCESS_KEY));
+        }
+        if (properties.containsKey(OBSConstants.SECRET_KEY)) {
+            properties.put(S3Properties.Environment.SECRET_KEY, properties.get(OBSConstants.SECRET_KEY));
+        }
+        if (properties.containsKey("fs.obs.session.token")) {

Review Comment:
   the OBSConstants bind to "fs.obs.credentials.provider" in huawei obs client



-- 
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: commits-unsubscribe@doris.apache.org

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


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


[GitHub] [doris] hello-stephen commented on pull request #18005: [feature-wip](multi-catalog)add properties converter

Posted by "hello-stephen (via GitHub)" <gi...@apache.org>.
hello-stephen commented on PR #18005:
URL: https://github.com/apache/doris/pull/18005#issuecomment-1491937993

   TeamCity pipeline, clickbench performance test result:
    the sum of best hot time: 34.49 seconds
    stream load tsv:          457 seconds loaded 74807831229 Bytes, about 156 MB/s
    stream load json:         24 seconds loaded 2358488459 Bytes, about 93 MB/s
    stream load orc:          73 seconds loaded 1101869774 Bytes, about 14 MB/s
    stream load parquet:          31 seconds loaded 861443392 Bytes, about 26 MB/s
    https://doris-community-test-1308700295.cos.ap-hongkong.myqcloud.com/tmp/20230331133638_clickbench_pr_123468.html


-- 
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: commits-unsubscribe@doris.apache.org

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


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


[GitHub] [doris] wsjz commented on pull request #18005: [feature-wip](multi-catalog)add properties converter

Posted by "wsjz (via GitHub)" <gi...@apache.org>.
wsjz commented on PR #18005:
URL: https://github.com/apache/doris/pull/18005#issuecomment-1496831331

   run buildall


-- 
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: commits-unsubscribe@doris.apache.org

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


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


[GitHub] [doris] morningman commented on a diff in pull request #18005: [feature-wip](multi-catalog)add properties converter

Posted by "morningman (via GitHub)" <gi...@apache.org>.
morningman commented on code in PR #18005:
URL: https://github.com/apache/doris/pull/18005#discussion_r1148393130


##########
fe/fe-core/src/main/java/org/apache/doris/datasource/property/BeAWSProperties.java:
##########
@@ -0,0 +1,60 @@
+// 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.doris.datasource.property;
+
+import org.apache.doris.datasource.property.constants.S3Properties;
+
+import org.apache.hadoop.fs.obs.OBSConstants;
+import org.apache.hadoop.fs.s3a.Constants;
+
+import java.util.Map;
+
+public class BeAWSProperties {
+
+    public static void setBeAWSPropertiesFromS3(Map<String, String> properties) {
+        String endpoint = properties.get(Constants.ENDPOINT);
+        properties.put(S3Properties.Environment.ENDPOINT, endpoint);
+        String region = PropertyConverter.getRegionOfEndpoint(endpoint);
+        properties.put(S3Properties.Environment.REGION, properties.getOrDefault(Constants.AWS_REGION, region));
+        if (properties.containsKey(Constants.ACCESS_KEY)) {
+            properties.put(S3Properties.Environment.ACCESS_KEY, properties.get(Constants.ACCESS_KEY));
+        }
+        if (properties.containsKey(Constants.SECRET_KEY)) {
+            properties.put(S3Properties.Environment.SECRET_KEY, properties.get(Constants.SECRET_KEY));
+        }
+        if (properties.containsKey(Constants.SESSION_TOKEN)) {
+            properties.put(S3Properties.Environment.TOKEN, properties.get(Constants.SESSION_TOKEN));
+        }
+    }
+
+    public static void setBeAWSPropertiesFromObs(Map<String, String> properties) {
+        String endpoint = properties.get(OBSConstants.ENDPOINT);
+        properties.put(S3Properties.Environment.ENDPOINT, endpoint);
+        String region = PropertyConverter.getRegionOfEndpoint(endpoint);
+        properties.put(S3Properties.Environment.REGION, region);
+        if (properties.containsKey(OBSConstants.ACCESS_KEY)) {
+            properties.put(S3Properties.Environment.ACCESS_KEY, properties.get(OBSConstants.ACCESS_KEY));
+        }
+        if (properties.containsKey(OBSConstants.SECRET_KEY)) {
+            properties.put(S3Properties.Environment.SECRET_KEY, properties.get(OBSConstants.SECRET_KEY));
+        }
+        if (properties.containsKey("fs.obs.session.token")) {

Review Comment:
   Why not define `fs.obs.session.token` in `OBSConstants`?



##########
fe/fe-core/src/main/java/org/apache/doris/datasource/property/PropertyConverter.java:
##########
@@ -0,0 +1,337 @@
+// 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.doris.datasource.property;
+
+import org.apache.doris.datasource.credentials.CloudCredential;
+import org.apache.doris.datasource.credentials.CloudCredentialWithEndpoint;
+import org.apache.doris.datasource.property.constants.CosProperties;
+import org.apache.doris.datasource.property.constants.DLFProperties;
+import org.apache.doris.datasource.property.constants.GlueProperties;
+import org.apache.doris.datasource.property.constants.HMSProperties;
+import org.apache.doris.datasource.property.constants.ObsProperties;
+import org.apache.doris.datasource.property.constants.OssProperties;
+import org.apache.doris.datasource.property.constants.S3Properties;
+
+import com.aliyun.datalake.metastore.common.DataLakeConfig;
+import com.amazonaws.glue.catalog.util.AWSGlueConfig;
+import com.google.common.base.Strings;
+import com.google.common.collect.Maps;
+import org.apache.hadoop.fs.obs.OBSConstants;
+import org.apache.hadoop.fs.s3a.Constants;
+import org.apache.hadoop.fs.s3a.S3AFileSystem;
+import org.apache.hadoop.fs.s3a.TemporaryAWSCredentialsProvider;
+import org.apache.hadoop.hive.conf.HiveConf;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
+import java.util.Map;
+
+public class PropertyConverter {
+
+    private static final Logger LOG = LogManager.getLogger(PropertyConverter.class);
+    public static final String USE_PATH_STYLE = "use_path_style";
+
+    public static String getRegionOfEndpoint(String endpoint) {
+        String[] endpointSplit = endpoint.split("\\.");
+        if (endpointSplit.length < 2) {
+            throw new IllegalArgumentException("Need endpoint with region: " + endpoint);
+        }
+        return endpointSplit[1];
+    }
+
+    public static Map<String, String> metaConvert(Map<String, String> props) {
+        if (props.containsKey(GlueProperties.ENDPOINT)
+                || props.containsKey(AWSGlueConfig.AWS_GLUE_ENDPOINT)) {
+            return convertToGlueProperties(props, GlueProperties.getCredential(props));
+        } else if (props.containsKey(DLFProperties.ENDPOINT)
+                || props.containsKey(DataLakeConfig.CATALOG_ENDPOINT)) {
+            return convertToDLFProperties(props, DLFProperties.getCredential(props));
+        }
+        return props;
+    }
+
+    /**
+     * Convert properties defined at doris to FE S3 client properties and BE S3 client properties
+     */
+    public static Map<String, String> storageConvert(Map<String, String> props) {
+        if (props.containsKey(S3Properties.Environment.ENDPOINT)) {
+            // compatible with the s3,obs,oss,cos when they use aws client.
+            return convertToS3EnvProperties(props, S3Properties.getCompatibleCredential(props));
+        } else if (props.containsKey(S3Properties.ENDPOINT)) {
+            return convertToS3Properties(props, S3Properties.getCredential(props));
+        } else if (props.containsKey(ObsProperties.ENDPOINT)) {
+            return convertToOBSProperties(props, ObsProperties.getCredential(props));
+        } else if (props.containsKey(OssProperties.ENDPOINT)) {
+            return convertToOSSProperties(props, OssProperties.getCredential(props));
+        } else if (props.containsKey(CosProperties.ENDPOINT)) {
+            return convertToCOSProperties(props, CosProperties.getCredential(props));
+        }
+        return props;
+    }
+
+
+    private static Map<String, String> convertToOBSProperties(Map<String, String> props,
+                                                              CloudCredential credential) {
+        Map<String, String> obsProperties = Maps.newHashMap();
+        obsProperties.put(OBSConstants.ENDPOINT, props.get(ObsProperties.ENDPOINT));
+        obsProperties.put("fs.obs.impl.disable.cache", "true");
+        if (credential.isWhole()) {
+            obsProperties.put(OBSConstants.ACCESS_KEY, credential.getAccessKey());
+            obsProperties.put(OBSConstants.SECRET_KEY, credential.getSecretKey());
+        }
+        if (credential.isTemporary()) {
+            obsProperties.put("fs.obs.session.token", credential.getSessionToken());
+        }
+        for (Map.Entry<String, String> entry : props.entrySet()) {
+            if (entry.getKey().startsWith(ObsProperties.OBS_FS_PREFIX)) {
+                obsProperties.put(entry.getKey(), entry.getValue());
+            }
+        }
+        BeAWSProperties.setBeAWSPropertiesFromObs(obsProperties);
+        return obsProperties;
+    }
+
+    private static Map<String, String> convertToS3EnvProperties(Map<String, String> properties,

Review Comment:
   ```suggestion
       private static Map<String, String> convertToS3HadoopFSProperties(Map<String, String> properties,
   ```



##########
fe/fe-core/src/main/java/org/apache/doris/datasource/property/BeAWSProperties.java:
##########
@@ -0,0 +1,60 @@
+// 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.doris.datasource.property;
+
+import org.apache.doris.datasource.property.constants.S3Properties;
+
+import org.apache.hadoop.fs.obs.OBSConstants;
+import org.apache.hadoop.fs.s3a.Constants;
+
+import java.util.Map;
+
+public class BeAWSProperties {

Review Comment:
   How about naming it as `S3ClientProperties`?
   And better add some comment to this class



##########
fe/fe-core/src/main/java/org/apache/doris/datasource/property/PropertyConverter.java:
##########
@@ -0,0 +1,337 @@
+// 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.doris.datasource.property;
+
+import org.apache.doris.datasource.credentials.CloudCredential;
+import org.apache.doris.datasource.credentials.CloudCredentialWithEndpoint;
+import org.apache.doris.datasource.property.constants.CosProperties;
+import org.apache.doris.datasource.property.constants.DLFProperties;
+import org.apache.doris.datasource.property.constants.GlueProperties;
+import org.apache.doris.datasource.property.constants.HMSProperties;
+import org.apache.doris.datasource.property.constants.ObsProperties;
+import org.apache.doris.datasource.property.constants.OssProperties;
+import org.apache.doris.datasource.property.constants.S3Properties;
+
+import com.aliyun.datalake.metastore.common.DataLakeConfig;
+import com.amazonaws.glue.catalog.util.AWSGlueConfig;
+import com.google.common.base.Strings;
+import com.google.common.collect.Maps;
+import org.apache.hadoop.fs.obs.OBSConstants;
+import org.apache.hadoop.fs.s3a.Constants;
+import org.apache.hadoop.fs.s3a.S3AFileSystem;
+import org.apache.hadoop.fs.s3a.TemporaryAWSCredentialsProvider;
+import org.apache.hadoop.hive.conf.HiveConf;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
+import java.util.Map;
+
+public class PropertyConverter {
+
+    private static final Logger LOG = LogManager.getLogger(PropertyConverter.class);
+    public static final String USE_PATH_STYLE = "use_path_style";
+
+    public static String getRegionOfEndpoint(String endpoint) {
+        String[] endpointSplit = endpoint.split("\\.");
+        if (endpointSplit.length < 2) {
+            throw new IllegalArgumentException("Need endpoint with region: " + endpoint);
+        }
+        return endpointSplit[1];
+    }
+
+    public static Map<String, String> metaConvert(Map<String, String> props) {
+        if (props.containsKey(GlueProperties.ENDPOINT)
+                || props.containsKey(AWSGlueConfig.AWS_GLUE_ENDPOINT)) {
+            return convertToGlueProperties(props, GlueProperties.getCredential(props));
+        } else if (props.containsKey(DLFProperties.ENDPOINT)
+                || props.containsKey(DataLakeConfig.CATALOG_ENDPOINT)) {
+            return convertToDLFProperties(props, DLFProperties.getCredential(props));
+        }
+        return props;
+    }
+
+    /**
+     * Convert properties defined at doris to FE S3 client properties and BE S3 client properties
+     */
+    public static Map<String, String> storageConvert(Map<String, String> props) {

Review Comment:
   ```suggestion
       public static Map<String, String> convertToHadoopFSProperties(Map<String, String> props) {
   ```



-- 
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: commits-unsubscribe@doris.apache.org

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


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


[GitHub] [doris] wsjz commented on a diff in pull request #18005: [feature-wip](multi-catalog)add properties converter

Posted by "wsjz (via GitHub)" <gi...@apache.org>.
wsjz commented on code in PR #18005:
URL: https://github.com/apache/doris/pull/18005#discussion_r1148508126


##########
fe/fe-core/src/main/java/org/apache/doris/datasource/property/BeAWSProperties.java:
##########
@@ -0,0 +1,60 @@
+// 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.doris.datasource.property;
+
+import org.apache.doris.datasource.property.constants.S3Properties;
+
+import org.apache.hadoop.fs.obs.OBSConstants;
+import org.apache.hadoop.fs.s3a.Constants;
+
+import java.util.Map;
+
+public class BeAWSProperties {
+
+    public static void setBeAWSPropertiesFromS3(Map<String, String> properties) {
+        String endpoint = properties.get(Constants.ENDPOINT);
+        properties.put(S3Properties.Environment.ENDPOINT, endpoint);
+        String region = PropertyConverter.getRegionOfEndpoint(endpoint);
+        properties.put(S3Properties.Environment.REGION, properties.getOrDefault(Constants.AWS_REGION, region));
+        if (properties.containsKey(Constants.ACCESS_KEY)) {
+            properties.put(S3Properties.Environment.ACCESS_KEY, properties.get(Constants.ACCESS_KEY));
+        }
+        if (properties.containsKey(Constants.SECRET_KEY)) {
+            properties.put(S3Properties.Environment.SECRET_KEY, properties.get(Constants.SECRET_KEY));
+        }
+        if (properties.containsKey(Constants.SESSION_TOKEN)) {
+            properties.put(S3Properties.Environment.TOKEN, properties.get(Constants.SESSION_TOKEN));
+        }
+    }
+
+    public static void setBeAWSPropertiesFromObs(Map<String, String> properties) {
+        String endpoint = properties.get(OBSConstants.ENDPOINT);
+        properties.put(S3Properties.Environment.ENDPOINT, endpoint);
+        String region = PropertyConverter.getRegionOfEndpoint(endpoint);
+        properties.put(S3Properties.Environment.REGION, region);
+        if (properties.containsKey(OBSConstants.ACCESS_KEY)) {
+            properties.put(S3Properties.Environment.ACCESS_KEY, properties.get(OBSConstants.ACCESS_KEY));
+        }
+        if (properties.containsKey(OBSConstants.SECRET_KEY)) {
+            properties.put(S3Properties.Environment.SECRET_KEY, properties.get(OBSConstants.SECRET_KEY));
+        }
+        if (properties.containsKey("fs.obs.session.token")) {

Review Comment:
   the OBSConstants bind to "fs.obs.credentials.provider" in huawei obs client
   so they make it protected access



##########
fe/fe-core/src/main/java/org/apache/doris/datasource/property/BeAWSProperties.java:
##########
@@ -0,0 +1,60 @@
+// 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.doris.datasource.property;
+
+import org.apache.doris.datasource.property.constants.S3Properties;
+
+import org.apache.hadoop.fs.obs.OBSConstants;
+import org.apache.hadoop.fs.s3a.Constants;
+
+import java.util.Map;
+
+public class BeAWSProperties {
+
+    public static void setBeAWSPropertiesFromS3(Map<String, String> properties) {
+        String endpoint = properties.get(Constants.ENDPOINT);
+        properties.put(S3Properties.Environment.ENDPOINT, endpoint);
+        String region = PropertyConverter.getRegionOfEndpoint(endpoint);
+        properties.put(S3Properties.Environment.REGION, properties.getOrDefault(Constants.AWS_REGION, region));
+        if (properties.containsKey(Constants.ACCESS_KEY)) {
+            properties.put(S3Properties.Environment.ACCESS_KEY, properties.get(Constants.ACCESS_KEY));
+        }
+        if (properties.containsKey(Constants.SECRET_KEY)) {
+            properties.put(S3Properties.Environment.SECRET_KEY, properties.get(Constants.SECRET_KEY));
+        }
+        if (properties.containsKey(Constants.SESSION_TOKEN)) {
+            properties.put(S3Properties.Environment.TOKEN, properties.get(Constants.SESSION_TOKEN));
+        }
+    }
+
+    public static void setBeAWSPropertiesFromObs(Map<String, String> properties) {
+        String endpoint = properties.get(OBSConstants.ENDPOINT);
+        properties.put(S3Properties.Environment.ENDPOINT, endpoint);
+        String region = PropertyConverter.getRegionOfEndpoint(endpoint);
+        properties.put(S3Properties.Environment.REGION, region);
+        if (properties.containsKey(OBSConstants.ACCESS_KEY)) {
+            properties.put(S3Properties.Environment.ACCESS_KEY, properties.get(OBSConstants.ACCESS_KEY));
+        }
+        if (properties.containsKey(OBSConstants.SECRET_KEY)) {
+            properties.put(S3Properties.Environment.SECRET_KEY, properties.get(OBSConstants.SECRET_KEY));
+        }
+        if (properties.containsKey("fs.obs.session.token")) {

Review Comment:
   the OBSConstants bind to "fs.obs.credentials.provider" in huawei obs client
   so they make it as protected access



-- 
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: commits-unsubscribe@doris.apache.org

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


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


[GitHub] [doris] wsjz commented on a diff in pull request #18005: [feature-wip](multi-catalog)add properties converter

Posted by "wsjz (via GitHub)" <gi...@apache.org>.
wsjz commented on code in PR #18005:
URL: https://github.com/apache/doris/pull/18005#discussion_r1148508126


##########
fe/fe-core/src/main/java/org/apache/doris/datasource/property/BeAWSProperties.java:
##########
@@ -0,0 +1,60 @@
+// 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.doris.datasource.property;
+
+import org.apache.doris.datasource.property.constants.S3Properties;
+
+import org.apache.hadoop.fs.obs.OBSConstants;
+import org.apache.hadoop.fs.s3a.Constants;
+
+import java.util.Map;
+
+public class BeAWSProperties {
+
+    public static void setBeAWSPropertiesFromS3(Map<String, String> properties) {
+        String endpoint = properties.get(Constants.ENDPOINT);
+        properties.put(S3Properties.Environment.ENDPOINT, endpoint);
+        String region = PropertyConverter.getRegionOfEndpoint(endpoint);
+        properties.put(S3Properties.Environment.REGION, properties.getOrDefault(Constants.AWS_REGION, region));
+        if (properties.containsKey(Constants.ACCESS_KEY)) {
+            properties.put(S3Properties.Environment.ACCESS_KEY, properties.get(Constants.ACCESS_KEY));
+        }
+        if (properties.containsKey(Constants.SECRET_KEY)) {
+            properties.put(S3Properties.Environment.SECRET_KEY, properties.get(Constants.SECRET_KEY));
+        }
+        if (properties.containsKey(Constants.SESSION_TOKEN)) {
+            properties.put(S3Properties.Environment.TOKEN, properties.get(Constants.SESSION_TOKEN));
+        }
+    }
+
+    public static void setBeAWSPropertiesFromObs(Map<String, String> properties) {
+        String endpoint = properties.get(OBSConstants.ENDPOINT);
+        properties.put(S3Properties.Environment.ENDPOINT, endpoint);
+        String region = PropertyConverter.getRegionOfEndpoint(endpoint);
+        properties.put(S3Properties.Environment.REGION, region);
+        if (properties.containsKey(OBSConstants.ACCESS_KEY)) {
+            properties.put(S3Properties.Environment.ACCESS_KEY, properties.get(OBSConstants.ACCESS_KEY));
+        }
+        if (properties.containsKey(OBSConstants.SECRET_KEY)) {
+            properties.put(S3Properties.Environment.SECRET_KEY, properties.get(OBSConstants.SECRET_KEY));
+        }
+        if (properties.containsKey("fs.obs.session.token")) {

Review Comment:
   The token property of OBSConstant is bind to "fs.obs.credentials.provider" in huawei obs client
   so they make it as protected access



-- 
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: commits-unsubscribe@doris.apache.org

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


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


[GitHub] [doris] wsjz commented on pull request #18005: [feature-wip](multi-catalog)add properties converter

Posted by "wsjz (via GitHub)" <gi...@apache.org>.
wsjz commented on PR #18005:
URL: https://github.com/apache/doris/pull/18005#issuecomment-1493720933

   run p0


-- 
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: commits-unsubscribe@doris.apache.org

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


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


[GitHub] [doris] wsjz commented on pull request #18005: [feature-wip](multi-catalog)add properties converter

Posted by "wsjz (via GitHub)" <gi...@apache.org>.
wsjz commented on PR #18005:
URL: https://github.com/apache/doris/pull/18005#issuecomment-1493328733

   run buildall


-- 
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: commits-unsubscribe@doris.apache.org

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


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


[GitHub] [doris] github-actions[bot] commented on pull request #18005: [feature-wip](multi-catalog)add properties converter

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #18005:
URL: https://github.com/apache/doris/pull/18005#issuecomment-1497730971

   PR approved by anyone and no changes requested.


-- 
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: commits-unsubscribe@doris.apache.org

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


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


[GitHub] [doris] wsjz commented on pull request #18005: [feature-wip](multi-catalog)add properties converter

Posted by "wsjz (via GitHub)" <gi...@apache.org>.
wsjz commented on PR #18005:
URL: https://github.com/apache/doris/pull/18005#issuecomment-1494697255

   run buildall


-- 
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: commits-unsubscribe@doris.apache.org

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


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


[GitHub] [doris] wsjz commented on pull request #18005: [feature-wip](multi-catalog)add properties converter

Posted by "wsjz (via GitHub)" <gi...@apache.org>.
wsjz commented on PR #18005:
URL: https://github.com/apache/doris/pull/18005#issuecomment-1495421878

   run p0


-- 
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: commits-unsubscribe@doris.apache.org

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


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


[GitHub] [doris] wsjz commented on pull request #18005: [feature-wip](multi-catalog)add properties converter

Posted by "wsjz (via GitHub)" <gi...@apache.org>.
wsjz commented on PR #18005:
URL: https://github.com/apache/doris/pull/18005#issuecomment-1495213926

   run p1


-- 
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: commits-unsubscribe@doris.apache.org

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


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


[GitHub] [doris] morningman commented on a diff in pull request #18005: [feature-wip](multi-catalog)add properties converter

Posted by "morningman (via GitHub)" <gi...@apache.org>.
morningman commented on code in PR #18005:
URL: https://github.com/apache/doris/pull/18005#discussion_r1152765690


##########
docs/zh-CN/docs/lakehouse/multi-catalog/hive.md:
##########
@@ -114,23 +116,85 @@ CREATE CATALOG hive PROPERTIES (
 );
 ```
 
-hive元数据存储在Glue,数据存储在S3,示例如下:
+### Hive On S3
+
+数据存储在S3,示例如下:
 
 ```sql
 CREATE CATALOG hive PROPERTIES (
     "type"="hms",
     "hive.metastore.type" = "glue",
-    "aws.region" = "us-east-1",
-    "aws.glue.access-key" = "ak",
-    "aws.glue.secret-key" = "sk",
-    "AWS_ENDPOINT" = "s3.us-east-1.amazonaws.com",
-    "AWS_REGION" = "us-east-1",
-    "AWS_ACCESS_KEY" = "ak",
-    "AWS_SECRET_KEY" = "sk",
+    "s3.endpoint" = "s3.us-east-1.amazonaws.com",
+    "s3.access-key" = "ak",
+    "s3.secret-key" = "sk"
     "use_path_style" = "true"
 );
 ```
 
+可选属性:
+
+* s3.connection.maximum: s3最大连接数,默认50
+* s3.connection.request.timeout:s3请求超时时间,默认3000ms
+* s3.connection.timeout: s3连接超时时间,默认1000ms
+
+### Hive On OSS
+
+数据存储在OSS,示例如下:
+
+```sql
+CREATE CATALOG hive PROPERTIES (
+    "type"="hms",
+    "hive.metastore.uris" = "thrift://172.21.0.44:7004",
+    "oss.endpoint" = "oss.oss-cn-beijing.aliyuncs.com",
+    "oss.access-key" = "ak",
+    "oss.secret-key" = "sk"
+);
+```
+
+### Hive On OBS
+
+数据存储在OBS,示例如下:
+
+```sql
+CREATE CATALOG hive PROPERTIES (
+    "type"="hms",
+    "hive.metastore.uris" = "thrift://172.21.0.44:7004",
+    "obs.endpoint" = "obs.cn-north-4.myhuaweicloud.com",
+    "obs.access-key" = "ak",
+    "obs.secret-key" = "sk"
+);
+```
+
+### Hive On COS
+
+数据存储在COS,示例如下:
+
+```sql
+CREATE CATALOG hive PROPERTIES (
+    "type"="hms",
+    "hive.metastore.uris" = "thrift://172.21.0.44:7004",
+    "cos.endpoint" = "cos.ap-beijing.myqcloud.com",
+    "cos.access-key" = "ak",
+    "cos.secret-key" = "sk"
+);
+```
+
+### Hive With Glue
+
+元数据存储在Glue,示例如下:
+
+```sql
+CREATE CATALOG hive PROPERTIES (
+    "type"="hms",
+    "hive.metastore.type" = "glue",
+    "glue.endpoint" = "https://glue.us-east-1.amazonaws.com",
+    "glue.access-key" = "ak",
+    "glue.secret-key" = "sk"

Review Comment:
   数据相关的信息也要给全



##########
fe/fe-core/src/main/java/org/apache/doris/datasource/iceberg/IcebergGlueExternalCatalog.java:
##########
@@ -31,26 +34,27 @@
 
 public class IcebergGlueExternalCatalog extends IcebergExternalCatalog {
 
+    // As a default placeholder. The path just use for 'create table', query stmt will not use it.
+    private static final String CHECKED_WAREHOUSE = "s3://doris";
+
     public IcebergGlueExternalCatalog(long catalogId, String name, String resource, Map<String, String> props) {
         super(catalogId, name);
+        props = PropertyConverter.convertToMetaProperties(props);
         catalogProperty = new CatalogProperty(resource, props);
     }
 
     @Override
     protected void initLocalObjectsImpl() {
         icebergCatalogType = ICEBERG_GLUE;
         GlueCatalog glueCatalog = new GlueCatalog();
-        // AWSGlueAsync glueClient;
         Configuration conf = setGlueProperties(getConfiguration());
         glueCatalog.setConf(conf);
         // initialize glue catalog
-        Map<String, String> catalogProperties = catalogProperty.getProperties();
-        // check AwsProperties.GLUE_CATALOG_ENDPOINT
-        String metastoreUris = catalogProperty.getOrDefault(CatalogProperties.WAREHOUSE_LOCATION, "");
-        if (StringUtils.isEmpty(metastoreUris)) {
-            throw new IllegalArgumentException("Missing glue properties 'warehouse'.");
-        }
-        catalogProperties.put(CatalogProperties.WAREHOUSE_LOCATION, metastoreUris);
+        Map<String, String> catalogProperties = catalogProperty.getHadoopProperties();
+        String warehouse = catalogProperty.getOrDefault(CatalogProperties.WAREHOUSE_LOCATION, CHECKED_WAREHOUSE);
+        catalogProperties.put(CatalogProperties.WAREHOUSE_LOCATION, warehouse);
+        catalogProperties.put(AwsProperties.S3FILEIO_ENDPOINT,
+                catalogProperties.getOrDefault(Constants.ENDPOINT, conf.get(S3Properties.Env.ENDPOINT)));

Review Comment:
   Why the key name in `conf` is `S3Properties.Env.ENDPOINT`?



##########
fe/fe-core/src/main/java/org/apache/doris/datasource/iceberg/IcebergGlueExternalCatalog.java:
##########
@@ -31,26 +34,27 @@
 
 public class IcebergGlueExternalCatalog extends IcebergExternalCatalog {
 
+    // As a default placeholder. The path just use for 'create table', query stmt will not use it.
+    private static final String CHECKED_WAREHOUSE = "s3://doris";
+
     public IcebergGlueExternalCatalog(long catalogId, String name, String resource, Map<String, String> props) {
         super(catalogId, name);
+        props = PropertyConverter.convertToMetaProperties(props);
         catalogProperty = new CatalogProperty(resource, props);
     }
 
     @Override
     protected void initLocalObjectsImpl() {
         icebergCatalogType = ICEBERG_GLUE;
         GlueCatalog glueCatalog = new GlueCatalog();
-        // AWSGlueAsync glueClient;
         Configuration conf = setGlueProperties(getConfiguration());

Review Comment:
   `setGlueProperties()` is an empty method



##########
fe/fe-core/src/main/java/org/apache/doris/datasource/property/S3ClientBEProperties.java:
##########
@@ -0,0 +1,65 @@
+// 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.doris.datasource.property;
+
+import org.apache.doris.datasource.property.constants.CosProperties;
+import org.apache.doris.datasource.property.constants.ObsProperties;
+import org.apache.doris.datasource.property.constants.OssProperties;
+import org.apache.doris.datasource.property.constants.S3Properties;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class S3ClientBEProperties {
+
+    public static Map<String, String> getBeFSProperties(Map<String, String> properties) {

Review Comment:
   Add comment to explain the method, better give an example.



##########
docs/zh-CN/docs/lakehouse/multi-catalog/iceberg.md:
##########
@@ -82,20 +82,12 @@ CREATE CATALOG glue PROPERTIES (
 "type"="iceberg",
 "iceberg.catalog.type" = "glue",
 "glue.endpoint" = "https://glue.us-east-1.amazonaws.com",
-"warehouse" = "s3://bucket/warehouse",
-"AWS_ENDPOINT" = "s3.us-east-1.amazonaws.com",
-"AWS_REGION" = "us-east-1",
-"AWS_ACCESS_KEY" = "ak",
-"AWS_SECRET_KEY" = "sk",
-"use_path_style" = "true"
+"glue.access_key" = "ak",
+"glue.secret_key" = "sk"
 );
 ```
 
-`glue.endpoint`: Glue Endpoint. 参阅:[AWS Glue endpoints and quotas](https://docs.aws.amazon.com/general/latest/gr/glue.html).
-
-`warehouse`: Glue Warehouse Location. Glue Catalog的根路径,用于指定数据存放位置。
-
-属性详情参见 [Iceberg Glue Catalog](https://iceberg.apache.org/docs/latest/aws/#glue-catalog)
+Iceberg属性详情参见 [Iceberg Glue Catalog](https://iceberg.apache.org/docs/latest/aws/#glue-catalog)

Review Comment:
   这个是说里面的内容我们都支持么?



-- 
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: commits-unsubscribe@doris.apache.org

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


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


[GitHub] [doris] wsjz commented on a diff in pull request #18005: [feature-wip](multi-catalog)add properties converter

Posted by "wsjz (via GitHub)" <gi...@apache.org>.
wsjz commented on code in PR #18005:
URL: https://github.com/apache/doris/pull/18005#discussion_r1154316951


##########
fe/fe-core/src/main/java/org/apache/doris/datasource/iceberg/IcebergGlueExternalCatalog.java:
##########
@@ -31,26 +34,27 @@
 
 public class IcebergGlueExternalCatalog extends IcebergExternalCatalog {
 
+    // As a default placeholder. The path just use for 'create table', query stmt will not use it.
+    private static final String CHECKED_WAREHOUSE = "s3://doris";
+
     public IcebergGlueExternalCatalog(long catalogId, String name, String resource, Map<String, String> props) {
         super(catalogId, name);
+        props = PropertyConverter.convertToMetaProperties(props);
         catalogProperty = new CatalogProperty(resource, props);
     }
 
     @Override
     protected void initLocalObjectsImpl() {
         icebergCatalogType = ICEBERG_GLUE;
         GlueCatalog glueCatalog = new GlueCatalog();
-        // AWSGlueAsync glueClient;
         Configuration conf = setGlueProperties(getConfiguration());
         glueCatalog.setConf(conf);
         // initialize glue catalog
-        Map<String, String> catalogProperties = catalogProperty.getProperties();
-        // check AwsProperties.GLUE_CATALOG_ENDPOINT
-        String metastoreUris = catalogProperty.getOrDefault(CatalogProperties.WAREHOUSE_LOCATION, "");
-        if (StringUtils.isEmpty(metastoreUris)) {
-            throw new IllegalArgumentException("Missing glue properties 'warehouse'.");
-        }
-        catalogProperties.put(CatalogProperties.WAREHOUSE_LOCATION, metastoreUris);
+        Map<String, String> catalogProperties = catalogProperty.getHadoopProperties();
+        String warehouse = catalogProperty.getOrDefault(CatalogProperties.WAREHOUSE_LOCATION, CHECKED_WAREHOUSE);
+        catalogProperties.put(CatalogProperties.WAREHOUSE_LOCATION, warehouse);
+        catalogProperties.put(AwsProperties.S3FILEIO_ENDPOINT,
+                catalogProperties.getOrDefault(Constants.ENDPOINT, conf.get(S3Properties.Env.ENDPOINT)));

Review Comment:
   S3Properties.Env.ENDPOINT is BE endpoint.
   set AwsProperties.S3FILEIO_ENDPOINT by converted s3 endpoint or by BE s3 endpoint default.



-- 
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: commits-unsubscribe@doris.apache.org

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


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


[GitHub] [doris] wsjz commented on pull request #18005: [feature-wip](multi-catalog)add properties converter

Posted by "wsjz (via GitHub)" <gi...@apache.org>.
wsjz commented on PR #18005:
URL: https://github.com/apache/doris/pull/18005#issuecomment-1495444512

   run p0


-- 
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: commits-unsubscribe@doris.apache.org

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


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


[GitHub] [doris] github-actions[bot] commented on pull request #18005: [feature-wip](multi-catalog)add properties converter

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #18005:
URL: https://github.com/apache/doris/pull/18005#issuecomment-1497730838

   PR approved by at least one committer and no changes requested.


-- 
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: commits-unsubscribe@doris.apache.org

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


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


[GitHub] [doris] wsjz commented on a diff in pull request #18005: [feature-wip](multi-catalog)add properties converter

Posted by "wsjz (via GitHub)" <gi...@apache.org>.
wsjz commented on code in PR #18005:
URL: https://github.com/apache/doris/pull/18005#discussion_r1148508651


##########
fe/fe-core/src/main/java/org/apache/doris/datasource/property/PropertyConverter.java:
##########
@@ -0,0 +1,337 @@
+// 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.doris.datasource.property;
+
+import org.apache.doris.datasource.credentials.CloudCredential;
+import org.apache.doris.datasource.credentials.CloudCredentialWithEndpoint;
+import org.apache.doris.datasource.property.constants.CosProperties;
+import org.apache.doris.datasource.property.constants.DLFProperties;
+import org.apache.doris.datasource.property.constants.GlueProperties;
+import org.apache.doris.datasource.property.constants.HMSProperties;
+import org.apache.doris.datasource.property.constants.ObsProperties;
+import org.apache.doris.datasource.property.constants.OssProperties;
+import org.apache.doris.datasource.property.constants.S3Properties;
+
+import com.aliyun.datalake.metastore.common.DataLakeConfig;
+import com.amazonaws.glue.catalog.util.AWSGlueConfig;
+import com.google.common.base.Strings;
+import com.google.common.collect.Maps;
+import org.apache.hadoop.fs.obs.OBSConstants;
+import org.apache.hadoop.fs.s3a.Constants;
+import org.apache.hadoop.fs.s3a.S3AFileSystem;
+import org.apache.hadoop.fs.s3a.TemporaryAWSCredentialsProvider;
+import org.apache.hadoop.hive.conf.HiveConf;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
+import java.util.Map;
+
+public class PropertyConverter {
+
+    private static final Logger LOG = LogManager.getLogger(PropertyConverter.class);
+    public static final String USE_PATH_STYLE = "use_path_style";
+
+    public static String getRegionOfEndpoint(String endpoint) {
+        String[] endpointSplit = endpoint.split("\\.");
+        if (endpointSplit.length < 2) {
+            throw new IllegalArgumentException("Need endpoint with region: " + endpoint);
+        }
+        return endpointSplit[1];
+    }
+
+    public static Map<String, String> metaConvert(Map<String, String> props) {
+        if (props.containsKey(GlueProperties.ENDPOINT)
+                || props.containsKey(AWSGlueConfig.AWS_GLUE_ENDPOINT)) {
+            return convertToGlueProperties(props, GlueProperties.getCredential(props));
+        } else if (props.containsKey(DLFProperties.ENDPOINT)
+                || props.containsKey(DataLakeConfig.CATALOG_ENDPOINT)) {
+            return convertToDLFProperties(props, DLFProperties.getCredential(props));
+        }
+        return props;
+    }
+
+    /**
+     * Convert properties defined at doris to FE S3 client properties and BE S3 client properties
+     */
+    public static Map<String, String> storageConvert(Map<String, String> props) {
+        if (props.containsKey(S3Properties.Environment.ENDPOINT)) {
+            // compatible with the s3,obs,oss,cos when they use aws client.
+            return convertToS3EnvProperties(props, S3Properties.getCompatibleCredential(props));
+        } else if (props.containsKey(S3Properties.ENDPOINT)) {
+            return convertToS3Properties(props, S3Properties.getCredential(props));
+        } else if (props.containsKey(ObsProperties.ENDPOINT)) {
+            return convertToOBSProperties(props, ObsProperties.getCredential(props));
+        } else if (props.containsKey(OssProperties.ENDPOINT)) {
+            return convertToOSSProperties(props, OssProperties.getCredential(props));
+        } else if (props.containsKey(CosProperties.ENDPOINT)) {
+            return convertToCOSProperties(props, CosProperties.getCredential(props));
+        }
+        return props;
+    }
+
+
+    private static Map<String, String> convertToOBSProperties(Map<String, String> props,
+                                                              CloudCredential credential) {
+        Map<String, String> obsProperties = Maps.newHashMap();
+        obsProperties.put(OBSConstants.ENDPOINT, props.get(ObsProperties.ENDPOINT));
+        obsProperties.put("fs.obs.impl.disable.cache", "true");
+        if (credential.isWhole()) {
+            obsProperties.put(OBSConstants.ACCESS_KEY, credential.getAccessKey());
+            obsProperties.put(OBSConstants.SECRET_KEY, credential.getSecretKey());
+        }
+        if (credential.isTemporary()) {
+            obsProperties.put("fs.obs.session.token", credential.getSessionToken());
+        }
+        for (Map.Entry<String, String> entry : props.entrySet()) {
+            if (entry.getKey().startsWith(ObsProperties.OBS_FS_PREFIX)) {
+                obsProperties.put(entry.getKey(), entry.getValue());
+            }
+        }
+        BeAWSProperties.setBeAWSPropertiesFromObs(obsProperties);
+        return obsProperties;
+    }
+
+    private static Map<String, String> convertToS3EnvProperties(Map<String, String> properties,

Review Comment:
   S3HadoopFSProperties like this: "fs.s3a.xxx"
   So named the function  as S3EnvProperties to distinguish it from S3HadoopFSProperties
   



-- 
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: commits-unsubscribe@doris.apache.org

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


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