Skip to main content

MaxCompute Catalog

Run catalog SQL with a warehouse SQL user that can manage catalogs and access the source. Ensure network access from the warehouse to metadata, storage, and source endpoints. For connector deployment, host files, JVM settings, or service configuration changes, contact VeloDB Cloud support.

MaxCompute is an enterprise-level SaaS (Software as a Service) cloud data warehouse on Alibaba Cloud. Through the open storage SDK provided by MaxCompute, VeloDB Cloud can retrieve MaxCompute table information and perform queries and writes.

Use cases​

ScenarioDescription
Data IntegrationRead MaxCompute data and write to warehouse tables.
Data Write-backUsing INSERT command to write data into MaxCompute tables.

Usage notes​

  1. MaxCompute Catalog uses the Open Storage SDK. Legacy Apache Doris configurations using the Tunnel API are retained below only for compatibility reference.

  2. There are certain limitations when using the Open Storage SDK. Please refer to the Usage Limitations section in this document.

  3. Use mc.enable.namespace.schema to expose MaxCompute schemas as an additional namespace level. When it is disabled, a MaxCompute project maps to one warehouse catalog database.

Configure catalog​

Syntax​

CREATE CATALOG [IF NOT EXISTS] catalog_name PROPERTIES (
'type' = 'max_compute',
{McAuthProperties},
{McRequiredProperties},
{McOptionalProperties},
{CommonProperties}
);
  • {McAuthProperties}

    These properties control how VeloDB Cloud authenticates to MaxCompute for both query and write operations.

    These authentication properties are part of the Core 26.1.3 implementation. Role-based authentication also requires the corresponding managed credential and cloud-provider configuration.

    Property NameDefault ValueDescriptionRequired
    mc.auth.typeak_skAuthentication type. Supported values: ak_sk, ram_role_arn, and ecs_ram_role.No
    mc.access_keyNoneAlibaba Cloud AccessKey.Required when mc.auth.type is ak_sk (default) or ram_role_arn.
    mc.secret_keyNoneAlibaba Cloud SecretKey.Required when mc.auth.type is ak_sk (default) or ram_role_arn.
    mc.ram_role_arnNoneAlibaba Cloud RAM Role ARN.Required when mc.auth.type is ram_role_arn.
    mc.ecs_ram_roleNoneAlibaba Cloud ECS RAM Role name attached to the instance.Required when mc.auth.type is ecs_ram_role.

    Supported values for mc.auth.type:

    ValueDescription
    ak_skUse Alibaba Cloud AccessKey and SecretKey directly.
    ram_role_arnUse mc.access_key and mc.secret_key as source credentials to call STS AssumeRole, then access MaxCompute with the returned temporary credentials.
    ecs_ram_roleObtain temporary credentials from the ECS metadata service. Ensure the warehouse frontend and BE nodes that access MaxCompute can use the role specified by mc.ecs_ram_role.

    Validation rules:

    1. If mc.auth.type is omitted, The query engine uses ak_sk.
    2. When mc.auth.type is ram_role_arn, you must configure mc.access_key, mc.secret_key, and mc.ram_role_arn.
    3. When mc.auth.type is ecs_ram_role, you must configure mc.ecs_ram_role.
    4. When mc.access_key and mc.secret_key are used, they must be configured together.

    For SQL examples of different authentication types, see Basic Example.

  • {McRequiredProperties}

    Property NameDescription
    mc.default.projectThe name of the MaxCompute project to access. You can create and manage projects in the MaxCompute Project List.
    mc.endpointThe MaxCompute service endpoint. See Obtain an endpoint and quota.
  • {McOptionalProperties}

    Property NameDefault ValueDescription
    mc.quotapay-as-you-goQuota name. Please refer to the "How to Obtain Endpoint and Quota" section below for configuration.
    mc.split_strategybyte_sizeSets the Split partitioning method. Can be set to partition by byte size byte_size or by row count row_count.
    mc.split_byte_size268435456The file size each Split reads, in bytes. Default is 256 MB. Only effective when "mc.split_strategy" = "byte_size".
    mc.split_row_count1048576Number of rows each Split reads. Only effective when "mc.split_strategy" = "row_count".
    mc.split_cross_partitiontrueWhether the generated Splits cross partitions.
    mc.connect_timeout10Connection timeout for MaxCompute, in integer seconds.
    mc.read_timeout120Read timeout for MaxCompute, in integer seconds.
    mc.retry_count4Number of retries after timeout.
    mc.datetime_predicate_push_downtrueWhether to allow predicate push-down for timestamp/timestamp_ntz types. VeloDB Cloud loses precision (9 -> 6) when syncing these two types. Therefore, if the original data precision is higher than 6 digits, predicate push-down may lead to inaccurate results.
    mc.account_formatnameThe account systems of Alibaba Cloud International and China sites are inconsistent. For international site users, if you encounter errors like user 'RAM$xxxxxx:xxxxx' is not a valid aliyun account, you can set this parameter to id.
    mc.enable.namespace.schemafalseWhether to support MaxCompute Schema hierarchy. See: https://help.aliyun.com/zh/maxcompute/user-guide/schema-related-operations
    mc.max_field_size_bytes8388608 (8 MB)Maximum bytes allowed for a single field in a write session. When writing data that contains large string or binary fields, the write may fail if the field size exceeds this value. You can increase this value based on your actual data.
    test_connectionfalseWhether to verify connectivity when creating the catalog. When set to true, VeloDB Cloud checks access to the endpoint and mc.default.project using the configured authentication method; if mc.enable.namespace.schema is enabled, the schema list must be accessible as well. CREATE CATALOG fails immediately if the check does not pass.

    These properties describe the reviewed Core 26.1.3 implementation, not their first Cloud release. Reference defaults can differ from an existing catalog's effective properties. mc.connect_timeout, mc.read_timeout, and mc.retry_count are applied to the underlying REST client; timeout values are integer seconds. New catalogs require mc.endpoint. Legacy keys such as mc.region, mc.odps_endpoint, and mc.tunnel_endpoint are described in the Apache Doris compatibility appendix below.

    • mc.max_field_size_bytes

      MaxCompute allows a maximum of 8 MB per field by default. If the data being written contains large string or binary fields, the write may fail.

      To adjust this limit, first execute the following command in the MaxCompute console SQL editor:

      setproject odps.sql.cfile2.field.maxsize=262144;

      This adjusts the maximum bytes for a single field. The unit is KB and the maximum value is 262144.

      Then set mc.max_field_size_bytes to the corresponding byte value in the VeloDB Cloud Catalog properties (this value must not exceed the MaxCompute setting).

  • {CommonProperties}

    The CommonProperties section is used to fill in common properties. Please refer to the "Common Properties" section in Catalog Overview.

