ICEBERG_META
更新时间:2025-10-16
描述
iceberg_meta 表函数(table-valued-function,tvf),可以用于读取 iceberg 表的各类元数据信息,如操作历史、生成的快照、文件元数据等。
语法
SQL
1ICEBERG_META(
2 "table" = "<table>",
3 "query_type" = "<query_type>"
4 );
必填参数
iceberg_meta 表函数 tvf 中的每一个参数都是一个 "key"="value" 对
| Field | Description |
|---|---|
<table> |
完整的表名,需要按照目录名。库名.表名的格式,填写需要查看的 iceberg 表名。 |
<query_type> |
元数据类型,目前仅支持 snapshots。 |
示例(Examples)
-
读取并访问 iceberg 表格式的 snapshots 元数据。
SQL1select * from iceberg_meta("table" = "ctl.db.tbl", "query_type" = "snapshots"); -
可以配合
desc function使用SQL1desc function iceberg_meta("table" = "ctl.db.tbl", "query_type" = "snapshots"); -
查看 iceberg 表的 snapshots
SQL1select * from iceberg_meta("table" = "iceberg_ctl.test_db.test_tbl", "query_type" = "snapshots");Text1+------------------------+----------------+---------------+-----------+-------------------+------------------------------+ 2| committed_at | snapshot_id | parent_id | operation | manifest_list | summary | 3+------------------------+----------------+---------------+-----------+-------------------+------------------------------+ 4| 2022-09-20 11:14:29 | 64123452344 | -1 | append | hdfs:/path/to/m1 | {"flink.job-id":"xxm1", ...} | 5| 2022-09-21 10:36:35 | 98865735822 | 64123452344 | overwrite | hdfs:/path/to/m2 | {"flink.job-id":"xxm2", ...} | 6| 2022-09-21 21:44:11 | 51232845315 | 98865735822 | overwrite | hdfs:/path/to/m3 | {"flink.job-id":"xxm3", ...} | 7+------------------------+----------------+---------------+-----------+-------------------+------------------------------+ -
根据 snapshot_id 字段筛选
SQL1select * from iceberg_meta("table" = "iceberg_ctl.test_db.test_tbl", "query_type" = "snapshots") where snapshot_id = 98865735822;Text1+------------------------+----------------+---------------+-----------+-------------------+------------------------------+ 2| committed_at | snapshot_id | parent_id | operation | manifest_list | summary | 3+------------------------+----------------+---------------+-----------+-------------------+------------------------------+ 4| 2022-09-21 10:36:35 | 98865735822 | 64123452344 | overwrite | hdfs:/path/to/m2 | {"flink.job-id":"xxm2", ...} | 5+------------------------+----------------+---------------+-----------+-------------------+------------------------------+
