Skip to content

Commit 36a4c55

Browse files
authored
Merge pull request JanKaul#245 from gruuya/fix-n-splits
fix: use correct number of splits for deletes
2 parents e2001b6 + 747d334 commit 36a4c55

File tree

1 file changed

+5
-13
lines changed

1 file changed

+5
-13
lines changed

iceberg-rust/src/table/transaction/operation.rs

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,6 @@ impl Operation {
139139
)?
140140
};
141141

142-
let n_data_splits = manifest_list_writer.n_splits(n_data_files, Content::Data);
143-
let n_delete_splits =
144-
manifest_list_writer.n_splits(n_delete_files, Content::Deletes);
145-
146142
let new_datafile_iter = data_files.into_iter().map(|data_file| {
147143
ManifestEntry::builder()
148144
.with_format_version(table_metadata.format_version)
@@ -165,21 +161,17 @@ impl Operation {
165161

166162
// Write manifest files
167163
// Split manifest file if limit is exceeded
168-
for (content, files, n_files, n_splits) in [
169-
(
170-
Content::Data,
171-
Either::Left(new_datafile_iter),
172-
n_data_files,
173-
n_data_splits,
174-
),
164+
for (content, files, n_files) in [
165+
(Content::Data, Either::Left(new_datafile_iter), n_data_files),
175166
(
176167
Content::Deletes,
177168
Either::Right(new_deletefile_iter),
178169
n_delete_files,
179-
n_delete_splits,
180170
),
181171
] {
182172
if n_files != 0 {
173+
let n_splits = manifest_list_writer.n_splits(n_files, content);
174+
183175
if n_splits == 0 {
184176
manifest_list_writer
185177
.append(files, snapshot_id, object_store.clone(), content)
@@ -189,7 +181,7 @@ impl Operation {
189181
.append_multiple(
190182
files,
191183
snapshot_id,
192-
n_data_splits,
184+
n_splits,
193185
object_store.clone(),
194186
content,
195187
)

0 commit comments

Comments
 (0)