DESCRIBE SEMANTIC VIEW
返回语义视图的详细定义,包括逻辑表、外键关系、维度、指标、事实等元数据。
语法
{ DESCRIBE | DESC } SEMANTIC VIEW <name>;
其中
DESCRIBE
DESCRIBE
和
DESC
DESC
可互换使用。
参数说明
| 参数 | 描述 |
|---|
<name>
<name> | 语义视图的标识符。支持多段标识符(如 db.schema.view
db.schema.view )。 |
输出列
DESC SEMANTIC VIEW 的输出以多行键值对形式呈现语义视图的完整结构。包含以下分类:
逻辑表(#logical tables)
每张逻辑表输出 2 行:
| 行 | 列1 | 列2 | 列3 |
|---|
| 表头 | 逻辑表别名 | 关联物理表(workspace.schema.table
workspace.schema.table ) | — |
| 主键 | (空) | 主键列名 | 主键列表 |
orders workspace.schema.orders
primary key o_orderkey
外键关系(#relationships)
每条关系一行:
| 列1 | 列2 | 列3 |
|---|
| (空) | 引用方表 | 引用列 REFERENCE 被引用表(被引用列) |
orders o_custkey REFERENCE customer(c_custkey)
事实(#facts)
customer.cust_order_count `count`(orders.o_orderkey)
维度(#dimensions)
lineitem.l_returnflag lineitem.l_returnflag
指标(#metrics)
lineitem.sum_qty `sum`(lineitem.l_quantity)
使用说明
- 无需运行中的虚拟集群 — 该命令不需要虚拟集群即可执行。
- 权限控制 — 仅返回当前用户有权限访问的语义视图定义。
权限要求
| 权限 | 对象 | 说明 |
|---|
| 任意权限 | 语义视图 | 至少需要对语义视图拥有一个权限 |
示例
查看语义视图结构
DESC SEMANTIC VIEW tpch_sv;
输出示例:
#logical tables
orders tianqi_ws.public.orders
primary key: o_orderkey
customer tianqi_ws.public.customer
primary key: c_custkey
lineitem tianqi_ws.public.lineitem
primary key: l_orderkey,l_linenumber
...
#relationships
orders(o_custkey) REFERENCE customer(c_custkey)
lineitem(l_orderkey) REFERENCE orders(o_orderkey)
lineitem(l_partkey) REFERENCE part(p_partkey)
...
#facts
customer.cust_order_count `count`(orders.o_orderkey)
#dimensions
lineitem.l_returnflag lineitem.l_returnflag
lineitem.l_linestatus lineitem.l_linestatus
lineitem.l_shipdate lineitem.l_shipdate
...
#metrics
lineitem.sum_qty `sum`(lineitem.l_quantity)
lineitem.sum_base_price `sum`(lineitem.l_extendedprice)
lineitem.avg_qty `avg`(lineitem.l_quantity)
...
输出 CREATE DDL
SHOW CREATE SEMANTIC VIEW tpch_sv;
相关命令