tencent cloud

Data Lake Compute

Native Table (TC-Iceberg) Operation Configuration

Download
Focus Mode
Font Size
Last updated: 2026-05-27 10:59:37

Overview

The process of configuring and using a DLC Native Table (TC-Iceberg) is consistent with that of the Iceberg native table, as shown below:

For the configuration steps of managed storage, see native table (Iceberg) operation configurations.
Users can use TC-Iceberg tables through the DLC data management interface or data exploration interface.

Creating a DLC Native Table (TC-Iceberg)

Note:
Creating a TC-Iceberg table requires using the standard engine Standard-S 1.1 or later versions. When creating a table, you need to specify a primary key, which can be one or more fields.
There are two ways to create TC-Iceberg native tables:
1. Visually create tables through the DLC data management interface. When creating a table, select TC-Iceberg as the table type, and configure an optimization engine for the table.

2. Most of the configuration items for creating TC-Iceberg tables are consistent with those for creating Iceberg tables. For specific operations, see data management. In addition, a new setting of streaming data retention period is added in TC-Iceberg tables. This setting is used to manage the lifecycle of streaming data in TC-Iceberg tables, and the default retention period is 7 days.

Configuration item description for table creation:
Write optimization: After enabling write optimization, users can customize the configuration items related to file merging and file cleanup.
File merging: After file merging is enabled, an optimizer task will be pulled up on the user-configured engine to perform optimization operations such as file merging on the table and automatically manage and optimize the table. Users can customize the minimum number of files and target file size. The minimum number of files indicates the threshold number of small files for triggering a file merging task, and the target file size indicates the maximum size limit of the file after merging.
File cleanup: After enabling file cleanup, users can configure the snapshot expiration time, number of expired snapshots retained, and other snapshot expiration policies for the table as needed.
Lifecycle: This item is primarily used to support user-configured data expiration configurations. The expiration policies depend on the user-configured expiration time, expired field, and expired field format. Since expired data will be deleted, be cautious when configuring this item.
Streaming data lifecycle: The underlying layer of a TC-Iceberg table is composed of the change table and base table. The change table saves real-time streaming data. By configuring the streaming data lifecycle, you can set the streaming data retention period in the change table. It is recommended to keep the default value of 7 days.
3. Create tables using SQL.
When creating a table with SQL, users write the CREATE TABLE SQL statements by themselves for creation. To declare that a TC-Iceberg table is being created, you need to use the keyword USING TC_ICEBERG (case-insensitive) and specify the table format as TC-Iceberg when creating the table. The data types of TC-Iceberg tables are compatible with those of Iceberg tables. If the primary key is configured as multiple fields, the fields must be separated by commas.
Users can add some advanced parameters according to the usage scenario. Parameters are added through TBLPROPERTIES. If there are no parameters when you create a table, or if you want to modify some attribute values, you can modify them by using the alter table set tblproperties method. After executing the alter table modification, you need to restart the upstream import task to complete the modification or addition of attribute values.
CREATE TABLE IF NOT EXISTS database_name.table_name (
col1 STRING,
col2 INT,
PRIMARY KEY (col1))
USING TC_ICEBERG PARTITIONED BY (col2)
TBLPROPERTIES ('properties1' = 'value1','properties2' = 'value2');

CREATE TABLE IF NOT EXISTS database_name.table_name (
col1 STRING,
col2 INT,
PRIMARY KEY (col1,col2))
USING TC_ICEBERG PARTITIONED BY (col2)
TBLPROPERTIES ('properties1' = 'value1','properties2' = 'value2');
For specific table creation attributes, see native table (TC-Iceberg) format description.

Modifying a DLC Native Table (TC-Iceberg)

If you need to make some changes to a TC-Iceberg table, such as adding or removing table attributes, modifying the table description, and adding or removing table fields, you can also perform these operations through the DLC data management interface and data exploration interface.
1. Modify table attributes in the data management interface.
1.1 Add or remove table fields.

1.2 Modify the table description.

1.3 Add or remove table attributes.

