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
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,4 @@ SET enable_experimental_table_ref = 1;
|------|------|
| [CREATE SNAPSHOT TAG](01-create-snapshot-tag.md) | 在表快照上创建命名标签 |
| [DROP SNAPSHOT TAG](02-drop-snapshot-tag.md) | 删除快照标签 |
| [FUSE_TAG](../../../20-sql-functions/16-system-functions/fuse_tag.md) | 列出表上所有快照标签 |
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
title: FUSE_TAG
---

import FunctionDescription from '@site/src/components/FunctionDescription';

<FunctionDescription description="Introduced or updated: v1.2.894"/>

import EEFeature from '@site/src/components/EEFeature';

<EEFeature featureName='TABLE VERSIONING'/>

返回表的快照标签信息。有关快照标签的更多信息,请参阅[快照标签](../../10-sql-commands/00-ddl/21-table-versioning/index.md#snapshot-tags)。

## 语法

```sql
FUSE_TAG('<数据库名称>', '<表名称>')
```

## 输出列

| 列名 | 类型 | 描述 |
|---------------------|--------------------|----------------------------------------------------------------------------|
| name | STRING | 标签名称 |
| snapshot_location | STRING | 标签指向的快照文件 |
| expire_at | TIMESTAMP (可为空) | 过期时间戳;在 CREATE SNAPSHOT TAG 中使用 `RETAIN` 时设置 |

## 示例

```sql
SET enable_experimental_table_ref = 1;

CREATE TABLE mytable(a INT, b INT);

INSERT INTO mytable VALUES(1, 1),(2, 2);

-- 创建快照标签
ALTER TABLE mytable CREATE TAG v1;

INSERT INTO mytable VALUES(3, 3);

-- 创建带过期时间的标签
ALTER TABLE mytable CREATE TAG temp RETAIN 2 DAYS;

SELECT * FROM FUSE_TAG('default', 'mytable');

---
| name | snapshot_location | expire_at |
|------|------------------------------------------------------------|----------------------------|
| v1 | 1/319/_ss/a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4_v4.mpk | NULL |
| temp | 1/319/_ss/f6e5d4c3b2a1f6e5d4c3b2a1f6e5d4c3_v4.mpk | 2025-06-15 10:30:00.000000 |
```
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ title: 系统函数 (System Functions)
| [FUSE_SEGMENT](fuse_segment.md) | 返回表的段信息 | `FUSE_SEGMENT('default', 'mytable')` |
| [FUSE_BLOCK](fuse_block.md) | 返回表的块信息 | `FUSE_BLOCK('default', 'mytable')` |
| [FUSE_COLUMN](fuse_column.md) | 返回表的列信息 | `FUSE_COLUMN('default', 'mytable')` |
| [FUSE_TAG](fuse_tag.md) | 返回表的快照标签信息 | `FUSE_TAG('default', 'mytable')` |

## 存储优化函数

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,4 @@ A snapshot tag attaches a human-readable name to a snapshot. As long as the tag
|---------|-------------|
| [CREATE SNAPSHOT TAG](01-create-snapshot-tag.md) | Create a named tag on a table snapshot |
| [DROP SNAPSHOT TAG](02-drop-snapshot-tag.md) | Remove a snapshot tag |
| [FUSE_TAG](../../../20-sql-functions/16-system-functions/fuse_tag.md) | List all snapshot tags on a table |
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
title: FUSE_TAG
---

import FunctionDescription from '@site/src/components/FunctionDescription';

<FunctionDescription description="Introduced or updated: v1.2.894"/>

import EEFeature from '@site/src/components/EEFeature';

<EEFeature featureName='TABLE VERSIONING'/>

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).

## Syntax

```sql
FUSE_TAG('<database_name>', '<table_name>')
```

## Output Columns

| Column | Type | Description |
|---------------------|--------------------|-----------------------------------------------------------------------------|
| name | STRING | Tag name |
| snapshot_location | STRING | Snapshot file the tag points to |
| expire_at | TIMESTAMP (nullable) | Expiration timestamp; set when `RETAIN` is used in CREATE SNAPSHOT TAG |

## Examples

```sql
SET enable_experimental_table_ref = 1;

CREATE TABLE mytable(a INT, b INT);

INSERT INTO mytable VALUES(1, 1),(2, 2);

-- Create a snapshot tag
ALTER TABLE mytable CREATE TAG v1;

INSERT INTO mytable VALUES(3, 3);

-- Create another tag with expiration
ALTER TABLE mytable CREATE TAG temp RETAIN 2 DAYS;

SELECT * FROM FUSE_TAG('default', 'mytable');

---
| name | snapshot_location | expire_at |
|------|------------------------------------------------------------|----------------------------|
| v1 | 1/319/_ss/a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4_v4.mpk | NULL |
| temp | 1/319/_ss/f6e5d4c3b2a1f6e5d4c3b2a1f6e5d4c3_v4.mpk | 2025-06-15 10:30:00.000000 |
```
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ This page provides reference information for the system-related functions in Dat
| [FUSE_SEGMENT](fuse_segment.md) | Returns segment information of a table | `FUSE_SEGMENT('default', 'mytable')` |
| [FUSE_BLOCK](fuse_block.md) | Returns block information of a table | `FUSE_BLOCK('default', 'mytable')` |
| [FUSE_COLUMN](fuse_column.md) | Returns column information of a table | `FUSE_COLUMN('default', 'mytable')` |
| [FUSE_TAG](fuse_tag.md) | Returns snapshot tag information of a table | `FUSE_TAG('default', 'mytable')` |

## Storage Optimization Functions

Expand Down
Loading