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

Method reinterpret_cast

arrow-array/src/array/primitive_array.rs:858–863  ·  view source on GitHub ↗

Reinterprets this array's contents as a different data type without copying This can be used to efficiently convert between primitive arrays with the same underlying representation Note: this will not modify the underlying values, and therefore may change the semantic values of the array, e.g. 100 milliseconds in a [`TimestampNanosecondArray`] will become 100 seconds in a [`TimestampSecondArray`

(&self)

Source from the content-addressed store, hash-verified

856 /// let b: TimestampNanosecondArray = a.reinterpret_cast();
857 /// ```
858 pub fn reinterpret_cast<K>(&self) -> PrimitiveArray<K>
859 where
860 K: ArrowPrimitiveType<Native = T::Native>,
861 {
862 PrimitiveArray::new(self.values.clone(), self.nulls.clone())
863 }
864
865 /// Applies a unary infallible function to a primitive array, producing a
866 /// new array of potentially different type.

Callers

nothing calls this directly

Calls 1

cloneMethod · 0.45

Tested by

no test coverage detected