Metadata Cache​

To improve the performance of accessing external data sources, Apache Doris caches MaxCompute metadata. Metadata includes table structure (Schema) and partition lists.

Tip:

For managed configuration and cache scope, see Metadata Cache. In Core 26.1.3, MaxCompute Catalog's external metadata cache is configured using the unified meta.cache.* keys.

Cache property configuration​

MaxCompute cache entries use the configuration key format meta.cache.maxcompute.<entry>.{enable,ttl-second,capacity}. MaxCompute entries are currently count-bounded and do not accept entry-level max-weight; see External Metadata Cache Memory Management.

PropertyExampleMeaning
enabletrue/falseWhether to enable this cache module.
ttl-second600, 0, -10 means disable cache (takes effect immediately, can be used to see the latest data); -1 means never expire; other positive integers mean TTL in seconds based on access time.
capacity10000Maximum number of cache entries (by count). 0 means disable.

Effective Logic: The module cache only takes effect when enable=true, ttl-second != 0, and capacity > 0.

Cache Modules​

MaxCompute Catalog includes the following cache modules:

Module (<entry>)Property Key PrefixCached Content and Impact
schemameta.cache.maxcompute.schema.Caches table structure. Impact: Visibility of table column information. If disabled, the latest Schema is pulled for each query.
partition_valuesmeta.cache.maxcompute.partition_values.Caches partition value lists. Impact: Partition pruning and enumeration. If disabled, new external partitions can be seen in real-time.

