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

Open Table Format (OTF) が必要になった背景とその機能 (2025.10...

Open Table Format (OTF) が必要になった背景とその機能 (2025.10.28)

2025年10月28日開催、JAWS-UG初心者支部 / BigData支部 / 千葉支部 合同の「Apache Iceberg勉強会」での発表資料です。

なぜ Apache Iceberg のような Open Table Format が必要になったかを説明した後、 Apache Icebergを例に、表を操作すると内部データはどのように変化し、高度な機能を実現しているのかを解説しています。

※デモで利用した Parquet CLIや、Avro-tools、AthenaCLI、s3fsの導入方法は以下に記載しています。

https://portablecode.info/2025/10/26/parquet-cli-avro-tools-athenacli-s3fs/

Avatar for Akira Shimosako

Akira Shimosako

October 27, 2025
Tweet

More Decks by Akira Shimosako

Other Decks in Technology

Transcript

  1. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. #jawsug #jawsug_bgnr #bdjaws #jawsugchiba © 2025, Amazon Web Services, Inc. or its affiliates. All rights reserved. Open Table Format (OTF) が 必要になった背景とその機能 下佐粉 昭 (Akira Shimosako) Amazon Web Services Japan 2025.10.28 JAWS-UG初心者支部/JAWS-UGビッグデータ支部/JAWS-UG千葉支部
  2. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. #jawsug #jawsug_bgnr #bdjaws #jawsugchiba 下佐粉 昭 (Akira Shimosako) アマゾン ウェブ サービス ジャパン プリンシパル アナリティクススペシャリスト ソリューションアーキテクト 専門:データレイク、データウェアハウス 書籍:「AWSではじめるデータレイク」等 Podcast : OTF Talk Icebergを含むOTFの話題を扱うPodcast https://www.otftalk.com/ @simosako 2 @otftalk
  3. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. #jawsug #jawsug_bgnr #bdjaws #jawsugchiba 3 SNSでのアウトプット・感想・コメント お待ちしております! ※どれでも良いです • JAWS-UG #jawsug • 初心者支部 #jawsug_bgnr • ビッグデータ支部 #bdjaws • 千葉支部 #jawsugchiba
  4. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. #jawsug #jawsug_bgnr #bdjaws #jawsugchiba 応用 (可視化等) データレイクのきほん 多様な生データをデータレイクに蓄積、処理と蓄積を分離する データレイクの中で加工(前処理)し、処理系が使いやすい形を維持する 収集 データレイク 処理系 (DWH,RDB等) 応用 (可視化等) 収集&格納 処理系 (DWH,RDB等) カタログ (メタデータ) 変形・整形 (前処理) 蓄積 生データ 整形・ 最適化済 4
  5. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. #jawsug #jawsug_bgnr #bdjaws #jawsugchiba データレイク上で 多様なワークロードが実行されるようになると… • RDB等のソースを小さい単位でデータレイクに連続反映したい • [課題] 書込みと読込みのパフォーマンス • [課題] ソースのスキーマ変更への追従 • 個人情報の削除要求への対応(GDPR、令和2年 改正個人情報保護法) • [課題] GDPR 等の特定の個人情報の効率的な削除、更新をしたい要件 • [課題] データ削除中のトランザクションの一貫性 • データレイク上のデータを元に多様な実験を継続的に行う • [課題] 実験を再現するための、過去のスナップショットの参照 • [課題] 継続的に更新されるデータに対する一貫性を確保した参照 5
  6. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. #jawsug #jawsug_bgnr #bdjaws #jawsugchiba データレイクの課題と、必要になる機能 • レコードレベルの操作が非効率 => 効率的な部分更新・読み取り • 同時書き込み時の整合性を担保できない => トランザクション • 過去の状態の復元が難しい => タイムトラベルクエリ • スキーマの変更の負担が大きい => スキーマエボリューション 6
  7. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. #jawsug #jawsug_bgnr #bdjaws #jawsugchiba Open Table Format レイヤーを挟むことで 新たな機能要求に対応する Amazon S3 その他 オブジェクトストレージ 、 ローカルストレージ等 Open Table Format レイヤー Open Table Format でのデータ読み書き メタデータの管理、効率的なデータ操作 等 分散処理エンジン レイヤー データレイヤー 7
  8. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. #jawsug #jawsug_bgnr #bdjaws #jawsugchiba 8 • 表構造のデータを扱うためのフォーマット • Open:クエリエンジンやストレージ実装からの独立 • 用途に応じて最適なツールを切り替えてことができる • 例)機会学習エンジニアはJupyter notebook (Python)でアクセス、バッチ処理はSpark、アド ホッククエリは Trino 等 • 各ツール間でデータ転送が不要に • メタデータ層の分離:データとメタデータを分離して管理し、高度な機能を実現 • メタデータ=データを管理するためのデータ • メタデータを管理・維持することが、通常のファイル保存との大きな違い Open Table Format の特徴と機能
  9. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. #jawsug #jawsug_bgnr #bdjaws #jawsugchiba 9 • 操作履歴の管理(スナップショット) • いつ、どのファイルがどう追加・削除されたか • テーブル構造(スキーマ) • 例: id (int), name (string), date (date) • データファイルの場所 • 例: s3://my-bucket/table1/data/file1.parquet • パーティション(データがどう分割されているか) • 例: 日付ごと、地域ごと • 統計情報 • 例:各ファイルの最小値・最大値、行数 • より効率的なクエリ実行を可能にする : 分離したメタデータで何を管理しているのか? 補足:厳密には一部のメタデータはデー タと分離したメタデータ側だけでなく、 データ側に含まれる部分もあります
  10. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. #jawsug #jawsug_bgnr #bdjaws #jawsugchiba 10 例)巨大表へ小さいデータの挿入 メタデータを活用した高度な操作(概要) メタデータ層 データ層 クエリエンジン /data/file1 Table File path employee /data/file1 ①employee表はどこ? ②/data/file1 ③データ取得 クエリエンジン /data/file1 Table File path employee /data/file1 /data/file2 ② ③データ追加 ① /data/file2 ※補足:これは Marge-On-Read の例ですが、Copy-On-Write書き 込みも実装によっては可能です
  11. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. #jawsug #jawsug_bgnr #bdjaws #jawsugchiba 11 ここまでのまとめ • Open Table Format を活用することでParquetやCSVを直接利用する場合よりも、 高度な機能を提供する • 高速な差分更新、バージョニング、トランザクション、タイムトラベル… • メタデータを管理することで高度な機能を実現している • 通常のRDBMSを置き換えるものではない(性能特性も機能も異なる)
  12. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. #jawsug #jawsug_bgnr #bdjaws #jawsugchiba © 2025, Amazon Web Services, Inc. or its affiliates. All rights reserved. Apache Iceberg
  13. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. #jawsug #jawsug_bgnr #bdjaws #jawsugchiba Apache Iceberg 概要 • Open Table Format (OTF) の 1 つ • 2017 年時点、S3 に 60 PB の Data Lake を 擁する Netflix が開発 • 2018 年、 Apache Software Foundation 寄贈 データレイクの課題を解決する様々な特徴を備える • 小さい単位での更新の性能向上 • Serializable Isolation (トランザクション) • Time Travel (過去バージョン参照) • Evolution (スキーマ変更等) https://iceberg.apache.org/ 13
  14. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. #jawsug #jawsug_bgnr #bdjaws #jawsugchiba 14 Apache Iceberg はテーブルフォーマット 「Apache Iceberg」という独立したソフトウェアが存在するわけではない • 「Iceberg テーブル仕様」が テーブルの構造と振る舞いを定義 • メタデータ層で、新バージョンや追記を 管理し、カタログでその情報を管理して いる • 各ツールがテーブル仕様に従ってデータ を操作することで、同じテーブルを 共有できる • 仕様をどの範囲で /どのようにサポート するかは各ツールに依存する Iceberg テーブル仕様のイメージ
  15. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. #jawsug #jawsug_bgnr #bdjaws #jawsugchiba Apache Iceberg の構成要素 15 • Iceberg を読み書きするツール (クエリエンジン) • 各ツールが Iceberg のテーブル仕様に準拠してテーブルを操作する • 異なるクエリエンジン間で同一のIcebergテーブルを共有できる • Iceberg カタログ • Icebergはカタログが必須 • テーブル情報の管理とトランザクションの一貫性の保証を担う • 様々なカタログ実装が存在するが、共通のIceberg REST APIでアクセス可能 • ストレージ • テーブルの実データとメタデータを配置する • 信頼性が高くスケーラブルで、コスト効率の良いストレージを使用する
  16. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. #jawsug #jawsug_bgnr #bdjaws #jawsugchiba 16 Apache Icebergのメタデータ構成 Catalog はオブジェクト(表)の最新Metadata file をポイント Metadata fileは有効なSnapshot(更新履歴)IDの一覧 を保存 (JSON) Manifest listは各Snapshotに含まれるManifest fileの 一覧(Avro) Manifest fileはData fileの位置や、統計情報(行数、 サイズ、列統計)を保存(Avro) Data Fileは実データを保存(Parquet)
  17. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. #jawsug #jawsug_bgnr #bdjaws #jawsugchiba 17 補足:Apache Parquet と Apache Avro Apache Parquet • 列指向のバイナリフォーマット • スキーマ情報を持つ • 高い圧縮率 • メタデータにより述部のプッシュダ ウンを支援 • 集計・分析用途 Apache Avro • 行指向のバイナリフォーマット • スキーマ情報を持つ • 動的型付け • コンパクト • 行の書き込み、行単位の処理 データやメタデータの保存には JSON、Apache Parquet、Apache Avroが利用されます ParquetもAvroもバイナリフォーマットであり、効率的なデータ格納を実現しています
  18. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. #jawsug #jawsug_bgnr #bdjaws #jawsugchiba © 2025, Amazon Web Services, Inc. or its affiliates. All rights reserved. [デモ] Amazon Athena + Amazon S3 で Apache Iceberg の データ構造を確認する
  19. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. #jawsug #jawsug_bgnr #bdjaws #jawsugchiba 19 AWSサービスでIcebergを利用する • Iceberg を読み書きするツール (クエリエンジン) • Amazon Athena、 Amazon EMR、AWS Glue、Amazon Redshift … • AWS Lambda + PyIceberg 等、多数の選択肢 • Iceberg REST カタログ • AWS Glue (Glue Data Catalog) • サーバーレスのカタログサービス、Glue以外からも利用可能 • Hive Catalog互換かつ、Iceberg REST APIを提供 • ストレージ • Amazon S3 (汎用S3バケット) or Amazon S3 Tables (テーブルバケット)
  20. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. #jawsug #jawsug_bgnr #bdjaws #jawsugchiba 補足:Apache IcebergをサポートするAWSサービス(一例) 概要 用途(一例) Amazon Athena クエリエンジン データレイク(S3)上のデータへのアドホッククエリ Amazon Redshift DWH Redshift内部の表に、外部表(Iceberg)を取り込まず にジョイン Amazon EMR Hadoop / Spark Spark/Hadoopアプリ次第(TrinoでSQLクエリ、 Sparkで前処理や機械学習…) AWS Glue ETL & カタログ ETL(データの前処理) AWS Lambda (+PyIcebergなど) コンピュートエンジン イベントドリブンのデータ演算、軽量ETL … Amazon Managed Service for Apache Flink ストリーミング処理 高いスループットでデータをIceberg表に取り込む Amazon MSK (Managed Streaming for Apache Kafka) ストリーミング処理 高いスループットでデータをIceberg表に取り込む Amazon SageMaker AI Feature Store フィーチャーストア(機 械学習) 特徴量セットをIcebergフォーマットで保存
  21. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. #jawsug #jawsug_bgnr #bdjaws #jawsugchiba 補足:デモで利用したツール • AWS CLI https://docs.aws.amazon.com/ja_jp/cli/latest/userguide/ • AthenaCLI https://athenacli.readthedocs.io/ • s3fs-fuse https://github.com/s3fs-fuse/s3fs-fuse • Parquet CLI (Java) https://github.com/apache/parquet-java/tree/master/parquet-cli • Avro-tools (Java) https://avro.apache.org/ ※Parquet, Avroを読み書きするツールは複数ありますが、私が試した範囲では上記の Java版が最も機能が豊富で安定して動作しました。上記ツール(AWS CLI以外)のイン ストール方法については以下に簡単な説明を書きました。 https://portablecode.info/parquet-cli-avro-tools-athenacli-s3fs/
  22. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. #jawsug #jawsug_bgnr #bdjaws #jawsugchiba 22 AthenaでIceberg表の作成 ‘table_type’ = ‘ICEBERG’ と指定する事でIceberg表を作成できる 他にformatでデータフォーマットを、 write_compressionで圧縮手法を指定できる
  23. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. #jawsug #jawsug_bgnr #bdjaws #jawsugchiba 23 カタログからメタデータロケーションを得る Glue data catalogからの出力 : Snapshotが まだ無い
  24. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. #jawsug #jawsug_bgnr #bdjaws #jawsugchiba 24 データを挿入するとSnapshotが作成され、 各種メタデータも更新される Glue data catalogからの出力 カタログのメタデータロケーションが更新された (00001-…metadata.json) 今後クエリエンジンはこのMetadataを読む
  25. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. #jawsug #jawsug_bgnr #bdjaws #jawsugchiba 25 Metadata/以下にファイルが追加されているが、 以前のファイルも残っている metadata/以下に新しいMetadata(00001-*metadata.json)と、 Manifest list (snap-*.avro)と、Manifest file (0975…avro)が作成された。 以前のMetadata (00000-*.metadata.json)も残っており、参照可能 実データはdata/以下にParquetフォーマットで作成された
  26. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. #jawsug #jawsug_bgnr #bdjaws #jawsugchiba 26 新しいMetadata(*.metadata.json) はManifest listを指す Manifest list (snap-*.avro)はManifest file一覧を指す Manifest file は実データを指す Manifest list (snap-…avro) Manifest file (xxxx-xxx-.avro) 実データの位置とフォーマット
  27. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. #jawsug #jawsug_bgnr #bdjaws #jawsugchiba 27 作成されたParquetファイル $ parquet-cli head *.parquet {emp_id": 1, "name": "Matt Wood", "hire_date": 16509, "job": "Manager"} {"emp_id": 2, "name": "Sarah Johnson", "hire_date": 17734, "job": "Staff"} : {emp_id": 5, "name": "Michael Brown", "hire_date": 17056, "job": "Staff"} $ parquet-cli meta *.parquet (:中略) Row group 0: count: 5 62.20 B records start: 4 total(compressed): 311 B total(uncompressed):246 B -------------------------------------------------------------------------------- type encodings count avg size nulls min / max emp_id INT32 Z _ 5 11.20 B 0 "1" / "5" name BINARY Z _ 5 22.80 B 0 "David Chen" / "Sarah Johnson" hire_date INT32 Z _ 5 11.20 B 0 "2012-11-08" / "2020-01-30" job BINARY Z _ R 5 17.00 B 0 "Manager" / "Staff" data/以下のparquetファイル に実データが入っている Min/Maxや行数等、クエリ最適化に利 用される情報はparquet内に含まれる
  28. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. #jawsug #jawsug_bgnr #bdjaws #jawsugchiba 28 削除処理とSNAPSHOTの追加 DELETE FROM jawsug2025.employee WHERE emp_id = 4; SELECT * FROM employee; +--------+---------------+------------+---------+ | emp_id | name | hire_date | job | +--------+---------------+------------+---------+ | 1 | Matt Wood | 2015-03-15 | Manager | | 2 | Sarah Johnson | 2018-07-22 | Staff | | 3 | David Chen | 2012-11-08 | Manager | | 5 | Michael Brown | 2016-09-12 | Staff | +--------+---------------+------------+---------+ SELECT committed_at, snapshot_id, parent_id FROM "jawsug2025"."employee$snapshots" order by committed_at asc; +----------------------------------+---------------------+---------------------+ | committed_at | snapshot_id | parent_id | +----------------------------------+---------------------+---------------------+ | 2025-10-26 05:24:17.520000+00:00 | 3350052430520546615 | <null> | | 2025-10-26 05:48:47.952000+00:00 | 7711465472496385718 | 3350052430520546615 | +----------------------------------+---------------------+---------------------+ 削除も更新の一種なので SNAPSHOTが追加される Parent(親)も指定されている
  29. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. #jawsug #jawsug_bgnr #bdjaws #jawsugchiba 29 タイムトラベルクエリ 以前のSNAPSHOT IDを指定することで、 その時点のデータをクエリできる SELECT * FROM jawsug2025.employee FOR VERSION AS OF 3350052430520546615; +--------+---------------+------------+---------+ | emp_id | name | hire_date | job | +--------+---------------+------------+---------+ | 1 | Matt Wood | 2015-03-15 | Manager | | 2 | Sarah Johnson | 2018-07-22 | Staff | | 3 | David Chen | 2012-11-08 | Manager | | 4 | Emily Davis | 2020-01-30 | Staff | | 5 | Michael Brown | 2016-09-12 | Staff | +--------+---------------+------------+---------+
  30. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. #jawsug #jawsug_bgnr #bdjaws #jawsugchiba 30 削除の表現 {"emp_id": 1, "name": "Matt Wood", "hire_date": 16509, "job": "Manager"} {"emp_id": 2, "name": "Sarah Johnson", "hire_date": 17734, "job": "Staff"} {"emp_id": 3, "name": "David Chen", "hire_date": 15652, "job": "Manager"} {"emp_id": 4, "name": "Emily Davis", "hire_date": 18291, "job": "Staff"} {"emp_id": 5, "name": "Michael Brown", "hire_date": 17056, "job": "Staff"} {"file_path": "s3://s3fs-sandbox- 2025/employee/data/PQnPiQ/20251027_092034_00175_ka7kd-f30a01fc-5240-4d2f- 84cb-1f1c2ee2c7bf.parquet", "pos": 3} Manifest fileから辿れる2つのparquet ファイル 1つは削除前のファイルを指している もう1つにはどの位置(pos)を削除したかというデータが入っている。この2 つを合成することでSnapshot時点のデータ作成している (Marge-on-Read)
  31. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. #jawsug #jawsug_bgnr #bdjaws #jawsugchiba まとめ 31 • Open Table Format はテーブルデータを高速かつ便利に扱う仕組みを備えてお り、従来のデータレイクの課題を解決する • Openであり、高度な機能を複数のツールにまたがって利用できる • Apache Iceberg はOTFの1つ。実データとメタデータを分離し、カタログがメ タデータへの入り口になっている • AWSでIcebergを利用する場合は、S3もしくはS3 Tablesにデータを配置、カタ ログはGlue Data Catalogを利用することで多様なクエリエンジンを利用可能
  32. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. #jawsug #jawsug_bgnr #bdjaws #jawsugchiba 32 関連情報 Apache Iceberg https://iceberg.apache.org/ Open Table Format on AWS ハンズオン https://x.gd/KMoIz [書籍] 実践 Apache Iceberg https://gihyo.jp/book/2025/978-4-297-15074-7 デモで利用した Parquet CLI/Avro tools/AthenaCLI/s3fsの導入方法 https://portablecode.info/parquet-cli-avro-tools-athenacli-s3fs/ 本スライド https://x.gd/pB6ZQ
  33. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. #jawsug #jawsug_bgnr #bdjaws #jawsugchiba © 2025, Amazon Web Services, Inc. or its affiliates. All rights reserved. 補足資料: Amazon S3 Tables
  34. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. #jawsug #jawsug_bgnr #bdjaws #jawsugchiba 34 汎用S3バケットとS3テーブルバケット 汎用S3バケット S3テーブルバケット 最小管理単位 オブジェクト Icebergテーブル 操作 S3 API Iceberg クライアントから ※一部S3 Tables API 大規模利用時のス ケーラビリティ ユーザーによるKey/Prefix設計でスケール を実現 スケールする事を意識した内部デザイン メンテナンス • Iceberg クエリエンジンから実行 • Glue Data Catalog の自動メンテナン ス機能を利用 S3 Tables側で自動的に実施 Iceberg REST APIに 対応したカタログ • AWS Glue Data Catalog • 独自のカタログを利用することも可能 • S3 Tablesに内蔵のREST Catalog • AWS Glue Data Catalogに連携 • S3Tables Catalog jar
  35. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. #jawsug #jawsug_bgnr #bdjaws #jawsugchiba 35 Amazon S3 Tables Apache Iceberg サポートが組み込まれた クラウドオブジェクトストア • 新たに「S3 テーブルバケット」を作成して利用 • 汎用S3バケットとは別 • Iceberg表単位での管理 = オブジェクト単位ではない • 性能を維持するよう、メンテナンスタスクが自動実行される • コンパクション、不要オブジェクトの削除… • Iceberg REST catalog機能を内蔵、Glue Catalogに連携するこ とも可能
  36. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. #jawsug #jawsug_bgnr #bdjaws #jawsugchiba Iceberg では、テーブルが更新される度に メタデータ層とデータ層の両方に 変更差分が蓄積される → テーブルの書き込み / 読み込み性能と コスト効率を最適化するための 「テーブルメンテナンス」の必要が生じる S3 Tablesはメンテナンス機能がビルトイン Glue Data CatalogはIcebergメンテナンスタス クの実行をサポート(汎用S3バケット用) テーブルメンテナンスの重要性 36 Iceberg テーブル仕様のイメージ