This is an automated email from the ASF dual-hosted git repository.
morningman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris-website.git
The following commit(s) were added to refs/heads/master by this push:
new 16673e23bf2 [opt](paimon) add doc for paimon branch and time travel
(#2757)
16673e23bf2 is described below
commit 16673e23bf2fe4419177c95eee78facf4036f19a
Author: Mingyu Chen (Rayner) <[email protected]>
AuthorDate: Sun Aug 17 19:37:46 2025 -0700
[opt](paimon) add doc for paimon branch and time travel (#2757)
## Versions
- [x] dev
- [x] 3.0
- [x] 2.1
- [ ] 2.0
## Languages
- [x] Chinese
- [x] English
## Docs Checklist
- [ ] Checked by AI
- [ ] Test Cases Built
---
docs/lakehouse/catalogs/paimon-catalog.md | 79 +++++++++++++++++++++-
.../current/lakehouse/catalogs/paimon-catalog.md | 76 +++++++++++++++++++++
.../lakehouse/catalogs/paimon-catalog.md | 76 +++++++++++++++++++++
.../lakehouse/catalogs/paimon-catalog.md | 76 +++++++++++++++++++++
.../lakehouse/catalogs/paimon-catalog.md | 79 +++++++++++++++++++++-
.../lakehouse/catalogs/paimon-catalog.md | 79 +++++++++++++++++++++-
6 files changed, 459 insertions(+), 6 deletions(-)
diff --git a/docs/lakehouse/catalogs/paimon-catalog.md
b/docs/lakehouse/catalogs/paimon-catalog.md
index fc694098c2a..8114e983197 100644
--- a/docs/lakehouse/catalogs/paimon-catalog.md
+++ b/docs/lakehouse/catalogs/paimon-catalog.md
@@ -245,7 +245,7 @@ SELECT * FROM paimon_ctl.paimon_db.paimon_tbl LIMIT 10;
### Batch Incremental Query
-> This feature is supported since version 3.1.0
+> Since version 3.1.0
Supports [Batch
Incremental](https://paimon.apache.org/docs/master/flink/sql-query/#batch-incremental)
queries for Paimon, similar to Flink.
@@ -285,10 +285,85 @@ Parameter:
Refer to the [Paimon
documentation](https://paimon.apache.org/docs/master/maintenance/configurations/)
for further details about these parameters.
+### Time Travel
+
+> Since version 3.1.0
+
+Supports reading specified snapshots of Paimon tables.
+
+By default, read requests only read the latest version of snapshots.
+
+You can query snapshots of a specified Paimon table through the `$snapshots`
table function:
+
+```sql
+Doris > SELECT snapshot_id,commit_time FROM paimon_tbl$snapshots;
++-------------+-------------------------+
+| snapshot_id | commit_time |
++-------------+-------------------------+
+| 1 | 2025-08-17 06:05:52.740 |
+| 2 | 2025-08-17 06:05:52.979 |
+| 3 | 2025-08-17 06:05:53.240 |
+| 4 | 2025-08-17 06:05:53.561 |
++-------------+-------------------------+
+```
+
+You can use `FOR TIME AS OF` and `FOR VERSION AS OF` statements to read
historical version data based on snapshot ID or the time when the snapshot was
created. Examples:
+
+```sql
+-- Notice: The time must be precise down to the millisecond.
+SELECT * FROM paimon_tbl FOR TIME AS OF "2025-08-17 06:05:52.740";
+-- Notice: The timestamp must be precise down to the millisecond.
+SELECT * FROM paimon_tbl FOR TIME AS OF 1755381952740;
+-- Use snapshot id
+SELECT * FROM paimon_tbl FOR VERSION AS OF 1;
+```
+
+### Branch and Tag
+
+> Since version 3.1.0
+
+Supports reading branches and tags of specified Paimon tables.
+
+You can use the `$branches` and `$tags` system tables to view branches and
tags of Paimon tables:
+
+```
+Doris > SELECT * FROM paimon_tbl$branches;
++-------------+-------------------------+
+| branch_name | create_time |
++-------------+-------------------------+
+| b_1 | 2025-08-17 06:34:37.294 |
+| b_2 | 2025-08-17 06:34:37.297 |
++-------------+-------------------------+
+
+Doris > SELECT * FROM paimon_tbl$tags;
++----------+-------------+-----------+-------------------------+--------------+-------------+---------------+
+| tag_name | snapshot_id | schema_id | commit_time | record_count
| create_time | time_retained |
++----------+-------------+-----------+-------------------------+--------------+-------------+---------------+
+| t_1 | 1 | 0 | 2025-08-17 06:05:52.740 | 3
| NULL | NULL |
+| t_2 | 2 | 0 | 2025-08-17 06:05:52.979 | 6
| NULL | NULL |
+| t_3 | 3 | 0 | 2025-08-17 06:05:53.240 | 9
| NULL | NULL |
+| t_4 | 4 | 0 | 2025-08-17 06:05:53.561 | 12
| NULL | NULL |
++----------+-------------+-----------+-------------------------+--------------+-------------+---------------+
+```
+
+Supports various syntax forms to be compatible with systems like Spark/Trino:
+
+```sql
+-- BRANCH
+SELECT * FROM paimon_tbl@brand(branch1);
+SELECT * FROM paimon_tbl@brand("name" = "branch1");
+
+-- TAG
+SELECT * FROM paimon_tbl@tag(tag1);
+SELECT * FROM paimon_tbl@tag("name" = "tag1");
+SELECT * FROM paimon_tbl FOR VERSION AS OF 'tag1';
+```
+
+For the `FOR VERSION AS OF` syntax, Doris will automatically determine whether
the parameter is a timestamp
## System Tables
-> This feature is supported since version 3.1.0
+> Since version 3.1.0
Doris supports querying Paimon system tables to retrieve table-related
metadata. System tables can be used to view snapshot history, manifest files,
data files, partitions, and other information.
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/lakehouse/catalogs/paimon-catalog.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/lakehouse/catalogs/paimon-catalog.md
index 8527d15fb5c..bef8cd8f0e1 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/lakehouse/catalogs/paimon-catalog.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/lakehouse/catalogs/paimon-catalog.md
@@ -285,6 +285,82 @@ SELECT * FROM
paimon_table@incr('startTimestamp'='1750844949000', 'endTimestamp'
可参阅 [Paimon
文档](https://paimon.apache.org/docs/master/maintenance/configurations/)
进一步了解这些参数。
+### 时间旅行
+
+> 该功能自 3.1.0 版本支持
+
+支持读取 Paimon 表指定的 Snapshot。
+
+默认情况下,读取请求只会读取最新版本的快照。
+
+可以通过 `$snapshots` 表函数查询查询指定 Paimon 表的 Snapshot:
+
+```sql
+Doris > SELECT snapshot_id,commit_time FROM paimon_tbl$snapshots;
++-------------+-------------------------+
+| snapshot_id | commit_time |
++-------------+-------------------------+
+| 1 | 2025-08-17 06:05:52.740 |
+| 2 | 2025-08-17 06:05:52.979 |
+| 3 | 2025-08-17 06:05:53.240 |
+| 4 | 2025-08-17 06:05:53.561 |
++-------------+-------------------------+
+```
+
+可以使用 `FOR TIME AS OF` 和 `FOR VERSION AS OF` 语句,根据快照 ID 或者快照产生的时间读取历史版本的数据。示例如下:
+
+```sql
+-- Notice: The time must be precise down to the millisecond.
+SELECT * FROM paimon_tbl FOR TIME AS OF "2025-08-17 06:05:52.740";
+-- Notice: The timestamp must be precise down to the millisecond.
+SELECT * FROM paimon_tbl FOR TIME AS OF 1755381952740;
+-- Use snapshot id
+SELECT * FROM paimon_tbl FOR VERSION AS OF 1;
+```
+
+### Branch 和 Tag
+
+> 该功能自 3.1.0 版本支持
+
+支持读取指定 Paimon 表的分支(Branch)和标签(Tag)。
+
+可以使用 `$branches` 和 `$tags` 系统表查看 Paimon 表的 Branch 和 Tag:
+
+```
+Doris > SELECT * FROM paimon_tbl$branches;
++-------------+-------------------------+
+| branch_name | create_time |
++-------------+-------------------------+
+| b_1 | 2025-08-17 06:34:37.294 |
+| b_2 | 2025-08-17 06:34:37.297 |
++-------------+-------------------------+
+
+Doris > SELECT * FROM paimon_tbl$tags;
++----------+-------------+-----------+-------------------------+--------------+-------------+---------------+
+| tag_name | snapshot_id | schema_id | commit_time | record_count
| create_time | time_retained |
++----------+-------------+-----------+-------------------------+--------------+-------------+---------------+
+| t_1 | 1 | 0 | 2025-08-17 06:05:52.740 | 3
| NULL | NULL |
+| t_2 | 2 | 0 | 2025-08-17 06:05:52.979 | 6
| NULL | NULL |
+| t_3 | 3 | 0 | 2025-08-17 06:05:53.240 | 9
| NULL | NULL |
+| t_4 | 4 | 0 | 2025-08-17 06:05:53.561 | 12
| NULL | NULL |
++----------+-------------+-----------+-------------------------+--------------+-------------+---------------+
+```
+
+支持多种不同的语法形式,以兼容 Spark/Trino 等系统的语法。
+
+```sql
+-- BRANCH
+SELECT * FROM paimon_tbl@brand(branch1);
+SELECT * FROM paimon_tbl@brand("name" = "branch1");
+
+-- TAG
+SELECT * FROM paimon_tbl@tag(tag1);
+SELECT * FROM paimon_tbl@tag("name" = "tag1");
+SELECT * FROM paimon_tbl FOR VERSION AS OF 'tag1';
+```
+
+对于 `FOR VERSION AS OF` 语法,Doris 会根据后面的参数,自动判断是时间戳还是 Tag 名称。
+
## 系统表
> 该功能自 3.1.0 版本支持
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/lakehouse/catalogs/paimon-catalog.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/lakehouse/catalogs/paimon-catalog.md
index 8527d15fb5c..bef8cd8f0e1 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/lakehouse/catalogs/paimon-catalog.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/lakehouse/catalogs/paimon-catalog.md
@@ -285,6 +285,82 @@ SELECT * FROM
paimon_table@incr('startTimestamp'='1750844949000', 'endTimestamp'
可参阅 [Paimon
文档](https://paimon.apache.org/docs/master/maintenance/configurations/)
进一步了解这些参数。
+### 时间旅行
+
+> 该功能自 3.1.0 版本支持
+
+支持读取 Paimon 表指定的 Snapshot。
+
+默认情况下,读取请求只会读取最新版本的快照。
+
+可以通过 `$snapshots` 表函数查询查询指定 Paimon 表的 Snapshot:
+
+```sql
+Doris > SELECT snapshot_id,commit_time FROM paimon_tbl$snapshots;
++-------------+-------------------------+
+| snapshot_id | commit_time |
++-------------+-------------------------+
+| 1 | 2025-08-17 06:05:52.740 |
+| 2 | 2025-08-17 06:05:52.979 |
+| 3 | 2025-08-17 06:05:53.240 |
+| 4 | 2025-08-17 06:05:53.561 |
++-------------+-------------------------+
+```
+
+可以使用 `FOR TIME AS OF` 和 `FOR VERSION AS OF` 语句,根据快照 ID 或者快照产生的时间读取历史版本的数据。示例如下:
+
+```sql
+-- Notice: The time must be precise down to the millisecond.
+SELECT * FROM paimon_tbl FOR TIME AS OF "2025-08-17 06:05:52.740";
+-- Notice: The timestamp must be precise down to the millisecond.
+SELECT * FROM paimon_tbl FOR TIME AS OF 1755381952740;
+-- Use snapshot id
+SELECT * FROM paimon_tbl FOR VERSION AS OF 1;
+```
+
+### Branch 和 Tag
+
+> 该功能自 3.1.0 版本支持
+
+支持读取指定 Paimon 表的分支(Branch)和标签(Tag)。
+
+可以使用 `$branches` 和 `$tags` 系统表查看 Paimon 表的 Branch 和 Tag:
+
+```
+Doris > SELECT * FROM paimon_tbl$branches;
++-------------+-------------------------+
+| branch_name | create_time |
++-------------+-------------------------+
+| b_1 | 2025-08-17 06:34:37.294 |
+| b_2 | 2025-08-17 06:34:37.297 |
++-------------+-------------------------+
+
+Doris > SELECT * FROM paimon_tbl$tags;
++----------+-------------+-----------+-------------------------+--------------+-------------+---------------+
+| tag_name | snapshot_id | schema_id | commit_time | record_count
| create_time | time_retained |
++----------+-------------+-----------+-------------------------+--------------+-------------+---------------+
+| t_1 | 1 | 0 | 2025-08-17 06:05:52.740 | 3
| NULL | NULL |
+| t_2 | 2 | 0 | 2025-08-17 06:05:52.979 | 6
| NULL | NULL |
+| t_3 | 3 | 0 | 2025-08-17 06:05:53.240 | 9
| NULL | NULL |
+| t_4 | 4 | 0 | 2025-08-17 06:05:53.561 | 12
| NULL | NULL |
++----------+-------------+-----------+-------------------------+--------------+-------------+---------------+
+```
+
+支持多种不同的语法形式,以兼容 Spark/Trino 等系统的语法。
+
+```sql
+-- BRANCH
+SELECT * FROM paimon_tbl@brand(branch1);
+SELECT * FROM paimon_tbl@brand("name" = "branch1");
+
+-- TAG
+SELECT * FROM paimon_tbl@tag(tag1);
+SELECT * FROM paimon_tbl@tag("name" = "tag1");
+SELECT * FROM paimon_tbl FOR VERSION AS OF 'tag1';
+```
+
+对于 `FOR VERSION AS OF` 语法,Doris 会根据后面的参数,自动判断是时间戳还是 Tag 名称。
+
## 系统表
> 该功能自 3.1.0 版本支持
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/lakehouse/catalogs/paimon-catalog.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/lakehouse/catalogs/paimon-catalog.md
index 8527d15fb5c..bef8cd8f0e1 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/lakehouse/catalogs/paimon-catalog.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/lakehouse/catalogs/paimon-catalog.md
@@ -285,6 +285,82 @@ SELECT * FROM
paimon_table@incr('startTimestamp'='1750844949000', 'endTimestamp'
可参阅 [Paimon
文档](https://paimon.apache.org/docs/master/maintenance/configurations/)
进一步了解这些参数。
+### 时间旅行
+
+> 该功能自 3.1.0 版本支持
+
+支持读取 Paimon 表指定的 Snapshot。
+
+默认情况下,读取请求只会读取最新版本的快照。
+
+可以通过 `$snapshots` 表函数查询查询指定 Paimon 表的 Snapshot:
+
+```sql
+Doris > SELECT snapshot_id,commit_time FROM paimon_tbl$snapshots;
++-------------+-------------------------+
+| snapshot_id | commit_time |
++-------------+-------------------------+
+| 1 | 2025-08-17 06:05:52.740 |
+| 2 | 2025-08-17 06:05:52.979 |
+| 3 | 2025-08-17 06:05:53.240 |
+| 4 | 2025-08-17 06:05:53.561 |
++-------------+-------------------------+
+```
+
+可以使用 `FOR TIME AS OF` 和 `FOR VERSION AS OF` 语句,根据快照 ID 或者快照产生的时间读取历史版本的数据。示例如下:
+
+```sql
+-- Notice: The time must be precise down to the millisecond.
+SELECT * FROM paimon_tbl FOR TIME AS OF "2025-08-17 06:05:52.740";
+-- Notice: The timestamp must be precise down to the millisecond.
+SELECT * FROM paimon_tbl FOR TIME AS OF 1755381952740;
+-- Use snapshot id
+SELECT * FROM paimon_tbl FOR VERSION AS OF 1;
+```
+
+### Branch 和 Tag
+
+> 该功能自 3.1.0 版本支持
+
+支持读取指定 Paimon 表的分支(Branch)和标签(Tag)。
+
+可以使用 `$branches` 和 `$tags` 系统表查看 Paimon 表的 Branch 和 Tag:
+
+```
+Doris > SELECT * FROM paimon_tbl$branches;
++-------------+-------------------------+
+| branch_name | create_time |
++-------------+-------------------------+
+| b_1 | 2025-08-17 06:34:37.294 |
+| b_2 | 2025-08-17 06:34:37.297 |
++-------------+-------------------------+
+
+Doris > SELECT * FROM paimon_tbl$tags;
++----------+-------------+-----------+-------------------------+--------------+-------------+---------------+
+| tag_name | snapshot_id | schema_id | commit_time | record_count
| create_time | time_retained |
++----------+-------------+-----------+-------------------------+--------------+-------------+---------------+
+| t_1 | 1 | 0 | 2025-08-17 06:05:52.740 | 3
| NULL | NULL |
+| t_2 | 2 | 0 | 2025-08-17 06:05:52.979 | 6
| NULL | NULL |
+| t_3 | 3 | 0 | 2025-08-17 06:05:53.240 | 9
| NULL | NULL |
+| t_4 | 4 | 0 | 2025-08-17 06:05:53.561 | 12
| NULL | NULL |
++----------+-------------+-----------+-------------------------+--------------+-------------+---------------+
+```
+
+支持多种不同的语法形式,以兼容 Spark/Trino 等系统的语法。
+
+```sql
+-- BRANCH
+SELECT * FROM paimon_tbl@brand(branch1);
+SELECT * FROM paimon_tbl@brand("name" = "branch1");
+
+-- TAG
+SELECT * FROM paimon_tbl@tag(tag1);
+SELECT * FROM paimon_tbl@tag("name" = "tag1");
+SELECT * FROM paimon_tbl FOR VERSION AS OF 'tag1';
+```
+
+对于 `FOR VERSION AS OF` 语法,Doris 会根据后面的参数,自动判断是时间戳还是 Tag 名称。
+
## 系统表
> 该功能自 3.1.0 版本支持
diff --git a/versioned_docs/version-2.1/lakehouse/catalogs/paimon-catalog.md
b/versioned_docs/version-2.1/lakehouse/catalogs/paimon-catalog.md
index fc694098c2a..8114e983197 100644
--- a/versioned_docs/version-2.1/lakehouse/catalogs/paimon-catalog.md
+++ b/versioned_docs/version-2.1/lakehouse/catalogs/paimon-catalog.md
@@ -245,7 +245,7 @@ SELECT * FROM paimon_ctl.paimon_db.paimon_tbl LIMIT 10;
### Batch Incremental Query
-> This feature is supported since version 3.1.0
+> Since version 3.1.0
Supports [Batch
Incremental](https://paimon.apache.org/docs/master/flink/sql-query/#batch-incremental)
queries for Paimon, similar to Flink.
@@ -285,10 +285,85 @@ Parameter:
Refer to the [Paimon
documentation](https://paimon.apache.org/docs/master/maintenance/configurations/)
for further details about these parameters.
+### Time Travel
+
+> Since version 3.1.0
+
+Supports reading specified snapshots of Paimon tables.
+
+By default, read requests only read the latest version of snapshots.
+
+You can query snapshots of a specified Paimon table through the `$snapshots`
table function:
+
+```sql
+Doris > SELECT snapshot_id,commit_time FROM paimon_tbl$snapshots;
++-------------+-------------------------+
+| snapshot_id | commit_time |
++-------------+-------------------------+
+| 1 | 2025-08-17 06:05:52.740 |
+| 2 | 2025-08-17 06:05:52.979 |
+| 3 | 2025-08-17 06:05:53.240 |
+| 4 | 2025-08-17 06:05:53.561 |
++-------------+-------------------------+
+```
+
+You can use `FOR TIME AS OF` and `FOR VERSION AS OF` statements to read
historical version data based on snapshot ID or the time when the snapshot was
created. Examples:
+
+```sql
+-- Notice: The time must be precise down to the millisecond.
+SELECT * FROM paimon_tbl FOR TIME AS OF "2025-08-17 06:05:52.740";
+-- Notice: The timestamp must be precise down to the millisecond.
+SELECT * FROM paimon_tbl FOR TIME AS OF 1755381952740;
+-- Use snapshot id
+SELECT * FROM paimon_tbl FOR VERSION AS OF 1;
+```
+
+### Branch and Tag
+
+> Since version 3.1.0
+
+Supports reading branches and tags of specified Paimon tables.
+
+You can use the `$branches` and `$tags` system tables to view branches and
tags of Paimon tables:
+
+```
+Doris > SELECT * FROM paimon_tbl$branches;
++-------------+-------------------------+
+| branch_name | create_time |
++-------------+-------------------------+
+| b_1 | 2025-08-17 06:34:37.294 |
+| b_2 | 2025-08-17 06:34:37.297 |
++-------------+-------------------------+
+
+Doris > SELECT * FROM paimon_tbl$tags;
++----------+-------------+-----------+-------------------------+--------------+-------------+---------------+
+| tag_name | snapshot_id | schema_id | commit_time | record_count
| create_time | time_retained |
++----------+-------------+-----------+-------------------------+--------------+-------------+---------------+
+| t_1 | 1 | 0 | 2025-08-17 06:05:52.740 | 3
| NULL | NULL |
+| t_2 | 2 | 0 | 2025-08-17 06:05:52.979 | 6
| NULL | NULL |
+| t_3 | 3 | 0 | 2025-08-17 06:05:53.240 | 9
| NULL | NULL |
+| t_4 | 4 | 0 | 2025-08-17 06:05:53.561 | 12
| NULL | NULL |
++----------+-------------+-----------+-------------------------+--------------+-------------+---------------+
+```
+
+Supports various syntax forms to be compatible with systems like Spark/Trino:
+
+```sql
+-- BRANCH
+SELECT * FROM paimon_tbl@brand(branch1);
+SELECT * FROM paimon_tbl@brand("name" = "branch1");
+
+-- TAG
+SELECT * FROM paimon_tbl@tag(tag1);
+SELECT * FROM paimon_tbl@tag("name" = "tag1");
+SELECT * FROM paimon_tbl FOR VERSION AS OF 'tag1';
+```
+
+For the `FOR VERSION AS OF` syntax, Doris will automatically determine whether
the parameter is a timestamp
## System Tables
-> This feature is supported since version 3.1.0
+> Since version 3.1.0
Doris supports querying Paimon system tables to retrieve table-related
metadata. System tables can be used to view snapshot history, manifest files,
data files, partitions, and other information.
diff --git a/versioned_docs/version-3.0/lakehouse/catalogs/paimon-catalog.md
b/versioned_docs/version-3.0/lakehouse/catalogs/paimon-catalog.md
index fc694098c2a..8114e983197 100644
--- a/versioned_docs/version-3.0/lakehouse/catalogs/paimon-catalog.md
+++ b/versioned_docs/version-3.0/lakehouse/catalogs/paimon-catalog.md
@@ -245,7 +245,7 @@ SELECT * FROM paimon_ctl.paimon_db.paimon_tbl LIMIT 10;
### Batch Incremental Query
-> This feature is supported since version 3.1.0
+> Since version 3.1.0
Supports [Batch
Incremental](https://paimon.apache.org/docs/master/flink/sql-query/#batch-incremental)
queries for Paimon, similar to Flink.
@@ -285,10 +285,85 @@ Parameter:
Refer to the [Paimon
documentation](https://paimon.apache.org/docs/master/maintenance/configurations/)
for further details about these parameters.
+### Time Travel
+
+> Since version 3.1.0
+
+Supports reading specified snapshots of Paimon tables.
+
+By default, read requests only read the latest version of snapshots.
+
+You can query snapshots of a specified Paimon table through the `$snapshots`
table function:
+
+```sql
+Doris > SELECT snapshot_id,commit_time FROM paimon_tbl$snapshots;
++-------------+-------------------------+
+| snapshot_id | commit_time |
++-------------+-------------------------+
+| 1 | 2025-08-17 06:05:52.740 |
+| 2 | 2025-08-17 06:05:52.979 |
+| 3 | 2025-08-17 06:05:53.240 |
+| 4 | 2025-08-17 06:05:53.561 |
++-------------+-------------------------+
+```
+
+You can use `FOR TIME AS OF` and `FOR VERSION AS OF` statements to read
historical version data based on snapshot ID or the time when the snapshot was
created. Examples:
+
+```sql
+-- Notice: The time must be precise down to the millisecond.
+SELECT * FROM paimon_tbl FOR TIME AS OF "2025-08-17 06:05:52.740";
+-- Notice: The timestamp must be precise down to the millisecond.
+SELECT * FROM paimon_tbl FOR TIME AS OF 1755381952740;
+-- Use snapshot id
+SELECT * FROM paimon_tbl FOR VERSION AS OF 1;
+```
+
+### Branch and Tag
+
+> Since version 3.1.0
+
+Supports reading branches and tags of specified Paimon tables.
+
+You can use the `$branches` and `$tags` system tables to view branches and
tags of Paimon tables:
+
+```
+Doris > SELECT * FROM paimon_tbl$branches;
++-------------+-------------------------+
+| branch_name | create_time |
++-------------+-------------------------+
+| b_1 | 2025-08-17 06:34:37.294 |
+| b_2 | 2025-08-17 06:34:37.297 |
++-------------+-------------------------+
+
+Doris > SELECT * FROM paimon_tbl$tags;
++----------+-------------+-----------+-------------------------+--------------+-------------+---------------+
+| tag_name | snapshot_id | schema_id | commit_time | record_count
| create_time | time_retained |
++----------+-------------+-----------+-------------------------+--------------+-------------+---------------+
+| t_1 | 1 | 0 | 2025-08-17 06:05:52.740 | 3
| NULL | NULL |
+| t_2 | 2 | 0 | 2025-08-17 06:05:52.979 | 6
| NULL | NULL |
+| t_3 | 3 | 0 | 2025-08-17 06:05:53.240 | 9
| NULL | NULL |
+| t_4 | 4 | 0 | 2025-08-17 06:05:53.561 | 12
| NULL | NULL |
++----------+-------------+-----------+-------------------------+--------------+-------------+---------------+
+```
+
+Supports various syntax forms to be compatible with systems like Spark/Trino:
+
+```sql
+-- BRANCH
+SELECT * FROM paimon_tbl@brand(branch1);
+SELECT * FROM paimon_tbl@brand("name" = "branch1");
+
+-- TAG
+SELECT * FROM paimon_tbl@tag(tag1);
+SELECT * FROM paimon_tbl@tag("name" = "tag1");
+SELECT * FROM paimon_tbl FOR VERSION AS OF 'tag1';
+```
+
+For the `FOR VERSION AS OF` syntax, Doris will automatically determine whether
the parameter is a timestamp
## System Tables
-> This feature is supported since version 3.1.0
+> Since version 3.1.0
Doris supports querying Paimon system tables to retrieve table-related
metadata. System tables can be used to view snapshot history, manifest files,
data files, partitions, and other information.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]