搭配 Amazon Redshift 使用 Apache Iceberg 資料表 - Amazon Redshift

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

搭配 Amazon Redshift 使用 Apache Iceberg 資料表

您可以使用 Redshift Spectrum 或 Redshift Serverless 查詢 AWS Glue Data Catalog中編目的 Apache Iceberg 資料表。Apache Iceberg 是一種用於資料湖的開放原始碼資料表格式。如需詳細資訊,請參閱 Apache Iceberg 文件中的 Apache Iceberg

Amazon Redshift 為查詢 Apache Iceberg 資料表提供交易一致性。您可以在使用 Amazon Amazon Redshift 執行查詢EMR時,使用 Amazon Athena 和 Amazon 等合規服務 ACID (原子性、一致性、隔離、耐久性) 操控資料表中的資料。Amazon Redshift 可以使用 Apache Iceberg 中繼資料中儲存的表格統計資料來最佳化查詢計劃並減少查詢處理期間的檔案掃描。使用 Amazon RedshiftSQL,您可以將 Redshift 表與資料湖表結合在一起。

若要開始將 Iceberg 資料表與 Amazon Redshift 搭配使用:

  1. 使用兼容的服務,如 Amazon 雅典娜或亞馬遜在 AWS Glue Data Catalog 數據庫上創建 Apache 冰山表。EMR若要使用 Athena 建立 Iceberg 資料表,請參閱《Amazon Athena 使用者指南》中的使用 Apache Iceberg 資料表

  2. 建立具有可存取資料湖的關聯IAM角色的 Amazon Redshift 叢集或 Redshift 無伺服器工作群組。如需如何建立叢集或工作群組的詳細資訊,請參閱 Amazon Redshift 佈建的資料倉儲入門Amazon Redshift 入門指南中的開始使用 Redshift 無伺服器資料倉儲

  3. 使用查詢編輯器 v2 或協力廠商用SQL戶端 Connect 線至叢集或工作群組。如需如何使用查詢編輯器 v2 連線的詳細資訊,請參閱 Amazon Redshift 管理指南中的使用用SQL戶端工具連線至 Amazon Redshift 資料倉儲

  4. 在 Amazon Redshift 資料庫中為包含 Iceberg 資料表的特定資料目錄資料庫建立外部結構描述。如需建立外部結構描述的相關資訊,請參閱建立 Amazon Redshift Spectrum 外部結構描述

  5. 執行SQL查詢以存取您建立的外部結構描述中的 Iceberg 資料表。

將 Apache Iceberg 資料表與 Amazon Redshift 搭配使用時的注意事項

將 Amazon Redshift 與 Iceberg 資料表結合使用時,請考慮以下事項:

  • Iceberg 版本支援 - Amazon Redshift 支援對以下版本的 Iceberg 資料表執行查詢:

    • 版本 1 定義如何使用不可變資料檔案管理大型分析表。

    • 版本 2 增加支援資料列層級更新和刪除的功能,同時保持現有資料檔案不變,並使用刪除檔案來處理資料表資料變更。

    有關版本 1 和版本 2 資料表之間的區別,請參閱 Apache Iceberg 文件中的格式版本變更

  • 僅限查詢 - Amazon Redshift 支援 Apache Iceberg 資料表的唯讀存取。它支援交易一致的選擇查詢。您可以使用 Amazon Athena 等服務來定義和更新 AWS Glue Data Catalog中 Iceberg 資料表的結構描述。

  • 新增分割區 - 您不需要為 Apache Iceberg 資料表手動新增分割區。Amazon Redshift 會自動偵測 Apache Iceberg 資料表中的新分割區,而且不需要手動操作即可更新資料表定義中的分割區。分割區規格中的任何變更也會自動套用至您的查詢,而無需任何使用者介入。

  • 冰山資料導入亞馬遜紅移 — 您可以使用INSERTINTO或 CREATE TABLE AS 命令將資料從冰山表格匯入本機 Amazon Redshift 表格中。您目前無法使用該COPY命令將 Apache 冰山表的內容導入本地 Amazon Redshift 表中。

  • 具體化視觀表 - 您可以在 Apache Iceberg 資料表上建立具體化視觀表,就像 Amazon Redshift 中的任何其他外部資料表一樣。其他資料湖資料表格式的考量相同,也適用於 Apache Iceberg 資料表。目前不支援累加式更新、自動重新整理、自動查詢重新寫入,以及資料湖資料表MVs上的自動。

  • AWS Lake Formation 精細的存取控制 — Amazon Redshift 支援 Apache 冰山資料表上的 AWS Lake Formation 精細存取控制。

  • 使用者定義的資料處理參數 - Amazon Redshift 支援 Apache Iceberg 資料表上的使用者定義資料處理參數。您可以在現有檔案上使用使用者定義的資料處理參數來自訂外部資料表中查詢的資料,以避免掃描錯誤。這些參數提供處理資料表結構描述與檔案實際資料之間不相符的功能。您也可以在 Apache Iceberg 資料表上使用使用者定義的資料處理參數。

  • 資料共用 - Amazon Redshift 資料共用目前不支援資料湖資料表,包括 Apache Iceberg 資料表。

  • 時間歷程查詢 - Apache Iceberg 資料表目前不支援時間歷程查詢。

  • 定價 - 當您從叢集存取 Iceberg 資料表時,您需要支付 Redshift Spectrum 定價的費用。當您從工作群組存取 Iceberg 資料表時,您需要支付 Redshift Serverless 定價的費用。如需 Redshift Spectrum 和 Redshift Serverless 定價的相關資訊,請參閱 Amazon Redshift 定價