From a54b5d5fe8a62192be972f098e51b2eb53e33cc5 Mon Sep 17 00:00:00 2001 From: daidai Date: Mon, 25 Aug 2025 17:16:55 +0800 Subject: [PATCH 1/2] [fix](maxcompute)fix maxcompute catalog international user can not access. --- .../maxcompute/MaxComputeExternalCatalog.java | 12 ++++++++++++ .../datasource/property/constants/MCProperties.java | 7 +++++++ 2 files changed, 19 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 1c8979ee1db5fc..b6f8ce8c5b257f 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.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 REGION_ZONE_MAP; private static final List REQUIRED_PROPERTIES = ImmutableList.of( MCProperties.PROJECT, @@ -211,6 +214,7 @@ protected void initLocalObjectsImpl() { this.odps = new Odps(account); odps.setDefaultProject(defaultProject); odps.setEndpoint(endpoint); + odps.setAccountFormat(accountFormat); Credentials credentials = Credentials.newBuilder().withAccount(odps.getAccount()) .withAppAccount(odps.getAppAccount()).build(); @@ -427,6 +431,14 @@ public void checkProperties() throws DdlException { + 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 8282134c5a19b9..28375b4f371de2 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 props) { return getCloudCredential(props, ACCESS_KEY, SECRET_KEY, SESSION_TOKEN); } From f260bf4b971f891b9597a739b91834eb29ca97c1 Mon Sep 17 00:00:00 2001 From: daidai Date: Wed, 27 Aug 2025 17:59:08 +0800 Subject: [PATCH 2/2] [fix](maxcompute 2)fix maxcompute catalog international user can not access. --- .../datasource/maxcompute/MaxComputeExternalCatalog.java | 7 +++++++ 1 file changed, 7 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 b6f8ce8c5b257f..ff46f3ad65a994 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 @@ -214,6 +214,13 @@ protected void initLocalObjectsImpl() { 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();