Legacy Parameter Mapping and Conversion​

Use the unified keys in Core 26.1.3. The following table maps legacy properties to their unified equivalents:

Legacy Property KeyUnified KeyDescription
schema.cache.ttl-secondmeta.cache.maxcompute.schema.ttl-secondExpiration time of table structure cache

Best Practices​

  • Real-time access to the latest data: If you want each query to see the latest partition or schema changes for MaxCompute tables, you can set the ttl-second for schema or partition_values to 0.
    -- Disable partition value cache to detect the latest partitions in MaxCompute tables
    ALTER CATALOG mc_ctl SET PROPERTIES ("meta.cache.maxcompute.partition_values.ttl-second" = "0");
  • Note: In Core 26.1.3, a successful Catalog property change resets the Catalog execution context and clears initialized entries for every metadata-cache engine routed by that Catalog. VeloDB Cloud rebuilds them with the new context and configuration on the next access; in-flight queries are not affected.

Observability​

Cache metrics can be observed through the information_schema.catalog_meta_cache_statistics system table:

SELECT catalog_name, engine_name, entry_name,
effective_enabled, ttl_second, capacity,
estimated_size, hit_rate, load_failure_count, last_error
FROM information_schema.catalog_meta_cache_statistics
WHERE catalog_name = 'mc_ctl' AND engine_name = 'maxcompute'
ORDER BY entry_name;

See the documentation for this system table: catalog_meta_cache_statistics.

Supported MaxCompute versions​

Only the public cloud version of MaxCompute is supported. For private cloud version support, please contact VeloDB Cloud community support.

Supported MaxCompute tables​

  • Supports reading partitioned tables, clustered tables, and materialized views.

  • External tables and logical views are rejected. Confirm the Open Storage API and table-type requirements for Delta tables before relying on them.

Hierarchy mapping​

  • When mc.enable.namespace.schema is false

    VeloDB CloudMaxCompute
    CatalogN/A
    DatabaseProject
    TableTable
  • When mc.enable.namespace.schema is true

    VeloDB CloudMaxCompute
    CatalogProject
    DatabaseSchema
    TableTable

Column type mapping​

MaxCompute TypeVeloDB Cloud TypeComment
booleanboolean
tinytinyint
tinyinttinyint
smallintsmallint
intint
bigintbigint
floatfloat
doubledouble
decimal(P, S)decimal(P, S)1 <= P <= 38, 0 <= S <= 18
char(N)char(N)
varchar(N)varchar(N)
stringstring
datedate
datetimedatetime(3)Fixed mapping to precision 3. You can specify the timezone via SET [GLOBAL] time_zone = 'Asia/Shanghai'.
timestamp_ntzdatetime(6)MaxCompute's timestamp_ntz precision is 9, while VeloDB Cloud's DATETIME maximum precision is only 6, so the extra part is truncated when reading data.
timestampdatetime(6)MaxCompute's timestamp precision is 9, while VeloDB Cloud's DATETIME maximum precision is only 6, so the extra part is truncated when reading data.
arrayarray
mapmap
structstruct
otherUNSUPPORTED

Basic example​

Default ak_sk authentication:

CREATE CATALOG mc_catalog PROPERTIES (
'type' = 'max_compute',
'mc.default.project' = 'project',
'mc.access_key' = 'AKxxxxx',
'mc.secret_key' = 'SKxxxxx',
'mc.endpoint' = 'http://service.cn-beijing-vpc.maxcompute.aliyun-inc.com/api'
);

ram_role_arn authentication:

