CTTY commented on code in PR #1617:
URL: https://github.com/apache/iceberg-rust/pull/1617#discussion_r2314791833
##########
crates/iceberg/src/arrow/schema.rs:
##########
@@ -1717,6 +1726,49 @@ mod tests {
}
}
+ #[test]
+ fn test_unsigned_integer_type_conversion() {
+ let test_cases = vec![
+ (DataType::UInt8, PrimitiveType::Int),
+ (DataType::UInt16, PrimitiveType::Int),
+ (DataType::UInt32, PrimitiveType::Long),
+ ];
+
+ for (arrow_type, expected_iceberg_type) in test_cases {
+ let arrow_field = Field::new("test", arrow_type.clone(),
false).with_metadata(
+ HashMap::from([(PARQUET_FIELD_ID_META_KEY.to_string(),
"1".to_string())]),
+ );
+ let arrow_schema = ArrowSchema::new(vec![arrow_field]);
+
+ let iceberg_schema =
arrow_schema_to_schema(&arrow_schema).unwrap();
+ let iceberg_field =
iceberg_schema.as_struct().fields().first().unwrap();
+
+ assert!(
+ matches!(iceberg_field.field_type.as_ref(), Type::Primitive(t)
if *t == expected_iceberg_type),
+ "Expected {:?} to map to {:?}",
+ arrow_type,
+ expected_iceberg_type
+ );
+ }
+
+ // Test UInt64 blocking
+ {
+ let arrow_field = Field::new("test", DataType::UInt64,
false).with_metadata(
+ HashMap::from([(PARQUET_FIELD_ID_META_KEY.to_string(),
"1".to_string())]),
+ );
+ let arrow_schema = ArrowSchema::new(vec![arrow_field]);
+
+ let result = arrow_schema_to_schema(&arrow_schema);
+ assert!(result.is_err());
+ assert!(
+ result
+ .unwrap_err()
+ .to_string()
+ .contains("UInt64 is not supported")
+ );
+ }
Review Comment:
nit: I think the brackets here and L1755 are excessive
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]