Skip to content

Commit 1162be7

Browse files
committed
fix: review comment
1 parent db26f7a commit 1162be7

2 files changed

Lines changed: 14 additions & 6 deletions

File tree

src/iceberg/meson.build

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,6 @@ install_headers(
194194
'transform.h',
195195
'type_fwd.h',
196196
'type.h',
197-
'update/update_properties.h',
198197
],
199198
subdir: 'iceberg',
200199
)

src/iceberg/update/update_partition_spec.cc

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,20 @@ UpdatePartitionSpec::UpdatePartitionSpec(TableIdentifier identifier,
4949
format_version_ = base_metadata_->format_version;
5050

5151
// Get the current/default partition spec
52-
ICEBERG_ASSIGN_OR_THROW(spec_, base_metadata_->PartitionSpec());
52+
auto spec_result = base_metadata_->PartitionSpec();
53+
if (!spec_result.has_value()) {
54+
AddError(spec_result.error());
55+
return;
56+
}
57+
spec_ = std::move(spec_result.value());
5358

5459
// Get the current schema
55-
ICEBERG_ASSIGN_OR_THROW(schema_, base_metadata_->Schema());
60+
auto schema_result = base_metadata_->Schema();
61+
if (!schema_result.has_value()) {
62+
AddError(schema_result.error());
63+
return;
64+
}
65+
schema_ = std::move(schema_result.value());
5666

5767
last_assigned_partition_id_ = spec_->last_assigned_field_id();
5868
name_to_field_ = IndexSpecByName(*spec_);
@@ -420,10 +430,9 @@ Status UpdatePartitionSpec::Apply() {
420430
last_assigned_id = PartitionSpec::kLegacyPartitionDataIdStart - 1;
421431
}
422432

423-
// TODO(anyone): Use the Make method with schema_.
424433
ICEBERG_ASSIGN_OR_RAISE(
425-
auto spec_result,
426-
PartitionSpec::Make(new_spec_id, std::move(new_fields), last_assigned_id));
434+
auto spec_result, PartitionSpec::Make(*schema_, new_spec_id, std::move(new_fields),
435+
last_assigned_id));
427436
applied_spec_ = std::shared_ptr<PartitionSpec>(spec_result.release());
428437
return {};
429438
}

0 commit comments

Comments
 (0)