2. Modify table attributes in SQL.
If the user does not specify relevant attribute values when creating a table, the relevant attribute values can be modified, added, or removed through alter table, as shown below. Any changes to table attribute values can be made in this way. If the user's table already has InLong/Oceanus/Flink real-time import, the upstream import business must be restarted after modification.
ALTER TABLE db_name.tb_name ADD COLUMNS(col3 int);
ALTER TABLE db_name.tb_name DROP COLUMN col1,col2;

ALTER TABLE db_name.tb_name SET TBLPROPERTIES ('pro1' = 'value1', 'pro2' = 'value2');
ALTER TABLE db_name.tb_name UNSET TBLPROPERTIES ('pro1','pro2');

ALTER TABLE db_name.tb_name SET TBLPROPERTIES ('comment' = 'comment_value');

Querying Data Optimization Tasks

1. The optimization tasks of a table can be viewed in the data optimization interface, including in-progress optimization tasks and today's optimization task list.

2. Click View Details in the task to view the basic information about the optimization task as well as the optimization content and results.

Querying a DLC Native Table (TC-Iceberg)

DLC Native Table (TC-Iceberg) provides low-latency data analysis capabilities for near-real-time lakehouse scenarios by merging the data of ChangeStore and BaseStore while reading in Merge-On-Read mode.
Users can also directly query the BaseStore data in TC-Iceberg just like using Iceberg native tables, so as to provide more Iceberg-compatible usage methods and meet traditional usage scenario requirements. In the incremental write scenarios, the data timeliness of BaseStore depends on the execution of Auto Compaction. Generally, there is a delay of about 5-10 minutes compared with the Merge-On-Read mode.
Note:
Currently, the Beta version only allows for using the standard engine Standard-S 1.1 or later versions to perform Merge-On-Read queries on a DLC Native Table (TC-Iceberg).

Using Flink Streaming Mode for Queries

Reading Incremental Data in Streaming Mode

After using CDC (Change Data Capture) to ingest data into the data lake, you can use the Flink engine to read incremental data in the same task without restarting the task and ensure data reading consistency. By saving the file offset information in the Flink state, the task can continue to read data from the last offset position, ensuring data consistency and streaming incremental data processing. Before querying, you need to set the configuration items execution.runtime-mode and table.dynamic-table-options.enabled, and add OPTIONS('streaming'='true', 'scan.startup.mode'='earliest') during the select query.
-- Run Flink tasks in streaming mode in the current session
SET execution.runtime-mode = streaming;

-- Enable dynamic table parameter configuration to make hint options configured in Flink SQL effective
SET table.dynamic-table-options.enabled = true;

-- Incremental unified reading of BaseStore and ChangeStore
SELECT * FROM keyed OPTIONS('streaming'='true', 'scan.startup.mode'='earliest');
The valid values of the configuration item scan.startup.mode are earliest and latest. earliest indicates reading the data of the entire table and continuing to read incremental data when streaming=true; latest only reads the subsequent data after the current snapshot, excluding the data in the current snapshot.

Using DLC Spark for Queries

When using the DLC Spark standard engine Standard-S 1.1 or later versions to perform Merge-On-Read queries on TC-Iceberg tables, you can directly make queries by table name:
SELECT * FROM db_name.tb_name;
You can also query only the data of BaseStore by adding .base after the table name in the query statement.
SELECT * FROM db_name.tb_name.base;

Using More Engines for Data Queries

Using DLC Presto Engine for Queries

Note:
The Presto engine has been deprecated and is only available for existing users.
The DLC Presto engine can be used to query TC-Iceberg native tables. It directly queries the BaseStore data.
SELECT * FROM db_name.tb_name;

Using EMR Starrocks for Queries

The EMR Starrocks engine can be used to query TC-Iceberg native tables. The basic operations are the same as those for Iceberg native tables. This engine directly queries the BaseStore data. For details, see direct query of DLC internal storage with StarRocks.
SELECT * FROM db_name.tb_name;

Using TCHouse-D for Queries

The TCHouse-D engine can be used to query TC-Iceberg native tables. The basic operations are the same as those for Iceberg native tables. This engine directly queries the BaseStore data.
SELECT * FROM db_name.tb_name;


Help and Support

Was this page helpful?

Help us improve! Rate your documentation experience in 5 mins.

Feedback