kevinjqliu commented on code in PR #1285:
URL: https://github.com/apache/iceberg-rust/pull/1285#discussion_r2072265008


##########
crates/iceberg/src/spec/partition.rs:
##########
@@ -1382,6 +1380,42 @@ mod tests {
             .unwrap_err();
     }
 
+    #[test]
+    fn test_builder_non_primitive_type_disallowed() {
+        let schema = Schema::builder()
+            .with_fields(vec![
+                NestedField::required(1, "id", 
Type::Primitive(crate::spec::PrimitiveType::Int))
+                    .into(),
+                NestedField::required(
+                    2,
+                    "map",
+                    Type::Map(MapType::new(
+                        NestedField::map_key_element(3, 
Type::Primitive(PrimitiveType::String))
+                            .into(),
+                        NestedField::map_value_element(
+                            4,
+                            Type::Primitive(PrimitiveType::Boolean),
+                            true,
+                        )
+                        .into(),
+                    )),
+                )
+                .into(),
+            ])
+            .build()
+            .unwrap();
+
+        PartitionSpec::builder(schema)
+            .with_spec_id(1)
+            .add_unbound_field(UnboundPartitionField {
+                source_id: 2,
+                field_id: None,
+                name: "map_partition".to_string(),
+                transform: Transform::Void,
+            })
+            .unwrap_err();

Review Comment:
   nit: 
   can we add an assertion statement here to be explicit
   ```
           assert!(err.message().contains("Cannot partition by non-primitive 
source field"));
   ```



-- 
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