CREATE CATALOG mc_catalog PROPERTIES (
'type' = 'max_compute',
'mc.default.project' = 'project',
'mc.auth.type' = 'ram_role_arn',
'mc.access_key' = 'AKxxxxx',
'mc.secret_key' = 'SKxxxxx',
'mc.ram_role_arn' = 'acs:ram::<your_account_id>:role/<your_role_name>',
'mc.endpoint' = 'http://service.cn-beijing-vpc.maxcompute.aliyun-inc.com/api'
);

ecs_ram_role authentication:

CREATE CATALOG mc_catalog PROPERTIES (
'type' = 'max_compute',
'mc.default.project' = 'project',
'mc.auth.type' = 'ecs_ram_role',
'mc.ecs_ram_role' = '<your_ecs_ram_role_name>',
'mc.endpoint' = 'http://service.cn-beijing-vpc.maxcompute.aliyun-inc.com/api'
);
Apache Doris compatibility: legacy Tunnel catalog syntax

The following example was used by Apache Doris versions before 2.1.7. It is retained for migration reference. A new Cloud catalog requires mc.endpoint; this legacy-only statement is not a Cloud creation procedure.

CREATE CATALOG mc_catalog PROPERTIES (
'type' = 'max_compute',
'mc.region' = 'cn-beijing',
'mc.default.project' = 'project',
'mc.access_key' = 'ak',
'mc.secret_key' = 'sk',
'mc.odps_endpoint' = 'http://service.cn-beijing.maxcompute.aliyun-inc.com/api',
'mc.tunnel_endpoint' = 'http://dt.cn-beijing.maxcompute.aliyun-inc.com'
);

With Schema support:

CREATE CATALOG mc_catalog PROPERTIES (
'type' = 'max_compute',
'mc.default.project' = 'project',
'mc.access_key' = 'ak',
'mc.secret_key' = 'sk',
'mc.endpoint' = 'http://service.cn-beijing.maxcompute.aliyun-inc.com/api',
'mc.enable.namespace.schema' = 'true'
);

Query operations​

Run a basic query​

-- 1. Switch to Catalog, use database and query
SWITCH mc_ctl;
USE mc_db;
SELECT * FROM mc_tbl LIMIT 10;

-- 2. Use mc database directly
USE mc_ctl.mc_db;
SELECT * FROM mc_tbl LIMIT 10;

-- 3. Use full qualified name to query
SELECT * FROM mc_ctl.mc_db.mc_tbl LIMIT 10;

Query optimization​

  • LIMIT query optimization

    This parameter is only applicable to scenarios where LIMIT 1 is frequently used to check whether data exists.

    When querying MaxCompute tables, if the query contains only partition column equality predicates (= or IN) with a LIMIT clause, you can enable the Session Variable enable_mc_limit_split_optimization to optimize the split generation strategy.

    When enabled, the system uses a row_offset strategy to read only the required number of rows, instead of generating splits for all data. This can reduce the split count from many to exactly one, significantly reducing query latency.

    This optimization applies to queries like:

    SELECT * FROM mc_tbl WHERE pt = 'value' LIMIT 100;
    SELECT * FROM mc_tbl WHERE pt IN ('v1', 'v2') LIMIT 100;

    To enable:

    SET enable_mc_limit_split_optimization = true;

    This parameter is disabled by default. The optimization will not take effect when the query contains non-partition column filters, non-equality predicates (such as >, <, !=), or does not have a LIMIT clause.

Write operations​

VeloDB Cloud supports write operations to MaxCompute tables. You can use standard INSERT statements to write data from other data sources directly to MaxCompute tables through the warehouse.

Note:

  • This is an experimental feature, available in Core 26.1.3
  • Supports writing to both partitioned and non-partitioned tables.
  • External tables and logical views cannot be write targets. Confirm Open Storage API compatibility and write requirements for clustered, transactional, or Delta tables before using them.

INSERT INTO​

The INSERT operation appends data to the target table.

