使用 DESCRIBE DETAIL 可检索 Delta Lake 或 Apache Iceberg 表的详细元数据,包括文件数量、数据大小、分区列和已启用的表功能。
例如:
DESCRIBE DETAIL '/data/events/'
DESCRIBE DETAIL eventsTable
有关 Spark SQL 语法详细信息,请参阅 DESCRIBE DETAIL。
请参阅 Delta Lake API 文档,了解 Scala/Java/Python 语法详细信息。
细节架构
注释
看到的列取决于所使用的 Databricks Runtime 版本以及已启用的表功能。
DESCRIBE DETAIL 操作的输出只有一行,其架构如下:
| 列 | 类型 | Description |
|---|---|---|
format |
字符串 | 表格的格式(例如, delta 或 iceberg)。 |
id |
字符串 | 表的唯一 ID。 |
name |
字符串 | 在元存储中定义的表名称。 |
description |
字符串 | 表的说明。 |
location |
字符串 | 表的位置。 |
createdAt |
时间戳 | 表创建时间。 |
lastModified |
时间戳 | 表格最后修改的时间。 |
partitionColumns |
字符串数组 | 如果表已分区,则为分区列的名称。 |
numFiles |
long | 该表最新版本中的文件数。 |
sizeInBytes |
int | 表的最新快照的大小(以字节为单位)。 |
properties |
string-string 映射 | 为此表设置的所有属性。 |
minReaderVersion |
int | 可读取表的读取器的最低版本(根据日志协议)。 |
minWriterVersion |
int | 可写入表的编写器(根据日志协议)的最低版本。 |
statistics |
使用字符串键映射 | 其他表级统计信息。 |
tableFeatures |
字符串数组 | 表支持的表功能列表。 请参阅 Delta Lake 功能兼容性和协议。 |
clusteringColumns |
字符串数组 | 用于 Liquid 聚类分析的列。 请参阅对表使用 liquid 聚类分析。 |
示例输出:
+------+--------------------+------------------+-----------+--------------------+--------------------+-------------------+----------------+--------+-----------+----------+----------------+----------------+
|format| id| name|description| location| createdAt| lastModified|partitionColumns|numFiles|sizeInBytes|properties|minReaderVersion|minWriterVersion|
+------+--------------------+------------------+-----------+--------------------+--------------------+-------------------+----------------+--------+-----------+----------+----------------+----------------+
| delta|d31f82d2-a69f-42e...|default.deltatable| null|file:/Users/tuor/...|2020-06-05 12:20:...|2020-06-05 12:20:20| []| 10| 12345| []| 1| 2|
+------+--------------------+------------------+-----------+--------------------+--------------------+-------------------+----------------+--------+-----------+----------+----------------+----------------+