bjchambers commented on a change in pull request #9339:
URL: https://github.com/apache/arrow/pull/9339#discussion_r565526450
##########
File path: rust/arrow/src/array/transform/mod.rs
##########
@@ -714,6 +714,48 @@ mod tests {
assert_eq!(array, expected)
}
+ #[test]
+ fn test_struct_offset() {
+ let strings: ArrayRef = Arc::new(StringArray::from(vec![
+ Some("joe"),
+ None,
+ None,
+ Some("mark"),
+ Some("doe"),
+ ]));
+ let ints: ArrayRef = Arc::new(Int32Array::from(vec![
+ Some(1),
+ Some(2),
+ Some(3),
+ Some(4),
+ Some(5),
+ ]));
+
+ let array =
+ StructArray::try_from(vec![("f1", strings.clone()), ("f2",
ints.clone())])
+ .unwrap()
+ .slice(1, 3)
+ .data();
+ let arrays = vec![array.as_ref()];
+ let mut mutable = MutableArrayData::new(arrays, false, 0);
+
+ mutable.extend(0, 1, 3);
+ let data = mutable.freeze();
+ let array = StructArray::from(Arc::new(data));
+
+ // Struct equality doesn't seem to work when using slices?
Review comment:
Ah. That makes sense. Thanks for the clarification!
It's unrelated to this PR but I was also wondering about the implementation
of extend for structs. For other types, it seems like it is relatively
efficient (extending with an entire slice) but for the struct case it seems
like it iterates over each row and extends a single row at a time. Is that an
actual issue? Would addressing that require the changes to struct you mention?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]