Example:

INSERT INTO mc_tbl values (val1, val2, val3, val4);
INSERT INTO mc_tbl SELECT col1, col2 FROM internal.db1.tbl1;

INSERT INTO mc_tbl(col1, col2) values (val1, val2);
INSERT INTO mc_tbl(col1, col2, partition_col1, partition_col2) values (1, 2, "beijing", "2023-12-12");

-- Write to specified partition (you can specify only some partition columns, with remaining partitions written dynamically)
INSERT INTO mc_tbl PARTITION(ds='20250201') SELECT id, name FROM source_tbl;
INSERT INTO mc_tbl PARTITION(ds='20250101', region='bj') VALUES (1, 'v1'), (2, 'v2');

INSERT OVERWRITE​

INSERT OVERWRITE completely overwrites the existing data in the table with new data.

INSERT OVERWRITE TABLE mc_tbl VALUES(val1, val2, val3, val4);
INSERT OVERWRITE TABLE mc_tbl(col1, col2) SELECT col1, col2 FROM internal.db1.tbl1;

-- Write to specified partition
INSERT OVERWRITE TABLE mc_tbl PARTITION(ds='20250101') VALUES (10, 'new1');

CTAS​

You can create a MaxCompute table and write data using the CTAS statement:

CREATE TABLE mc_tbl AS SELECT * FROM other_table;

Database and table management​

VeloDB Cloud supports creating and dropping MaxCompute databases and tables.

Note:

  • This is an experimental feature, available in Core 26.1.3
  • Supports creating and dropping partitioned and non-partitioned tables.
  • The examples below create ordinary tables. Additional table properties and bucketed Delta table creation have separate source-service requirements; confirm the intended table type before creating it.

When creating or dropping databases or tables, VeloDB Cloud invokes the corresponding MaxCompute API to perform the operation. After the operation returns, metadata changes on the MaxCompute side need a short time before they are fully visible to subsequent operations.

This feature is only available when the mc.enable.namespace.schema property is set to true.

Create and dropping databases​

You can switch to the corresponding Catalog using the SWITCH statement and execute the CREATE DATABASE statement:

SWITCH mc;
CREATE DATABASE [IF NOT EXISTS] mc_schema;

You can also create using the fully qualified name:

CREATE DATABASE [IF NOT EXISTS] mc.mc_schema;

Drop database:

DROP DATABASE [IF EXISTS] mc.mc_schema;

Warning:

For MaxCompute Database, after deletion, all tables under it will also be deleted.

Create and dropping tables​

  • Create

    VeloDB Cloud supports creating partitioned or non-partitioned tables in MaxCompute.

    Example:

    CREATE TABLE mc_schema.mc_tbl1 (
    bool_col BOOLEAN,
    int_col INT,
    bigint_col BIGINT,
    float_col FLOAT,
    double_col DOUBLE,
    decimal_col DECIMAL(18,6),
    string_col STRING,
    varchar_col VARCHAR(200),
    char_col CHAR(50),
    date_col DATE,
    datetime_col DATETIME,
    arr_col ARRAY<STRING>,
    map_col MAP<STRING, STRING>,
    struct_col STRUCT<f1:STRING, f2:INT>
    );

    CREATE TABLE mc_schema.mc_tbl2 (
    id INT,
    val STRING,
    ds STRING,
    region STRING
    )
    PARTITION BY (ds, region)();
  • Drop

    You can drop a MaxCompute table using the DROP TABLE statement. Currently, dropping a table will also delete the data, including partition data.

    Example:

    DROP TABLE [IF EXISTS] mc_tbl;

FAQ​

