apache / apache/iceberg-cpp

feat: implement ReplacePartitions (two-PR plan)

オープン
#775 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
C++
スター
221
フォーク
124
平均マージ
1日 16時間
マージ済み PR(30日)
21

説明

## Overview

This issue tracks the implementation of `ReplacePartitions` in C++, assigned in #637.

`ReplacePartitions` performs dynamic partition overwrite: each file added to the operation marks its entire partition for deletion, and on commit, existing files in those partitions are atomically replaced. The resulting snapshot uses `operation="overwrite"` and summary property `"replace-partitions"="true"`.

## Implementation Plan

### PR 1 — Core implementation

New files:
- `src/iceberg/update/replace_partitions.h`
- `src/iceberg/update/replace_partitions.cc`

Modified files:
- `src/iceberg/snapshot.h` — add `kReplacePartitions` constant to `SnapshotSummaryFields`
- `src/iceberg/type_fwd.h` — add `class ReplacePartitions;`
- `src/iceberg/CMakeLists.txt` — register new source

### PR 2 — Table/Transaction API surface + tests

Modified files:
- `src/iceberg/table.h` / `table.cc` — add `NewReplacePartitions()`
- `src/iceberg/transaction.h` / `transaction.cc` — add `NewReplacePartitions()`

New files:
- `src/iceberg/test/replace_partitions_test.cc`
- `src/iceberg/test/CMakeLists.txt` — register test

## Design

`ReplacePartitions` extends `SnapshotUpdate` (same pattern as `FastAppend`) and uses `ManifestFilterManager` to mark existing partition files as DELETED:

- `AddFile(file)`: calls `filter_manager_.DropPartition(spec_id, partition)`, accumulates new file in `new_data_files_by_spec_`
- `ValidateAppendOnly()`: calls `filter_manager_.FailAnyDelete()`
- `Apply()`: for unpartitioned tables calls `filter_manager_.DeleteByRowFilter(AlwaysTrue)`; calls `FilterManifests()` on existing snapshot, then prepends new manifests
- `operation()`: returns `DataOperation::kOverwrite`
- `Summary()`: sets `"replace-partitions"="true"`

Relates to: #637

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

まず既存の FastAppend と SnapshotUpdate の実装を読み、次に一覧にある snapshot、manifest、table、transaction の各ファイルを調べます。計画されている replace_partitions_test.cc とその CMake への登録を使用して、パーティションの置換、非パーティション時の動作、operation および summary のメタデータ、新しい table および transaction API がカバーされていることを確認します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
cpp
領域
data-engineering
issue の種類
機能追加
難易度
4/5
見積もり時間
3〜5日
活発さ
静か
明瞭さ
明確に書かれている
初心者へのやさしさ
58/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。