Struct vortex_array::array::TemporalArray

source ·
pub struct TemporalArray { /* private fields */ }
Expand description

An array wrapper for primitive values that have an associated temporal meaning.

This is a wrapper around ExtensionArrays containing numeric types, each of which corresponds to either a timestamp or julian date (both referenced to UNIX epoch), OR a time since midnight.

§Arrow compatibility

TemporalArray can be created from Arrow arrays containing the following datatypes:

  • Time32
  • Time64
  • Timestamp
  • Date32
  • Date64

Anything that can be constructed and held in a TemporalArray can also be zero-copy converted back to the relevant Arrow datatype.

Implementations§

source§

impl TemporalArray

source

pub fn new_date(array: ArrayData, time_unit: TimeUnit) -> Self

Create a new TemporalArray holding either i32 day offsets, or i64 millisecond offsets that are evenly divisible by the number of 86,400,000.

This is equivalent to the data described by either of the Date32 or Date64 data types from Arrow.

§Panics

If the time unit is milliseconds, and the array is not of primitive I64 type, it panics.

If the time unit is days, and the array is not of primitive I32 type, it panics.

If any other time unit is provided, it panics.

source

pub fn new_time(array: ArrayData, time_unit: TimeUnit) -> Self

Create a new TemporalArray holding one of the following values:

  • i32 values representing seconds since midnight
  • i32 values representing milliseconds since midnight
  • i64 values representing microseconds since midnight
  • i64 values representing nanoseconds since midnight

Note, this is equivalent to the set of values represented by the Time32 or Time64 types from Arrow.

§Panics

If the time unit is seconds, and the array is not of primitive I32 type, it panics.

If the time unit is milliseconds, and the array is not of primitive I32 type, it panics.

If the time unit is microseconds, and the array is not of primitive I64 type, it panics.

If the time unit is nanoseconds, and the array is not of primitive I64 type, it panics.

source

pub fn new_timestamp( array: ArrayData, time_unit: TimeUnit, time_zone: Option<String>, ) -> Self

Create a new TemporalArray holding Arrow spec compliant Timestamp data, with an optional timezone.

§Panics

If array does not hold Primitive i64 data, the function will panic.

If the time_unit is days, the function will panic.

source§

impl TemporalArray

source

pub fn temporal_values(&self) -> ArrayData

Access the underlying temporal values in the underlying ExtensionArray storage.

These values are to be interpreted based on the time unit and optional time-zone stored in the TemporalMetadata.

source

pub fn temporal_metadata(&self) -> &TemporalMetadata

Retrieve the temporal metadata.

The metadata is used to provide semantic meaning to the temporal values Array, for example to understand the granularity of the samples and if they have an associated timezone.

source

pub fn ext_dtype(&self) -> Arc<ExtDType>

Retrieve the extension DType associated with the underlying array.

Trait Implementations§

source§

impl Clone for TemporalArray

source§

fn clone(&self) -> TemporalArray

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for TemporalArray

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<&TemporalArray> for ExtensionArray

source§

fn from(value: &TemporalArray) -> Self

Converts to this type from the input type.
source§

impl From<TemporalArray> for ArrayData

source§

fn from(value: TemporalArray) -> Self

Converts to this type from the input type.
source§

impl From<TemporalArray> for ExtensionArray

source§

fn from(value: TemporalArray) -> Self

Converts to this type from the input type.
source§

impl TryFrom<ArrayData> for TemporalArray

source§

fn try_from(value: ArrayData) -> Result<Self, Self::Error>

Try to specialize a generic Vortex array as a TemporalArray.

§Errors

If the provided Array does not have vortex.ext encoding, an error will be returned.

If the provided Array does not have recognized ExtMetadata corresponding to one of the known TemporalMetadata variants, an error is returned.

source§

type Error = VortexError

The type returned in the event of a conversion error.
source§

impl TryFrom<ExtensionArray> for TemporalArray

source§

type Error = VortexError

The type returned in the event of a conversion error.
source§

fn try_from(ext: ExtensionArray) -> Result<Self, Self::Error>

Performs the conversion.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

impl<T> Same for T

source§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> ErasedDestructor for T
where T: 'static,

§

impl<T> MaybeSendSync for T

§

impl<T> Ungil for T
where T: Send,