MCPcopy Create free account
hub / github.com/apache/arrow-rs / ptr_eq

Method ptr_eq

arrow-data/src/data.rs:1667–1696  ·  view source on GitHub ↗

Returns true if this `ArrayData` is equal to `other`, using pointer comparisons to determine buffer equality. This is cheaper than `PartialEq::eq` but may return false when the arrays are logically equal

(&self, other: &Self)

Source from the content-addressed store, hash-verified

1665 /// to determine buffer equality. This is cheaper than `PartialEq::eq` but may
1666 /// return false when the arrays are logically equal
1667 pub fn ptr_eq(&self, other: &Self) -> bool {
1668 if self.offset != other.offset
1669 || self.len != other.len
1670 || self.data_type != other.data_type
1671 || self.buffers.len() != other.buffers.len()
1672 || self.child_data.len() != other.child_data.len()
1673 {
1674 return false;
1675 }
1676
1677 match (&self.nulls, &other.nulls) {
1678 (Some(a), Some(b)) if !a.inner().ptr_eq(b.inner()) => return false,
1679 (Some(_), None) | (None, Some(_)) => return false,
1680 _ => {}
1681 };
1682
1683 if !self
1684 .buffers
1685 .iter()
1686 .zip(other.buffers.iter())
1687 .all(|(a, b)| a.as_ptr() == b.as_ptr())
1688 {
1689 return false;
1690 }
1691
1692 self.child_data
1693 .iter()
1694 .zip(other.child_data.iter())
1695 .all(|(a, b)| a.ptr_eq(b))
1696 }
1697
1698 /// Converts this [`ArrayData`] into an [`ArrayDataBuilder`]
1699 pub fn into_builder(self) -> ArrayDataBuilder {

Callers 5

bytes_ptr_eqFunction · 0.45
read_implMethod · 0.45
readMethod · 0.45
with_capacitiesMethod · 0.45

Calls 6

allMethod · 0.80
zipMethod · 0.80
lenMethod · 0.45
innerMethod · 0.45
iterMethod · 0.45
as_ptrMethod · 0.45

Tested by

no test coverage detected