@@ -37,14 +37,14 @@ namespace iceberg {
3737
3838// / \brief API for replacing files in a table.
3939// /
40- // / This operation accumulates file additions and deletions, produces a new
41- // / Snapshot of the changes, and commits that snapshot as the current.
40+ // / This API accumulates file additions and deletions, produces a new Snapshot
41+ // / of the changes, and commits that snapshot as the current.
4242// /
4343// / When committing, these changes will be applied to the latest table snapshot.
4444// / Commit conflicts will be resolved by applying the changes to the new latest
4545// / snapshot and reattempting the commit. If any of the deleted files are no
46- // / longer in the latest snapshot when reattempting, the commit will throw a
47- // / ValidationException .
46+ // / longer in the latest snapshot when reattempting, the commit will fail
47+ // / validation .
4848// /
4949// / Note that the new state of the table after each rewrite must be logically
5050// / equivalent to the original table state.
@@ -63,7 +63,9 @@ class ICEBERG_EXPORT RewriteFiles : public MergingSnapshotUpdate {
6363 // / \brief Remove a data file from the current table state.
6464 // /
6565 // / This rewrite operation may change the size or layout of the data files.
66- // / The set of live data records must never change.
66+ // / When applicable, it is also recommended to discard already deleted records
67+ // / while rewriting data files. However, the set of live data records must
68+ // / never change.
6769 // /
6870 // / \param data_file a rewritten data file
6971 // / \return this for method chaining
@@ -72,32 +74,47 @@ class ICEBERG_EXPORT RewriteFiles : public MergingSnapshotUpdate {
7274 // / \brief Remove a delete file from the table state.
7375 // /
7476 // / This rewrite operation may change the size or layout of the delete files.
75- // / The set of applicable delete records must never change.
77+ // / When applicable, it is also recommended to discard delete records for files
78+ // / that are no longer part of the table state. However, the set of applicable
79+ // / delete records must never change.
7680 // /
7781 // / \param delete_file a rewritten delete file
7882 // / \return this for method chaining
7983 RewriteFiles& DeleteDeleteFile (const std::shared_ptr<DataFile>& delete_file);
8084
81- // / \brief Add a new data file or delete file .
85+ // / \brief Add a new data file.
8286 // /
83- // / This rewrite operation may change the size or layout of the files.
84- // / The set of live data records must never change.
87+ // / This rewrite operation may change the size or layout of the data files.
88+ // / When applicable, it is also recommended to discard already deleted records
89+ // / while rewriting data files. However, the set of live data records must
90+ // / never change.
8591 // /
86- // / \param file a new file ( data or delete)
92+ // / \param file a new data file
8793 // / \return this for method chaining
8894 RewriteFiles& AddDataFile (const std::shared_ptr<DataFile>& file);
8995
9096 // / \brief Add a new delete file.
9197 // /
98+ // / This rewrite operation may change the size or layout of the delete files.
99+ // / When applicable, it is also recommended to discard delete records for files
100+ // / that are no longer part of the table state. However, the set of applicable
101+ // / delete records must never change.
102+ // /
92103 // / \param delete_file a new delete file
93104 // / \return this for method chaining
94105 RewriteFiles& AddDeleteFile (const std::shared_ptr<DataFile>& delete_file);
95106
96107 // / \brief Add a new delete file with the given data sequence number.
97108 // /
109+ // / This rewrite operation may change the size or layout of the delete files.
110+ // / When applicable, it is also recommended to discard delete records for files
111+ // / that are no longer part of the table state. However, the set of applicable
112+ // / delete records must never change.
113+ // /
98114 // / To ensure equivalence in the set of applicable delete records, the
99115 // / sequence number of the delete file must be the max sequence number of
100- // / the delete files that it is replacing.
116+ // / the delete files that it is replacing. Rewriting equality deletes that
117+ // / belong to different sequence numbers is not allowed.
101118 // /
102119 // / \param delete_file a new delete file
103120 // / \param data_sequence_number data sequence number to append on the file
@@ -108,8 +125,8 @@ class ICEBERG_EXPORT RewriteFiles : public MergingSnapshotUpdate {
108125 // / \brief Configure the data sequence number for this rewrite operation.
109126 // /
110127 // / This data sequence number will be used for all new data files that are
111- // / added in this rewrite. This is helpful to avoid commit conflicts between
112- // / data compaction and adding equality deletes.
128+ // / added in this rewrite. This method is helpful to avoid commit conflicts
129+ // / between data compaction and adding equality deletes.
113130 // /
114131 // / \param sequence_number a data sequence number
115132 // / \return this for method chaining
@@ -119,8 +136,9 @@ class ICEBERG_EXPORT RewriteFiles : public MergingSnapshotUpdate {
119136 // / that contains the same data. The sequence number provided will be used for
120137 // / all the data files added.
121138 // /
122- // / \param files_to_delete files that will be replaced (deleted)
123- // / \param files_to_add files that will be added
139+ // / \param files_to_delete files that will be replaced (deleted), cannot be
140+ // / null or empty
141+ // / \param files_to_add files that will be added, cannot be null or empty
124142 // / \param sequence_number sequence number to use for all data files added
125143 // / \return this for method chaining
126144 RewriteFiles& RewriteDataFiles (
@@ -152,12 +170,6 @@ class ICEBERG_EXPORT RewriteFiles : public MergingSnapshotUpdate {
152170 // / \return this for method chaining
153171 RewriteFiles& ValidateFromSnapshot (int64_t snapshot_id);
154172
155- // / \brief Perform operations on a particular branch.
156- // /
157- // / \param branch name of a SnapshotRef of type branch
158- // / \return this for method chaining
159- RewriteFiles& ToBranch (const std::string& branch);
160-
161173 std::string operation () override ;
162174
163175 protected:
0 commit comments