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..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 @@ -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,14 @@ 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(); @@ -427,6 +438,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); }