Skip to content

Commit 640f079

Browse files
zhyassclaudeChasen-Zhang
authored
docs: add FUSE_TAG system function documentation (#3154)
* docs: add FUSE_TAG system function documentation Add documentation for the new fuse_tag table function that lists snapshot tags on a FUSE table, corresponding to databendlabs/databend#19664. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: fix FUSE_TAG examples to use correct ALTER TABLE CREATE TAG syntax Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: Q <787025321@qq.com>
1 parent 8b96e07 commit 640f079

6 files changed

Lines changed: 110 additions & 0 deletions

File tree

docs/cn/sql-reference/10-sql-commands/00-ddl/21-table-versioning/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,4 @@ SET enable_experimental_table_ref = 1;
3939
|------|------|
4040
| [CREATE SNAPSHOT TAG](01-create-snapshot-tag.md) | 在表快照上创建命名标签 |
4141
| [DROP SNAPSHOT TAG](02-drop-snapshot-tag.md) | 删除快照标签 |
42+
| [FUSE_TAG](../../../20-sql-functions/16-system-functions/fuse_tag.md) | 列出表上所有快照标签 |
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
---
2+
title: FUSE_TAG
3+
---
4+
5+
import FunctionDescription from '@site/src/components/FunctionDescription';
6+
7+
<FunctionDescription description="Introduced or updated: v1.2.894"/>
8+
9+
import EEFeature from '@site/src/components/EEFeature';
10+
11+
<EEFeature featureName='TABLE VERSIONING'/>
12+
13+
返回表的快照标签信息。有关快照标签的更多信息,请参阅[快照标签](../../10-sql-commands/00-ddl/21-table-versioning/index.md#snapshot-tags)
14+
15+
## 语法
16+
17+
```sql
18+
FUSE_TAG('<数据库名称>', '<表名称>')
19+
```
20+
21+
## 输出列
22+
23+
| 列名 | 类型 | 描述 |
24+
|---------------------|--------------------|----------------------------------------------------------------------------|
25+
| name | STRING | 标签名称 |
26+
| snapshot_location | STRING | 标签指向的快照文件 |
27+
| expire_at | TIMESTAMP (可为空) | 过期时间戳;在 CREATE SNAPSHOT TAG 中使用 `RETAIN` 时设置 |
28+
29+
## 示例
30+
31+
```sql
32+
SET enable_experimental_table_ref = 1;
33+
34+
CREATE TABLE mytable(a INT, b INT);
35+
36+
INSERT INTO mytable VALUES(1, 1),(2, 2);
37+
38+
-- 创建快照标签
39+
ALTER TABLE mytable CREATE TAG v1;
40+
41+
INSERT INTO mytable VALUES(3, 3);
42+
43+
-- 创建带过期时间的标签
44+
ALTER TABLE mytable CREATE TAG temp RETAIN 2 DAYS;
45+
46+
SELECT * FROM FUSE_TAG('default', 'mytable');
47+
48+
---
49+
| name | snapshot_location | expire_at |
50+
|------|------------------------------------------------------------|----------------------------|
51+
| v1 | 1/319/_ss/a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4_v4.mpk | NULL |
52+
| temp | 1/319/_ss/f6e5d4c3b2a1f6e5d4c3b2a1f6e5d4c3_v4.mpk | 2025-06-15 10:30:00.000000 |
53+
```

docs/cn/sql-reference/20-sql-functions/16-system-functions/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ title: 系统函数 (System Functions)
1818
| [FUSE_SEGMENT](fuse_segment.md) | 返回表的段信息 | `FUSE_SEGMENT('default', 'mytable')` |
1919
| [FUSE_BLOCK](fuse_block.md) | 返回表的块信息 | `FUSE_BLOCK('default', 'mytable')` |
2020
| [FUSE_COLUMN](fuse_column.md) | 返回表的列信息 | `FUSE_COLUMN('default', 'mytable')` |
21+
| [FUSE_TAG](fuse_tag.md) | 返回表的快照标签信息 | `FUSE_TAG('default', 'mytable')` |
2122

2223
## 存储优化函数
2324

docs/en/sql-reference/10-sql-commands/00-ddl/21-table-versioning/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,4 @@ A snapshot tag attaches a human-readable name to a snapshot. As long as the tag
3939
|---------|-------------|
4040
| [CREATE SNAPSHOT TAG](01-create-snapshot-tag.md) | Create a named tag on a table snapshot |
4141
| [DROP SNAPSHOT TAG](02-drop-snapshot-tag.md) | Remove a snapshot tag |
42+
| [FUSE_TAG](../../../20-sql-functions/16-system-functions/fuse_tag.md) | List all snapshot tags on a table |
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
---
2+
title: FUSE_TAG
3+
---
4+
5+
import FunctionDescription from '@site/src/components/FunctionDescription';
6+
7+
<FunctionDescription description="Introduced or updated: v1.2.894"/>
8+
9+
import EEFeature from '@site/src/components/EEFeature';
10+
11+
<EEFeature featureName='TABLE VERSIONING'/>
12+
13+
Returns the snapshot tags of a table. For more information about snapshot tags, see [Snapshot Tags](../../10-sql-commands/00-ddl/21-table-versioning/index.md#snapshot-tags).
14+
15+
## Syntax
16+
17+
```sql
18+
FUSE_TAG('<database_name>', '<table_name>')
19+
```
20+
21+
## Output Columns
22+
23+
| Column | Type | Description |
24+
|---------------------|--------------------|-----------------------------------------------------------------------------|
25+
| name | STRING | Tag name |
26+
| snapshot_location | STRING | Snapshot file the tag points to |
27+
| expire_at | TIMESTAMP (nullable) | Expiration timestamp; set when `RETAIN` is used in CREATE SNAPSHOT TAG |
28+
29+
## Examples
30+
31+
```sql
32+
SET enable_experimental_table_ref = 1;
33+
34+
CREATE TABLE mytable(a INT, b INT);
35+
36+
INSERT INTO mytable VALUES(1, 1),(2, 2);
37+
38+
-- Create a snapshot tag
39+
ALTER TABLE mytable CREATE TAG v1;
40+
41+
INSERT INTO mytable VALUES(3, 3);
42+
43+
-- Create another tag with expiration
44+
ALTER TABLE mytable CREATE TAG temp RETAIN 2 DAYS;
45+
46+
SELECT * FROM FUSE_TAG('default', 'mytable');
47+
48+
---
49+
| name | snapshot_location | expire_at |
50+
|------|------------------------------------------------------------|----------------------------|
51+
| v1 | 1/319/_ss/a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4_v4.mpk | NULL |
52+
| temp | 1/319/_ss/f6e5d4c3b2a1f6e5d4c3b2a1f6e5d4c3_v4.mpk | 2025-06-15 10:30:00.000000 |
53+
```

docs/en/sql-reference/20-sql-functions/16-system-functions/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ This page provides reference information for the system-related functions in Dat
1818
| [FUSE_SEGMENT](fuse_segment.md) | Returns segment information of a table | `FUSE_SEGMENT('default', 'mytable')` |
1919
| [FUSE_BLOCK](fuse_block.md) | Returns block information of a table | `FUSE_BLOCK('default', 'mytable')` |
2020
| [FUSE_COLUMN](fuse_column.md) | Returns column information of a table | `FUSE_COLUMN('default', 'mytable')` |
21+
| [FUSE_TAG](fuse_tag.md) | Returns snapshot tag information of a table | `FUSE_TAG('default', 'mytable')` |
2122

2223
## Storage Optimization Functions
2324

0 commit comments

Comments
 (0)