メインコンテンツまでスキップ
バージョン: 4.x

HUDI_META

デスクリプション

hudi_meta table-valued-function(tvf)は、hudiメタデータ、操作履歴、Tableのtimeline、instantの状態などを読み取るために使用されます。

Syntax

HUDI_META(
"table" = "<table>",
"query_type" = "<query_type>"
);

必須パラメータ

hudi_metaTable関数(tvf)の各パラメータは"key"="value"ペアです。

フィールド説明
<table>完全なTable名。表示したいhudiTableに対してdatabase_name.table_nameの形式で指定する必要があります。
<query_type>表示したいメタデータのタイプ。現在はtimelineのみがサポートされています。

  • timelineのhudiTable形式メタデータを読み取り、アクセスします。

    select * from hudi_meta("table" = "ctl.db.tbl", "query_type" = "timeline");

desc function と併用できます:

```sql
desc function hudi_meta("table" = "ctl.db.tbl", "query_type" = "timeline");
```
  • hudi Tableのタイムラインを検査する

    select * from hudi_meta("table" = "hudi_ctl.test_db.test_tbl", "query_type" = "timeline");
    +-------------------+--------+--------------------------+-----------+-----------------------+
    | timestamp | action | file_name | state | state_transition_time |
    +-------------------+--------+--------------------------+-----------+-----------------------+
    | 20240724195843565 | commit | 20240724195843565.commit | COMPLETED | 20240724195844269 |
    | 20240724195845718 | commit | 20240724195845718.commit | COMPLETED | 20240724195846653 |
    | 20240724195848377 | commit | 20240724195848377.commit | COMPLETED | 20240724195849337 |
    | 20240724195850799 | commit | 20240724195850799.commit | COMPLETED | 20240724195851676 |
    +-------------------+--------+--------------------------+-----------+-----------------------+
  • タイムスタンプでフィルタリング

    select * from hudi_meta("table" = "hudi_ctl.test_db.test_tbl", "query_type" = "timeline") where timestamp = 20240724195843565;
    +-------------------+--------+--------------------------+-----------+-----------------------+
    | timestamp | action | file_name | state | state_transition_time |
    +-------------------+--------+--------------------------+-----------+-----------------------+
    | 20240724195843565 | commit | 20240724195843565.commit | COMPLETED | 20240724195844269 |
    +-------------------+--------+--------------------------+-----------+-----------------------+