mapleFU commented on code in PR #8989:
URL: https://github.com/apache/arrow-rs/pull/8989#discussion_r2621692623
##########
arrow-array/src/builder/fixed_size_binary_builder.rs:
##########
@@ -270,4 +288,43 @@ mod tests {
fn test_fixed_size_binary_builder_invalid_value_length() {
let _ = FixedSizeBinaryBuilder::with_capacity(15, -1);
}
+
+ #[test]
+ fn test_fixed_size_binary_builder_append_array() {
+ let mut other_builder = FixedSizeBinaryBuilder::with_capacity(3, 5);
+ other_builder.append_value(b"hello").unwrap();
+ other_builder.append_null();
+ other_builder.append_value(b"arrow").unwrap();
+ let other_array = other_builder.finish();
+
+ let mut builder = FixedSizeBinaryBuilder::with_capacity(3, 5);
+ builder.append_array(&other_array).unwrap();
+ // Append again to test if breaks when appending multiple times
+ builder.append_array(&other_array).unwrap();
+ let array = builder.finish();
+
+ assert_eq!(array.value_length(), other_array.value_length());
+ assert_eq!(&DataType::FixedSizeBinary(5), array.data_type());
+ assert_eq!(6, array.len());
+ assert_eq!(2, array.null_count());
+ for i in 0..6 {
+ assert_eq!(i * 5, array.value_offset(i as usize));
+ }
+
+ assert_eq!(b"hello", array.value(0));
Review Comment:
```suggestion
assert_eq!(b"hello", array.value(0));
assert_eq!(b"arrow", array.value(2));
```
--
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]