Obtain an endpoint and quota​

  1. If using exclusive resource groups for data transfer service

    Please refer to the "2. Authorization" section in the "Using Exclusive Data Service Resource Groups" chapter in this document to enable the corresponding permissions. In the "Quota Management" list, view and copy the corresponding QuotaName, and specify "mc.quota" = "QuotaName". At this point, you can choose either VPC or public network to access MaxCompute, but VPC has guaranteed bandwidth while public network bandwidth resources are limited.

  2. If using pay-as-you-go

    Please refer to the "Using Open Storage (Pay-as-you-go)" section in this document to enable the Open Storage (Storage API) switch and grant permissions to the user corresponding to the AK and SK. In this case, mc.quota is the default value pay-as-you-go, and you do not need to specify this value additionally. With pay-as-you-go, you can only use VPC to access MaxCompute and cannot access via public network. Only prepaid users can access MaxCompute via public network.

  3. Configure mc.endpoint according to the "Region Endpoint Reference Table" in the Alibaba Cloud Endpoints documentation

    Users accessing via VPC need to configure mc.endpoint according to the "VPC Network Endpoint" column in the "Regional Endpoint Reference Table (Alibaba Cloud VPC Network Connection Method)" table. Users accessing via public network can choose from the "Classic Network Endpoint" column in the "Regional Endpoint Reference Table (Alibaba Cloud Classic Network Connection Method)" table, or the "External Network Endpoint" column in the "Regional Endpoint Reference Table (External Network Connection Method)" table to configure mc.endpoint.

Legacy Apache Doris endpoint configuration​

Apache Doris compatibility: endpoint migration

These legacy properties describe older Apache Doris catalogs. Core 26.1.3 retains endpoint conversion when loading existing catalogs, but new catalog validation requires mc.endpoint.

In versions before Apache Doris 2.1.7, the Tunnel SDK is used to interact with MaxCompute, so the following two endpoint properties are required:

  • mc.odps_endpoint: MaxCompute Endpoint, used to retrieve MaxCompute metadata (database and table information).

  • mc.tunnel_endpoint: Tunnel Endpoint, used to read MaxCompute data.

By default, MaxCompute Catalog generates endpoints based on mc.region and mc.public_access.

The generated format is as follows:

mc.public_accessmc.odps_endpointmc.tunnel_endpoint
falsehttp://service.{mc.region}.maxcompute.aliyun-inc.com/apihttp://dt.{mc.region}.maxcompute.aliyun-inc.com
truehttp://service.{mc.region}.maxcompute.aliyun.com/apihttp://dt.{mc.region}.maxcompute.aliyun.com

Users can also specify mc.odps_endpoint and mc.tunnel_endpoint individually to customize the service address, which is suitable for privately deployed MaxCompute environments.

For configuring MaxCompute Endpoint and Tunnel Endpoint, please refer to Endpoints for Different Regions and Network Connection Methods.

Resource usage control​

Users can adjust the table-level request concurrency by adjusting the two Session Variables parallel_pipeline_task_num and num_scanner_threads to control resource consumption in the data transfer service. The corresponding concurrency equals max(parallel_pipeline_task_num * be num * num_scanner_threads).

Note:

  1. This method can only control the concurrent request count for a single table within a single Query, and cannot control resource usage across multiple SQL statements.

  2. Reducing concurrency means increasing the Query execution time.

Write best practices​

  • It is recommended to write to specified partitions whenever possible, e.g. INSERT INTO mc_tbl PARTITION(ds='20250201'). When no partition is specified, due to limitations of the MaxCompute Storage API, data for each partition must be written sequentially. As a result, the execution plan will sort data based on the partition columns, which can consume significant memory resources when the data volume is large and may cause the write to fail.

  • When writing without specifying a partition, do not set SET enable_strict_consistency_dml = false. This forcefully removes the sort node, causing partition data to be written out of order, which will ultimately result in an error from MaxCompute.

  • Do not add a LIMIT clause. When a LIMIT clause is added, VeloDB Cloud will use only a single thread for writing to guarantee the write count. This can be used for small-scale testing, but if the LIMIT value is large, write performance will be poor.

Write error: Data invalid: ODPS-0020041:StringOutOfMaxLength​

Refer to the description of mc.max_field_size_bytes.