Skip to content

Commit cfc1203

Browse files
committed
Replace UnboundPartitionSpec Builder
1 parent f23b38a commit cfc1203

File tree

3 files changed

+10
-11
lines changed

3 files changed

+10
-11
lines changed

crates/catalog/rest/src/catalog.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1467,13 +1467,13 @@ mod tests {
14671467
.properties(HashMap::from([("owner".to_string(), "testx".to_string())]))
14681468
.partition_spec(
14691469
UnboundPartitionSpec::builder()
1470-
.with_fields(vec![UnboundPartitionField::builder()
1470+
.with_unbound_fields(vec![UnboundPartitionField::builder()
14711471
.source_id(1)
14721472
.transform(Transform::Truncate(3))
14731473
.name("id".to_string())
14741474
.build()])
1475-
.build()
1476-
.unwrap(),
1475+
.unwrap()
1476+
.build_unbound(),
14771477
)
14781478
.sort_order(
14791479
SortOrder::builder()

crates/iceberg/src/catalog/mod.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -802,22 +802,24 @@ mod tests {
802802
.transform(Transform::Day)
803803
.build(),
804804
)
805+
.unwrap()
805806
.with_unbound_partition_field(
806807
UnboundPartitionField::builder()
807808
.source_id(1)
808809
.name("id_bucket".to_string())
809810
.transform(Transform::Bucket(16))
810811
.build(),
811812
)
813+
.unwrap()
812814
.with_unbound_partition_field(
813815
UnboundPartitionField::builder()
814816
.source_id(2)
815817
.name("id_truncate".to_string())
816818
.transform(Transform::Truncate(4))
817819
.build(),
818820
)
819-
.build()
820-
.unwrap(),
821+
.unwrap()
822+
.build_unbound(),
821823
},
822824
);
823825
}

crates/iceberg/src/spec/partition.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -144,22 +144,19 @@ pub struct UnboundPartitionField {
144144
}
145145

146146
/// Unbound partition spec can be built without a schema and later bound to a schema.
147-
#[derive(Debug, Serialize, Deserialize, PartialEq, Eq, Clone, Default, Builder)]
147+
#[derive(Debug, Serialize, Deserialize, PartialEq, Eq, Clone, Default)]
148148
#[serde(rename_all = "kebab-case")]
149-
#[builder(setter(prefix = "with"))]
150149
pub struct UnboundPartitionSpec {
151150
/// Identifier for PartitionSpec
152-
#[builder(default, setter(strip_option))]
153151
pub spec_id: Option<i32>,
154152
/// Details of the partition spec
155-
#[builder(setter(each(name = "with_unbound_partition_field")))]
156153
pub fields: Vec<UnboundPartitionField>,
157154
}
158155

159156
impl UnboundPartitionSpec {
160157
/// Create unbound partition spec builer
161-
pub fn builder() -> UnboundPartitionSpecBuilder {
162-
UnboundPartitionSpecBuilder::default()
158+
pub fn builder() -> PartitionSpecBuilder {
159+
PartitionSpecBuilder::default()
163160
}
164161
}
165162

0 commit comments

Comments
 (0)