tustvold commented on code in PR #2087:
URL: https://github.com/apache/arrow-rs/pull/2087#discussion_r922680530
##########
arrow/src/array/array_union.rs:
##########
@@ -956,4 +957,79 @@ mod tests {
let err = builder.append::<Int32Type>("a", 1).unwrap_err().to_string();
assert!(err.contains("Attempt to write col \"a\" with type Int32
doesn't match existing type Float32"), "{}", err);
}
+
+ #[test]
+ fn slice_union_array() {
+ // [1, null, 3.0, null, 4]
+ fn create_sparse_union() -> UnionArray {
+ let mut builder = UnionBuilder::new_sparse(5);
+ builder.append::<Int32Type>("a", 1).unwrap();
+ builder.append_null::<Int32Type>("a").unwrap();
+ builder.append::<Float64Type>("c", 3.0).unwrap();
+ builder.append_null::<Float64Type>("c").unwrap();
+ builder.append::<Int32Type>("a", 4).unwrap();
+ builder.build().unwrap()
+ }
+
+ // [1, null, 3.0, null, 4]
+ fn create_dense_union() -> UnionArray {
+ let mut builder = UnionBuilder::new_dense(5);
+ builder.append::<Int32Type>("a", 1).unwrap();
Review Comment:
Could conceivably rejig these methods to share the append code, but don't
feel strongly
##########
arrow/src/array/array_union.rs:
##########
@@ -383,6 +383,7 @@ mod tests {
use crate::array::*;
use crate::buffer::Buffer;
use crate::datatypes::{DataType, Field};
+ use crate::record_batch::RecordBatch;
Review Comment:
?
--
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]