pub struct DurationArray { /* private fields */ }Expand description
A nanosecond interval count.
A nanosecond i64 column; see the module documentation.
Implementations§
Source§impl DurationArray
impl DurationArray
Sourcepub fn try_new(
values: ScalarBuffer<i64>,
validity: Option<Bitmap>,
) -> Result<Self>
pub fn try_new( values: ScalarBuffer<i64>, validity: Option<Bitmap>, ) -> Result<Self>
Builds an array from a values buffer and an optional validity bitmap.
§Errors
ValidityLengthMismatch
when the bitmap does not cover exactly one bit per value.
Sourcepub fn from_nanos(values: impl IntoIterator<Item = i64>) -> Self
pub fn from_nanos(values: impl IntoIterator<Item = i64>) -> Self
Builds an array with no nulls from nanosecond intervals.
Sourcepub fn from_opt_nanos(values: impl IntoIterator<Item = Option<i64>>) -> Self
pub fn from_opt_nanos(values: impl IntoIterator<Item = Option<i64>>) -> Self
Builds an array from optional nanosecond intervals.
Sourcepub fn values(&self) -> &[i64]
pub fn values(&self) -> &[i64]
The raw nanosecond values, including the placeholder in every null slot.
Sourcepub const fn values_buffer(&self) -> &ScalarBuffer<i64>
pub const fn values_buffer(&self) -> &ScalarBuffer<i64>
The values buffer.
Sourcepub fn value(&self, index: usize) -> Option<i64>
pub fn value(&self, index: usize) -> Option<i64>
The raw slot value at index, ignoring validity.
Returns None only when index is out of range.
Sourcepub fn get(&self, index: usize) -> Option<i64>
pub fn get(&self, index: usize) -> Option<i64>
The logical value at index: None when the slot is null or
out of range.
Sourcepub fn value_as_secs_f64(&self, index: usize) -> Option<f64>
pub fn value_as_secs_f64(&self, index: usize) -> Option<f64>
The value at index in seconds, as a float.
Lossy beyond 2^53 nanoseconds (about 104 days); use
Self::get when exactness matters.
Sourcepub fn value_as_duration(&self, index: usize) -> Option<Duration>
pub fn value_as_duration(&self, index: usize) -> Option<Duration>
The value at index as a std::time::Duration.
Returns None for a negative value, which Duration cannot
represent.
Sourcepub fn slice(&self, offset: usize, len: usize) -> Self
pub fn slice(&self, offset: usize, len: usize) -> Self
A zero-copy sub-range, clamped to the array (the crate-wide slicing convention).
Sourcepub fn with_validity(&self, validity: Option<Bitmap>) -> Result<Self>
pub fn with_validity(&self, validity: Option<Bitmap>) -> Result<Self>
Returns a copy with a different validity bitmap.
§Errors
ValidityLengthMismatch
when the bitmap length is wrong.
Sourcepub const fn as_primitive(&self) -> &Int64Array
pub const fn as_primitive(&self) -> &Int64Array
The underlying i64 column, keeping this type’s DataType.
Sourcepub fn from_primitive(values: &Int64Array) -> Result<Self>
pub fn from_primitive(values: &Int64Array) -> Result<Self>
Reinterprets a plain Int64 column as this temporal type.
Free: the two share a buffer layout.
§Errors
TypeMismatch when the
source is not an Int64, Timestamp or Duration column.
Trait Implementations§
Source§impl Array for DurationArray
impl Array for DurationArray
Source§fn as_any(&self) -> &dyn Any
fn as_any(&self) -> &dyn Any
ArrayExt::downcast.Source§fn validity(&self) -> Option<&Bitmap>
fn validity(&self) -> Option<&Bitmap>
None when every slot is valid. Read moreSource§fn buffer_memory_size(&self) -> usize
fn buffer_memory_size(&self) -> usize
Source§fn null_count(&self) -> usize
fn null_count(&self) -> usize
Source§impl<'a> ArrayAccessor for &'a DurationArray
impl<'a> ArrayAccessor for &'a DurationArray
Source§impl Clone for DurationArray
impl Clone for DurationArray
Source§impl Debug for DurationArray
impl Debug for DurationArray
impl Eq for DurationArray
Source§impl FromIterator<Option<i64>> for DurationArray
impl FromIterator<Option<i64>> for DurationArray
Source§impl FromIterator<i64> for DurationArray
impl FromIterator<i64> for DurationArray
Source§impl<'a> IntoIterator for &'a DurationArray
impl<'a> IntoIterator for &'a DurationArray
Auto Trait Implementations§
impl !Freeze for DurationArray
impl RefUnwindSafe for DurationArray
impl Send for DurationArray
impl Sync for DurationArray
impl Unpin for DurationArray
impl UnsafeUnpin for DurationArray
impl UnwindSafe for DurationArray
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<A> IntoArrayRef for Awhere
A: Array,
impl<A> IntoArrayRef for Awhere
A: Array,
Source§fn into_array_ref(self) -> ArrayRef
fn into_array_ref(self) -> ArrayRef
self into a shared, dynamically typed column.