All Products
Search
Document Center

MaxCompute:Delta Lake foreign tables

Last Updated:Jan 01, 2026

This topic describes how to create, read from, and write to OSS foreign tables in Delta Lake format.

Important

MaxCompute supports the foreign table feature only with a specific version of the Delta Lake software development kit (SDK). MaxCompute will not update the SDK version or further develop this feature. Use Paimon foreign tables to read data in data lake table formats.

Scope

  • The cluster property is not supported for OSS external tables.

  • A single file cannot exceed 3 GB. If a file is larger than 3 GB, you must split it.

  • MaxCompute and OSS must be deployed in the same region.

  • Delta Lake foreign tables support only reading all data from the files mapped to the foreign table. They do not support automatic hiding of system columns, incremental reads, snapshot reads, or write operations. To perform read and write operations that support atomicity, consistency, isolation, and durability (ACID), use features such as MaxCompute Delta tables or Paimon foreign tables.

  • The default Delta Lake SDK version integrated into MaxCompute is io.delta:delta-core_2.11:0.2.0.5. Forward or backward compatibility for the Delta Lake SDK is not guaranteed. Compatibility is maintained by the open source community.

Supported data types

For more information about MaxCompute data types, see Data types (version 1.0) and Data types (version 2.0).

Data type

Supported

Data type

Support

TINYINT

Enabled

STRING

Enabled

SMALLINT

Enabled

DATE

Activated

INT

Activated

DATETIME

Not enabled

BIGINT

Enabled

TIMESTAMP

Enabled

BINARY

Activated

TIMESTAMP_NTZ

Not enabled

FLOAT

Enabled

BOOLEAN

Activated

DOUBLE

Enabled

ARRAY

Enabled

DECIMAL(precision,scale)

Not enabled

MAP

Enabled

VARCHAR(n)

Enabled

STRUCT

Activated

CHAR(n)

Activated

JSON

Not enabled

Create a foreign table

Syntax

CREATE EXTERNAL TABLE [IF NOT EXISTS] <mc_oss_extable_name>
(
   <col_name> <data_type>,
   ...
)
[COMMENT <table_comment>]
[PARTITIONED BY (<col_name> <data_type>, ...)]
ROW FORMAT SERDE 'org.apache.hadoop.hive.ql.io.parquet.serde.ParquetHiveSerDe'
STORED AS
INPUTFORMAT 'io.delta.hive.DeltaInputFormat'
OUTPUTFORMAT 'io.delta.hive.DeltaOutputFormat'
LOCATION 'oss_location';

Parameters

For more information, see Basic syntax parameters.

Query and analysis

Example

This example shows how to use the built-in open source data resolver to create a Delta Lake foreign table, write data to OSS, and query the data.

  1. Prepare the data.

    Log on to the OSS console and upload the test RCFILE format data file to the specified directory oss-mc-test/Demo_rcfile+pt/dt=20250521/ in your OSS bucket. For more information, see Upload files to OSS.

  2. Upload test data

    Log on to the OSS console and upload a test data file in Delta Lake format to the oss-mc-test/Demo_delta_pt/dt=20250612/ folder in your OSS bucket. For more information, see Upload files to OSS.

  3. Create a Delta Lake foreign table

    CREATE EXTERNAL TABLE test_delta_pt (
        id INT
    )
    PARTITIONED BY (dt STRING )
    ROW FORMAT SERDE 'org.apache.hadoop.hive.ql.io.parquet.serde.ParquetHiveSerDe'
    STORED AS
    INPUTFORMAT 'io.delta.hive.DeltaInputFormat'
    OUTPUTFORMAT 'io.delta.hive.DeltaOutputFormat'
    LOCATION 'oss://oss-cn-hangzhou-internal.aliyuncs.com/oss-mc-test/Demo_delta_pt/';
  4. Import partition data. If the created OSS foreign table is a partitioned table, you must also import the partition data. For more information, see Syntax for adding partition data to an OSS foreign table.

    MSCK REPAIR TABLE test_delta_pt ADD PARTITIONS;
  5. Query the Delta Lake foreign table.

    SELECT * FROM test_delta_pt WHERE dt='20250612';