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

dataroaring pushed a commit to branch branch-3.0
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-3.0 by this push:
     new 1b68a0f2e69 branch-3.0: [fix](maxcompute)fix maxcompute catalog 
international user can not access. #55256 (#55559)
1b68a0f2e69 is described below

commit 1b68a0f2e6919906ffd9929ec20aec97026b4395
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Fri Sep 5 17:49:47 2025 +0800

    branch-3.0: [fix](maxcompute)fix maxcompute catalog international user can 
not access. #55256 (#55559)
    
    Cherry-picked from #55256
    
    Co-authored-by: daidai <[email protected]>
---
 .../maxcompute/MaxComputeExternalCatalog.java         | 19 +++++++++++++++++++
 .../datasource/property/constants/MCProperties.java   |  7 +++++++
 2 files changed, 26 insertions(+)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/datasource/maxcompute/MaxComputeExternalCatalog.java
 
b/fe/fe-core/src/main/java/org/apache/doris/datasource/maxcompute/MaxComputeExternalCatalog.java
index 1c8979ee1db..ff46f3ad65a 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/datasource/maxcompute/MaxComputeExternalCatalog.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/datasource/maxcompute/MaxComputeExternalCatalog.java
@@ -31,6 +31,7 @@ import com.aliyun.odps.OdpsException;
 import com.aliyun.odps.Partition;
 import com.aliyun.odps.Project;
 import com.aliyun.odps.account.Account;
+import com.aliyun.odps.account.AccountFormat;
 import com.aliyun.odps.account.AliyunAccount;
 import com.aliyun.odps.security.SecurityManager;
 import com.aliyun.odps.table.configuration.RestOptions;
@@ -78,6 +79,8 @@ public class MaxComputeExternalCatalog extends 
ExternalCatalog {
 
     public boolean dateTimePredicatePushDown;
 
+    AccountFormat accountFormat = AccountFormat.DISPLAYNAME;
+
     private static final Map<String, ZoneId> REGION_ZONE_MAP;
     private static final List<String> REQUIRED_PROPERTIES = ImmutableList.of(
             MCProperties.PROJECT,
@@ -211,6 +214,14 @@ public class MaxComputeExternalCatalog extends 
ExternalCatalog {
         this.odps = new Odps(account);
         odps.setDefaultProject(defaultProject);
         odps.setEndpoint(endpoint);
+
+        String accountFormatProp = 
props.getOrDefault(MCProperties.ACCOUNT_FORMAT, 
MCProperties.DEFAULT_ACCOUNT_FORMAT);
+        if (accountFormatProp.equals(MCProperties.ACCOUNT_FORMAT_NAME)) {
+            accountFormat = AccountFormat.DISPLAYNAME;
+        } else if (accountFormatProp.equals(MCProperties.ACCOUNT_FORMAT_ID)) {
+            accountFormat = AccountFormat.ID;
+        }
+        odps.setAccountFormat(accountFormat);
         Credentials credentials = 
Credentials.newBuilder().withAccount(odps.getAccount())
                 .withAppAccount(odps.getAppAccount()).build();
 
@@ -427,6 +438,14 @@ public class MaxComputeExternalCatalog extends 
ExternalCatalog {
                     + MCProperties.SPLIT_ROW_COUNT + "must be an integer");
         }
 
+        String accountFormatProp = 
props.getOrDefault(MCProperties.ACCOUNT_FORMAT, 
MCProperties.DEFAULT_ACCOUNT_FORMAT);
+        if (accountFormatProp.equals(MCProperties.ACCOUNT_FORMAT_NAME)) {
+            accountFormat = AccountFormat.DISPLAYNAME;
+        } else if (accountFormatProp.equals(MCProperties.ACCOUNT_FORMAT_ID)) {
+            accountFormat = AccountFormat.ID;
+        } else {
+            throw new DdlException("property " + MCProperties.ACCOUNT_FORMAT + 
"only support name and id");
+        }
 
         try {
             connectTimeout = Integer.parseInt(
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/datasource/property/constants/MCProperties.java
 
b/fe/fe-core/src/main/java/org/apache/doris/datasource/property/constants/MCProperties.java
index 8282134c5a1..28375b4f371 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/datasource/property/constants/MCProperties.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/datasource/property/constants/MCProperties.java
@@ -75,6 +75,13 @@ public class MCProperties extends BaseProperties {
             "mc.datetime_predicate_push_down";
     public static final String DEFAULT_DATETIME_PREDICATE_PUSH_DOWN = "true";
 
+    // The account systems for Alibaba Cloud China and International are 
different. If the primary account is an
+    // International user, specify ACCOUNT_FORMAT as ACCOUNT_FORMAT_ID. 
Otherwise, specify ACCOUNT_FORMAT_NAME.
+    public static final String ACCOUNT_FORMAT = "mc.account_format";
+    public static final String ACCOUNT_FORMAT_NAME = "name";
+    public static final String ACCOUNT_FORMAT_ID = "id";
+    public static final String DEFAULT_ACCOUNT_FORMAT = ACCOUNT_FORMAT_NAME;
+
     public static CloudCredential getCredential(Map<String, String> props) {
         return getCloudCredential(props, ACCESS_KEY, SECRET_KEY, 
SESSION_TOKEN);
     }


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

Reply via email to