Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Delta Lake transaction log protocol

nhjglgcm.,xdf
August 25, 2020
16

Delta Lake transaction log protocol

nhjglgcm.,xdf

August 25, 2020
Tweet

Transcript

  1. delta lake の 構成要素 version テーブルのversion action の度に increment metadata

    テーブルID, スキーマ, パーティション, 他テーブル設定等, set of files テーブル内データとして存在するファイル set of tombstones テーブルから削除されたデータのファイル set of applications-specific transactions トランザクション
  2. ファイルの仕様 (1 / 2) Data file set of files &

    set of tombstones /mytable/part-00000-3935a07c-416b-4344-ad97- 2a38342ee2fc.c000.snappy.parquet Delta log entries バージョン番号.json 形式 バージョン番号 - 1.json から バージョン番号.json への action のリスト /mytable/_delta_log/00000000000000000000.json
  3. ファイルの仕様 (2 / 2) checkpoint Delta log entries の action

    の適⽤順番を記述 /mytable/_delta_log/00000000000000000003.checkpoint.parquet last checkpoint 最新のcheckpointを指定する クラウドストレージの list file はコストが⾼いため /mytable/_delta_log/_last_checkpoint
  4. action仕様 (1 / 6) Change Metadata Add File and Remove

    File Transaction Identifiers Protocol Evolution Commit Provenance Information
  5. action仕様 (2 / 6) Change Metadata metadataの変更 { "metaData":{ "id":"af23c9d7-fff1-4a5a-a2c8-55c59bd782aa",

    "format":{"provider":"parquet","options":{}}, "schemaString":"...", "partitionColumns":[], "configuration":{ "appendOnly": "true" } } }
  6. action仕様 (3 / 6) Add File and Remove File ファイルの追加・削除

    { "add": { "path":"date=2017-12-10/part-000...c000.gz.parquet", "partitionValues":{"date":"2017-12-10"}, "size":841454, "modificationTime":1512909768000, "dataChange":true "stats":"{\"numRecords\":1,\"minValues\":{\"val..." } } { "remove":{ "path":"part-00001-9…..snappy.parquet", "deletionTimestamp":1515488792485, "dataChange":true } }
  7. action仕様 (4 / 6) Transaction Identifiers トランザクションの開始 { "txn": {

    "appId":"3ba13872-2d47-4e17-86a0-21afd2a22395", "version":364475 } }
  8. action仕様 (6 / 6) Commit Provenance Information コミット情報 { "commitInfo":{

    "timestamp":1515491537026, "userI d":"100121", "userName":"[email protected]", "operation":"INSERT", "operationParameters":{"mode":"Append","partitionBy":"[]"}, "notebook":{ "notebookId":"4443029", "notebookPath":"Users/[email protected]/actions"}, "clusterId":"1027-202406-pooh991" } }
  9. Actionの解決(1 / 2) チェックポイントを構築する際の解決順番の定義 冪等なaction A single protocol action A

    single metaData action A map from appId to transaction version A collection of add actions with unique paths A collection of remove actions with unique path s.
  10. Actionの解決(2 / 2) ⾮冪等な場合 The latest protocol action seen wins

    The latest metaData action seen wins For transaction identifiers, the latest version seen for a ngiven appId wins All add actions for different paths need to be accumulated as a list All remove actions for different paths need to be accumulated as a list
  11. motivation delta lake を spectrum or athenaで利⽤するケース delta log から

    snapshotを作成する必要 athena は公式サポートあり spectrum は⾮公式のOSSあり https://github.com/goibibo/dataplatform_utils spark3.0未対応