c-thiel commented on code in PR #491:
URL: https://github.com/apache/iceberg-rust/pull/491#discussion_r1704298527


##########
crates/iceberg/src/spec/partition.rs:
##########
@@ -117,22 +144,312 @@ pub struct UnboundPartitionField {
 }
 
 /// Unbound partition spec can be built without a schema and later bound to a 
schema.
-#[derive(Debug, Serialize, Deserialize, PartialEq, Eq, Clone, Default, 
Builder)]
+#[derive(Debug, Serialize, Deserialize, PartialEq, Eq, Clone, Default)]
 #[serde(rename_all = "kebab-case")]
-#[builder(setter(prefix = "with"))]
 pub struct UnboundPartitionSpec {
     /// Identifier for PartitionSpec
-    #[builder(default, setter(strip_option))]
     pub spec_id: Option<i32>,
     /// Details of the partition spec
-    #[builder(setter(each(name = "with_unbound_partition_field")))]
     pub fields: Vec<UnboundPartitionField>,
 }
 
 impl UnboundPartitionSpec {
     /// Create unbound partition spec builer
-    pub fn builder() -> UnboundPartitionSpecBuilder {
-        UnboundPartitionSpecBuilder::default()
+    pub fn builder() -> PartitionSpecBuilder {
+        PartitionSpecBuilder::default()
+    }
+}
+
+/// Create valid partition specs for a given schema.
+#[derive(Debug, Default)]
+pub struct PartitionSpecBuilder {
+    spec_id: Option<i32>,
+    last_assigned_field_id: i32,
+    fields: Vec<UnboundPartitionField>,
+}
+
+impl PartitionSpecBuilder {

Review Comment:
   Ok, I'll split it.
   Are you OK with still allow to add bound & unbound fields to the 
(Bound)`PartitionSpecBuilder`?
   
   An `UnboundField` has no `field_id` and we need to keep`field_id` when 
binding against a new schema on `setCurrentSchema`
   
https://github.com/apache/iceberg/blob/5fc1413a5efc4419ccc081f3031325f107ccddab/core/src/main/java/org/apache/iceberg/TableMetadata.java#L766



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to