(lhs: &[T], rhs: &[T])
| 22 | use super::equal_range; |
| 23 | |
| 24 | pub(super) fn lengths_equal<T: ArrowNativeType + Integer>(lhs: &[T], rhs: &[T]) -> bool { |
| 25 | // invariant from `base_equal` |
| 26 | debug_assert_eq!(lhs.len(), rhs.len()); |
| 27 | |
| 28 | if lhs.is_empty() { |
| 29 | return true; |
| 30 | } |
| 31 | |
| 32 | if lhs[0] == T::zero() && rhs[0] == T::zero() { |
| 33 | return lhs == rhs; |
| 34 | }; |
| 35 | |
| 36 | // The expensive case, e.g. |
| 37 | // [0, 2, 4, 6, 9] == [4, 6, 8, 10, 13] |
| 38 | lhs.windows(2) |
| 39 | .zip(rhs.windows(2)) |
| 40 | .all(|(lhs_offsets, rhs_offsets)| { |
| 41 | // length of left == length of right |
| 42 | (lhs_offsets[1] - lhs_offsets[0]) == (rhs_offsets[1] - rhs_offsets[0]) |
| 43 | }) |
| 44 | } |
| 45 | |
| 46 | pub(super) fn list_equal<T: ArrowNativeType + Integer>( |
| 47 | lhs: &ArrayData, |
no test coverage detected