You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by tu...@apache.org on 2022/05/26 22:27:19 UTC
[arrow-rs] branch master updated: Test for list array equality with different offsets (#1756)
This is an automated email from the ASF dual-hosted git repository.
tustvold pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow-rs.git
The following commit(s) were added to refs/heads/master by this push:
new 7e8fbf95d Test for list array equality with different offsets (#1756)
7e8fbf95d is described below
commit 7e8fbf95dbb2f25830c20cd01691874e025f9527
Author: Andrew Lamb <an...@nerdnetworks.org>
AuthorDate: Thu May 26 18:27:15 2022 -0400
Test for list array equality with different offsets (#1756)
* Test for list array equality with different offsets
* fix: make it compile
---
arrow/src/array/equal/list.rs | 22 +++++++++++++++++++++-
1 file changed, 21 insertions(+), 1 deletion(-)
diff --git a/arrow/src/array/equal/list.rs b/arrow/src/array/equal/list.rs
index 09ad896f4..65d320c00 100644
--- a/arrow/src/array/equal/list.rs
+++ b/arrow/src/array/equal/list.rs
@@ -147,7 +147,10 @@ pub(super) fn list_equal<T: OffsetSizeTrait>(
#[cfg(test)]
mod tests {
- use crate::array::{Int64Builder, ListBuilder};
+ use crate::{
+ array::{Array, Int64Builder, ListArray, ListBuilder},
+ datatypes::Int32Type,
+ };
#[test]
fn list_array_non_zero_nulls() {
@@ -172,4 +175,21 @@ mod tests {
assert_eq!(array1, array2);
}
+
+ #[test]
+ fn test_list_different_offsets() {
+ let a = ListArray::from_iter_primitive::<Int32Type, _, _>([
+ Some([Some(0), Some(0)]),
+ Some([Some(1), Some(2)]),
+ Some([None, None]),
+ ]);
+ let b = ListArray::from_iter_primitive::<Int32Type, _, _>([
+ Some([Some(1), Some(2)]),
+ Some([None, None]),
+ Some([None, None]),
+ ]);
+ let a_slice = a.slice(1, 2);
+ let b_slice = b.slice(0, 2);
+ assert_eq!(&a_slice, &b_slice);
+ }
}