Struct arrow::array::DecimalArray
source · [−]pub struct DecimalArray<T: DecimalType> { /* private fields */ }
Expand description
A generic Array
for fixed width decimal numbers
See Decimal128Array
and Decimal256Array
Implementations
sourceimpl<T: DecimalType> DecimalArray<T>
impl<T: DecimalType> DecimalArray<T>
pub const VALUE_LENGTH: i32 = _
pub const MAX_PRECISION: usize = T::MAX_PRECISION
pub const MAX_SCALE: usize = T::MAX_SCALE
pub fn data(&self) -> &ArrayData
sourcepub fn precision(&self) -> usize
pub fn precision(&self) -> usize
Return the precision (total digits) that can be stored by this array
sourcepub fn scale(&self) -> usize
pub fn scale(&self) -> usize
Return the scale (digits after the decimal) that can be stored by this array
sourcepub unsafe fn value_unchecked(&self, i: usize) -> Decimal<T>
pub unsafe fn value_unchecked(&self, i: usize) -> Decimal<T>
Returns the element at index i
.
Safety
Caller is responsible for ensuring that the index is within the bounds of the array
sourcepub fn value_offset(&self, i: usize) -> i32
pub fn value_offset(&self, i: usize) -> i32
Returns the offset for the element at index i
.
Note this doesn’t do any bound checking, for performance reason.
sourcepub fn value_length(&self) -> i32
pub fn value_length(&self) -> i32
Returns the length for an element.
All elements have the same length as the array is a fixed size.
sourcepub fn value_data(&self) -> Buffer
pub fn value_data(&self) -> Buffer
Returns a clone of the value data buffer
pub fn value_offset_at(&self, i: usize) -> i32
pub fn value_as_string(&self, row: usize) -> String
sourcepub fn from_fixed_size_binary_array(
v: FixedSizeBinaryArray,
precision: usize,
scale: usize
) -> Self
pub fn from_fixed_size_binary_array(
v: FixedSizeBinaryArray,
precision: usize,
scale: usize
) -> Self
Build a decimal array from FixedSizeBinaryArray
.
NB: This function does not validate that each value is in the permissible range for a decimal
sourcepub fn from_fixed_size_list_array(
v: FixedSizeListArray,
precision: usize,
scale: usize
) -> Self
👎Deprecated: please use from_fixed_size_binary_array
instead
pub fn from_fixed_size_list_array(
v: FixedSizeListArray,
precision: usize,
scale: usize
) -> Self
please use from_fixed_size_binary_array
instead
Build a decimal array from FixedSizeListArray
.
NB: This function does not validate that each value is in the permissible range for a decimal.
sourcepub const fn default_type() -> DataType
pub const fn default_type() -> DataType
The default precision and scale used when not specified.
sourcepub fn with_precision_and_scale(
self,
precision: usize,
scale: usize
) -> Result<Self> where
Self: Sized,
pub fn with_precision_and_scale(
self,
precision: usize,
scale: usize
) -> Result<Self> where
Self: Sized,
Returns a Decimal array with the same data as self, with the specified precision.
Returns an Error if:
precision
is larger thanSelf::MAX_PRECISION
scale
is larger thanSelf::MAX_SCALE
;scale
is >precision
sourceimpl DecimalArray<Decimal128Type>
impl DecimalArray<Decimal128Type>
sourcepub fn from_iter_values<I: IntoIterator<Item = i128>>(iter: I) -> Self
pub fn from_iter_values<I: IntoIterator<Item = i128>>(iter: I) -> Self
Creates a Decimal128Array with default precision and scale,
based on an iterator of i128
values without nulls
sourceimpl<'a, T: DecimalType> DecimalArray<T>
impl<'a, T: DecimalType> DecimalArray<T>
sourcepub fn iter(&'a self) -> DecimalIter<'a, T>
pub fn iter(&'a self) -> DecimalIter<'a, T>
constructs a new iterator
Trait Implementations
sourceimpl<T: DecimalType> Array for DecimalArray<T>
impl<T: DecimalType> Array for DecimalArray<T>
sourcefn data_ref(&self) -> &ArrayData
fn data_ref(&self) -> &ArrayData
Returns a reference-counted pointer to the underlying data of this array.
sourcefn slice(&self, offset: usize, length: usize) -> ArrayRef
fn slice(&self, offset: usize, length: usize) -> ArrayRef
Returns a zero-copy slice of this array with the indicated offset and length. Read more
sourcefn offset(&self) -> usize
fn offset(&self) -> usize
Returns the offset into the underlying data used by this array(-slice).
Note that the underlying data can be shared by many arrays.
This defaults to 0
. Read more
sourcefn is_null(&self, index: usize) -> bool
fn is_null(&self, index: usize) -> bool
Returns whether the element at index
is null.
When using this function on a slice, the index is relative to the slice. Read more
sourcefn is_valid(&self, index: usize) -> bool
fn is_valid(&self, index: usize) -> bool
Returns whether the element at index
is not null.
When using this function on a slice, the index is relative to the slice. Read more
sourcefn null_count(&self) -> usize
fn null_count(&self) -> usize
Returns the total number of null values in this array. Read more
sourcefn get_buffer_memory_size(&self) -> usize
fn get_buffer_memory_size(&self) -> usize
Returns the total number of bytes of memory pointed to by this array. The buffers store bytes in the Arrow memory format, and include the data as well as the validity map. Read more
sourcefn get_array_memory_size(&self) -> usize
fn get_array_memory_size(&self) -> usize
Returns the total number of bytes of memory occupied physically by this array.
This value will always be greater than returned by get_buffer_memory_size()
and
includes the overhead of the data structures that contain the pointers to the various buffers. Read more
sourceimpl<'a, T: DecimalType> ArrayAccessor for &'a DecimalArray<T>
impl<'a, T: DecimalType> ArrayAccessor for &'a DecimalArray<T>
sourceimpl<T: DecimalType> Debug for DecimalArray<T>
impl<T: DecimalType> Debug for DecimalArray<T>
sourceimpl<T: DecimalType> From<ArrayData> for DecimalArray<T>
impl<T: DecimalType> From<ArrayData> for DecimalArray<T>
sourceimpl<T: DecimalType> From<DecimalArray<T>> for ArrayData
impl<T: DecimalType> From<DecimalArray<T>> for ArrayData
sourcefn from(array: DecimalArray<T>) -> Self
fn from(array: DecimalArray<T>) -> Self
Converts to this type from the input type.
sourceimpl<'a, T: DecimalType> IntoIterator for &'a DecimalArray<T>
impl<'a, T: DecimalType> IntoIterator for &'a DecimalArray<T>
sourceimpl PartialEq<DecimalArray<Decimal128Type>> for Decimal128Array
impl PartialEq<DecimalArray<Decimal128Type>> for Decimal128Array
Auto Trait Implementations
impl<T> RefUnwindSafe for DecimalArray<T> where
T: RefUnwindSafe,
impl<T> Send for DecimalArray<T>
impl<T> Sync for DecimalArray<T>
impl<T> Unpin for DecimalArray<T> where
T: Unpin,
impl<T> UnwindSafe for DecimalArray<T> where
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more