Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions docs/lakehouse/catalogs/iceberg-catalog.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -1794,6 +1794,25 @@ For an Iceberg Database, you must first drop all tables under the database befor
);
```

Starting from version 4.1.0, Doris supports specifying sort columns when creating an Iceberg table. When writing data, the data will be sorted according to the specified sort columns to achieve better query performance.

```sql
CREATE TABLE ordered_table (
`id` int NULL,
`name` text NULL,
`score` double NULL,
`create_time` datetimev2(6) NULL
)
ORDER BY (`id` ASC NULLS FIRST, `score` DESC NULLS LAST)
PROPERTIES (
"write-format" = "parquet",
"write.parquet.compression-codec" = "zstd"
);
```

- If no sort columns are specified, no sorting will be performed during writes.
- The default sort order is ASC NULLS FIRST.

After creation, you can use the `SHOW CREATE TABLE` command to view the Iceberg table creation statement. For details about partition functions, see the [Partitioning](#) section.

* **Dropping Tables**
Expand Down Expand Up @@ -2542,6 +2561,51 @@ EXECUTE set_current_snapshot ("ref" = "v1.0");
3. The operation will fail if the specified snapshot ID or reference does not exist
4. If the current snapshot is already the target snapshot, the operation returns directly without creating a new snapshot

### publish_changes

The `publish_changes` operation is used in the WAP (Write-Audit-Publish) mode to publish a snapshot with the specified `wap.id` as the current table state.
It locates the snapshot whose `wap.id` matches the given `wap_id` and cherry-picks it onto the current table, making the staged data visible to all read operations.

**Syntax:**

```sql
ALTER TABLE [catalog.][database.]table_name
EXECUTE publish_changes("wap_id" = "<wap_id>")
```

**Parameters:**

**Parameters:**

Comment on lines +2578 to +2579
Copy link

Copilot AI Feb 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The "Parameters:" heading is duplicated on lines 2576-2578. One of these duplicate headings should be removed.

Suggested change
**Parameters:**

Copilot uses AI. Check for mistakes.
| Parameter Name | Type | Required | Description |
| -------------- | ---- | -------- | ----------- |
| `wap_id` | STRING | Yes | The WAP snapshot ID to be published |

**Return Value:**

Executing `publish_changes` returns a result set with the following 2 columns:

| Column Name | Type | Description |
| ----------- | ---- | ----------- |
| `previous_snapshot_id` | STRING | The ID of the current snapshot before the publish operation (NULL if none) |
| `current_snapshot_id` | STRING | The ID of the new snapshot created and set as current after publishing |

**Examples:**

```sql
-- Publish the snapshot whose WAP ID is test_wap_001
ALTER TABLE iceberg_db.iceberg_table
EXECUTE publish_changes("wap_id" = "test_wap_001");
```

**Notes:**

1. This operation does not support a WHERE clause, nor PARTITION/PARTITIONS clauses
2. It is only meaningful for Iceberg tables with write.wap.enabled = true and WAP snapshots generated via wap.id
3. If no snapshot is found for the specified wap_id, the operation fails and throws an error
4. After publishing, the new snapshot becomes the current snapshot
5. If there is no snapshot before publishing, previous_snapshot_id may be NULL

## Iceberg Table Optimization

### View Data File Distribution
Expand Down
Loading