Skip to content

Commit a6442fc

Browse files
committed
Merge pull request JanKaul#245 from gruuya/fix-n-splits
fix: use correct number of splits for deletes
2 parents d233524 + 5e08382 commit a6442fc

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
@@ -145,10 +145,6 @@ impl Operation {
145145
)?
146146
};
147147

148-
let n_data_splits = manifest_list_writer.n_splits(n_data_files, Content::Data);
149-
let n_delete_splits =
150-
manifest_list_writer.n_splits(n_delete_files, Content::Deletes);
151-
152148
let new_datafile_iter = data_files.into_iter().map(|data_file| {
153149
ManifestEntry::builder()
154150
.with_format_version(table_metadata.format_version)
@@ -171,21 +167,17 @@ impl Operation {
171167

172168
// Write manifest files
173169
// Split manifest file if limit is exceeded
174-
for (content, files, n_files, n_splits) in [
175-
(
176-
Content::Data,
177-
Either::Left(new_datafile_iter),
178-
n_data_files,
179-
n_data_splits,
180-
),
170+
for (content, files, n_files) in [
171+
(Content::Data, Either::Left(new_datafile_iter), n_data_files),
181172
(
182173
Content::Deletes,
183174
Either::Right(new_deletefile_iter),
184175
n_delete_files,
185-
n_delete_splits,
186176
),
187177
] {
188178
if n_files != 0 {
179+
let n_splits = manifest_list_writer.n_splits(n_files, content);
180+
189181
if n_splits == 0 {
190182
manifest_list_writer
191183
.append(files, snapshot_id, object_store.clone(), content)
@@ -195,7 +187,7 @@ impl Operation {
195187
.append_multiple(
196188
files,
197189
snapshot_id,
198-
n_data_splits,
190+
n_splits,
199191
object_store.clone(),
200192
content,
201193
)

0 commit comments

Comments
 (0)