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

HUDI_META

説明

hudi_meta テーブル値関数(tvf)は、hudiメタデータ、操作履歴、テーブルのタイムライン、インスタント状態などを読み取るために使用されます。

構文

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

必須パラメータ

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

FieldDescription
<table>完全なテーブル名。表示したい hudi テーブルについて database_name.table_name の形式で指定する必要があります。
<query_type>表示したいメタデータのタイプ。現在は timeline のみがサポートされています。

  • timeline の hudi 表形式メタデータを読み取りアクセスする。

    select * from hudi_meta("table" = "ctl.db.tbl", "query_type" = "timeline");
  • desc function と組み合わせて使用できます:

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

    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 |
    +-------------------+--------+--------------------------+-----------+-----------------------+