Struct arrow::array::PrimitiveArray[][src]

pub struct PrimitiveArray<T: ArrowPrimitiveType> { /* fields omitted */ }
Expand description

Array whose elements are of primitive types.

Implementations

impl<T: ArrowPrimitiveType> PrimitiveArray<T>[src]

pub fn len(&self) -> usize[src]

Returns the length of this array.

pub fn is_empty(&self) -> bool[src]

Returns whether this array is empty.

pub fn values(&self) -> &[T::Native]

Notable traits for &'_ [u8]

impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
[src]

Returns a slice of the values of this array

pub fn builder(capacity: usize) -> PrimitiveBuilder<T>[src]

pub unsafe fn value_unchecked(&self, i: usize) -> T::Native[src]

Returns the primitive value at index i.

Safety

caller must ensure that the passed in offset is less than the array len()

pub fn value(&self, i: usize) -> T::Native[src]

Returns the primitive value at index i.

Note this doesn’t do any bound checking, for performance reason.

Safety

caller must ensure that the passed in offset is less than the array len()

pub fn from_iter_values<I: IntoIterator<Item = T::Native>>(iter: I) -> Self[src]

Creates a PrimitiveArray based on an iterator of values without nulls

pub fn from_value(value: T::Native, count: usize) -> Self[src]

Creates a PrimitiveArray based on a constant value with count elements

impl<T: ArrowTemporalType + ArrowNumericType> PrimitiveArray<T> where
    i64: From<T::Native>, 
[src]

pub fn value_as_datetime(&self, i: usize) -> Option<NaiveDateTime>[src]

Returns value as a chrono NaiveDateTime, handling time resolution

If a data type cannot be converted to NaiveDateTime, a None is returned. A valid value is expected, thus the user should first check for validity.

pub fn value_as_date(&self, i: usize) -> Option<NaiveDate>[src]

Returns value as a chrono NaiveDate by using Self::datetime()

If a data type cannot be converted to NaiveDate, a None is returned

pub fn value_as_time(&self, i: usize) -> Option<NaiveTime>[src]

Returns a value as a chrono NaiveTime

Date32 and Date64 return UTC midnight as they do not have time resolution

pub fn value_as_duration(&self, i: usize) -> Option<Duration>[src]

Returns a value as a chrono Duration

If a data type cannot be converted to Duration, a None is returned

impl<'a, T: ArrowPrimitiveType> PrimitiveArray<T>[src]

pub fn iter(&'a self) -> PrimitiveIter<'a, T>

Notable traits for PrimitiveIter<'a, T>

impl<'a, T: ArrowPrimitiveType> Iterator for PrimitiveIter<'a, T> type Item = Option<T::Native>;
[src]

constructs a new iterator

impl<T: ArrowPrimitiveType> PrimitiveArray<T>[src]

pub unsafe fn from_trusted_len_iter<I, P>(iter: I) -> Self where
    P: Borrow<Option<<T as ArrowPrimitiveType>::Native>>,
    I: IntoIterator<Item = P>, 
[src]

Creates a PrimitiveArray from an iterator of trusted length.

Safety

The iterator must be TrustedLen. I.e. that size_hint().1 correctly reports its length.

impl<T: ArrowTimestampType> PrimitiveArray<T>[src]

pub fn from_vec(data: Vec<i64>, timezone: Option<String>) -> Self[src]

Construct a timestamp array from a vec of i64 values and an optional timezone

impl<T: ArrowTimestampType> PrimitiveArray<T>[src]

pub fn from_opt_vec(data: Vec<Option<i64>>, timezone: Option<String>) -> Self[src]

Construct a timestamp array from a vec of Option values and an optional timezone

Trait Implementations

impl<T: ArrowPrimitiveType> Array for PrimitiveArray<T>[src]

fn get_buffer_memory_size(&self) -> usize[src]

Returns the total number of bytes of memory occupied by the buffers owned by this PrimitiveArray.

fn get_array_memory_size(&self) -> usize[src]

Returns the total number of bytes of memory occupied physically by this PrimitiveArray.

fn as_any(&self) -> &dyn Any[src]

Returns the array as Any so that it can be downcasted to a specific implementation. Read more

fn data(&self) -> &ArrayData[src]

Returns a reference to the underlying data of this array.

fn data_ref(&self) -> &ArrayData[src]

Returns a reference-counted pointer to the underlying data of this array.

fn data_type(&self) -> &DataType[src]

Returns a reference to the DataType of this array. Read more

fn slice(&self, offset: usize, length: usize) -> ArrayRef[src]

Returns a zero-copy slice of this array with the indicated offset and length. Read more

fn len(&self) -> usize[src]

Returns the length (i.e., number of elements) of this array. Read more

fn is_empty(&self) -> bool[src]

Returns whether this array is empty. Read more

fn offset(&self) -> usize[src]

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

fn is_null(&self, index: usize) -> bool[src]

Returns whether the element at index is null. When using this function on a slice, the index is relative to the slice. Read more

fn is_valid(&self, index: usize) -> bool[src]

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

fn null_count(&self) -> usize[src]

Returns the total number of null values in this array. Read more

fn to_raw(&self) -> Result<(*const FFI_ArrowArray, *const FFI_ArrowSchema)>[src]

returns two pointers that represent this array in the C Data Interface (FFI)

impl<T: ArrowPrimitiveType> Debug for PrimitiveArray<T>[src]

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

Formats the value using the given formatter. Read more

impl<T: ArrowPrimitiveType> From<ArrayData> for PrimitiveArray<T>[src]

Constructs a PrimitiveArray from an array data reference.

fn from(data: ArrayData) -> Self[src]

Performs the conversion.

impl From<Vec<<Date32Type as ArrowPrimitiveType>::Native, Global>> for PrimitiveArray<Date32Type>[src]

fn from(data: Vec<<Date32Type as ArrowPrimitiveType>::Native>) -> Self[src]

Performs the conversion.

impl From<Vec<<Date64Type as ArrowPrimitiveType>::Native, Global>> for PrimitiveArray<Date64Type>[src]

fn from(data: Vec<<Date64Type as ArrowPrimitiveType>::Native>) -> Self[src]

Performs the conversion.

impl From<Vec<<DurationMicrosecondType as ArrowPrimitiveType>::Native, Global>> for PrimitiveArray<DurationMicrosecondType>[src]

fn from(
    data: Vec<<DurationMicrosecondType as ArrowPrimitiveType>::Native>
) -> Self
[src]

Performs the conversion.

impl From<Vec<<DurationMillisecondType as ArrowPrimitiveType>::Native, Global>> for PrimitiveArray<DurationMillisecondType>[src]

fn from(
    data: Vec<<DurationMillisecondType as ArrowPrimitiveType>::Native>
) -> Self
[src]

Performs the conversion.

impl From<Vec<<DurationNanosecondType as ArrowPrimitiveType>::Native, Global>> for PrimitiveArray<DurationNanosecondType>[src]

fn from(
    data: Vec<<DurationNanosecondType as ArrowPrimitiveType>::Native>
) -> Self
[src]

Performs the conversion.

impl From<Vec<<DurationSecondType as ArrowPrimitiveType>::Native, Global>> for PrimitiveArray<DurationSecondType>[src]

fn from(data: Vec<<DurationSecondType as ArrowPrimitiveType>::Native>) -> Self[src]

Performs the conversion.

impl From<Vec<<Float32Type as ArrowPrimitiveType>::Native, Global>> for PrimitiveArray<Float32Type>[src]

fn from(data: Vec<<Float32Type as ArrowPrimitiveType>::Native>) -> Self[src]

Performs the conversion.

impl From<Vec<<Float64Type as ArrowPrimitiveType>::Native, Global>> for PrimitiveArray<Float64Type>[src]

fn from(data: Vec<<Float64Type as ArrowPrimitiveType>::Native>) -> Self[src]

Performs the conversion.

impl From<Vec<<Int16Type as ArrowPrimitiveType>::Native, Global>> for PrimitiveArray<Int16Type>[src]

fn from(data: Vec<<Int16Type as ArrowPrimitiveType>::Native>) -> Self[src]

Performs the conversion.

impl From<Vec<<Int32Type as ArrowPrimitiveType>::Native, Global>> for PrimitiveArray<Int32Type>[src]

fn from(data: Vec<<Int32Type as ArrowPrimitiveType>::Native>) -> Self[src]

Performs the conversion.

impl From<Vec<<Int64Type as ArrowPrimitiveType>::Native, Global>> for PrimitiveArray<Int64Type>[src]

fn from(data: Vec<<Int64Type as ArrowPrimitiveType>::Native>) -> Self[src]

Performs the conversion.

impl From<Vec<<Int8Type as ArrowPrimitiveType>::Native, Global>> for PrimitiveArray<Int8Type>[src]

fn from(data: Vec<<Int8Type as ArrowPrimitiveType>::Native>) -> Self[src]

Performs the conversion.

impl From<Vec<<IntervalDayTimeType as ArrowPrimitiveType>::Native, Global>> for PrimitiveArray<IntervalDayTimeType>[src]

fn from(data: Vec<<IntervalDayTimeType as ArrowPrimitiveType>::Native>) -> Self[src]

Performs the conversion.

impl From<Vec<<IntervalYearMonthType as ArrowPrimitiveType>::Native, Global>> for PrimitiveArray<IntervalYearMonthType>[src]

fn from(
    data: Vec<<IntervalYearMonthType as ArrowPrimitiveType>::Native>
) -> Self
[src]

Performs the conversion.

impl From<Vec<<Time32MillisecondType as ArrowPrimitiveType>::Native, Global>> for PrimitiveArray<Time32MillisecondType>[src]

fn from(
    data: Vec<<Time32MillisecondType as ArrowPrimitiveType>::Native>
) -> Self
[src]

Performs the conversion.

impl From<Vec<<Time32SecondType as ArrowPrimitiveType>::Native, Global>> for PrimitiveArray<Time32SecondType>[src]

fn from(data: Vec<<Time32SecondType as ArrowPrimitiveType>::Native>) -> Self[src]

Performs the conversion.

impl From<Vec<<Time64MicrosecondType as ArrowPrimitiveType>::Native, Global>> for PrimitiveArray<Time64MicrosecondType>[src]

fn from(
    data: Vec<<Time64MicrosecondType as ArrowPrimitiveType>::Native>
) -> Self
[src]

Performs the conversion.

impl From<Vec<<Time64NanosecondType as ArrowPrimitiveType>::Native, Global>> for PrimitiveArray<Time64NanosecondType>[src]

fn from(data: Vec<<Time64NanosecondType as ArrowPrimitiveType>::Native>) -> Self[src]

Performs the conversion.

impl From<Vec<<TimestampMicrosecondType as ArrowPrimitiveType>::Native, Global>> for PrimitiveArray<TimestampMicrosecondType>[src]

fn from(
    data: Vec<<TimestampMicrosecondType as ArrowPrimitiveType>::Native>
) -> Self
[src]

Performs the conversion.

impl From<Vec<<TimestampMillisecondType as ArrowPrimitiveType>::Native, Global>> for PrimitiveArray<TimestampMillisecondType>[src]

fn from(
    data: Vec<<TimestampMillisecondType as ArrowPrimitiveType>::Native>
) -> Self
[src]

Performs the conversion.

impl From<Vec<<TimestampNanosecondType as ArrowPrimitiveType>::Native, Global>> for PrimitiveArray<TimestampNanosecondType>[src]

fn from(
    data: Vec<<TimestampNanosecondType as ArrowPrimitiveType>::Native>
) -> Self
[src]

Performs the conversion.

impl From<Vec<<TimestampSecondType as ArrowPrimitiveType>::Native, Global>> for PrimitiveArray<TimestampSecondType>[src]

fn from(data: Vec<<TimestampSecondType as ArrowPrimitiveType>::Native>) -> Self[src]

Performs the conversion.

impl From<Vec<<UInt16Type as ArrowPrimitiveType>::Native, Global>> for PrimitiveArray<UInt16Type>[src]

fn from(data: Vec<<UInt16Type as ArrowPrimitiveType>::Native>) -> Self[src]

Performs the conversion.

impl From<Vec<<UInt32Type as ArrowPrimitiveType>::Native, Global>> for PrimitiveArray<UInt32Type>[src]

fn from(data: Vec<<UInt32Type as ArrowPrimitiveType>::Native>) -> Self[src]

Performs the conversion.

impl From<Vec<<UInt64Type as ArrowPrimitiveType>::Native, Global>> for PrimitiveArray<UInt64Type>[src]

fn from(data: Vec<<UInt64Type as ArrowPrimitiveType>::Native>) -> Self[src]

Performs the conversion.

impl From<Vec<<UInt8Type as ArrowPrimitiveType>::Native, Global>> for PrimitiveArray<UInt8Type>[src]

fn from(data: Vec<<UInt8Type as ArrowPrimitiveType>::Native>) -> Self[src]

Performs the conversion.

impl From<Vec<Option<<Date32Type as ArrowPrimitiveType>::Native>, Global>> for PrimitiveArray<Date32Type>[src]

fn from(data: Vec<Option<<Date32Type as ArrowPrimitiveType>::Native>>) -> Self[src]

Performs the conversion.

impl From<Vec<Option<<Date64Type as ArrowPrimitiveType>::Native>, Global>> for PrimitiveArray<Date64Type>[src]

fn from(data: Vec<Option<<Date64Type as ArrowPrimitiveType>::Native>>) -> Self[src]

Performs the conversion.

impl From<Vec<Option<<DurationMicrosecondType as ArrowPrimitiveType>::Native>, Global>> for PrimitiveArray<DurationMicrosecondType>[src]

fn from(
    data: Vec<Option<<DurationMicrosecondType as ArrowPrimitiveType>::Native>>
) -> Self
[src]

Performs the conversion.

impl From<Vec<Option<<DurationMillisecondType as ArrowPrimitiveType>::Native>, Global>> for PrimitiveArray<DurationMillisecondType>[src]

fn from(
    data: Vec<Option<<DurationMillisecondType as ArrowPrimitiveType>::Native>>
) -> Self
[src]

Performs the conversion.

impl From<Vec<Option<<DurationNanosecondType as ArrowPrimitiveType>::Native>, Global>> for PrimitiveArray<DurationNanosecondType>[src]

fn from(
    data: Vec<Option<<DurationNanosecondType as ArrowPrimitiveType>::Native>>
) -> Self
[src]

Performs the conversion.

impl From<Vec<Option<<DurationSecondType as ArrowPrimitiveType>::Native>, Global>> for PrimitiveArray<DurationSecondType>[src]

fn from(
    data: Vec<Option<<DurationSecondType as ArrowPrimitiveType>::Native>>
) -> Self
[src]

Performs the conversion.

impl From<Vec<Option<<Float32Type as ArrowPrimitiveType>::Native>, Global>> for PrimitiveArray<Float32Type>[src]

fn from(data: Vec<Option<<Float32Type as ArrowPrimitiveType>::Native>>) -> Self[src]

Performs the conversion.

impl From<Vec<Option<<Float64Type as ArrowPrimitiveType>::Native>, Global>> for PrimitiveArray<Float64Type>[src]

fn from(data: Vec<Option<<Float64Type as ArrowPrimitiveType>::Native>>) -> Self[src]

Performs the conversion.

impl From<Vec<Option<<Int16Type as ArrowPrimitiveType>::Native>, Global>> for PrimitiveArray<Int16Type>[src]

fn from(data: Vec<Option<<Int16Type as ArrowPrimitiveType>::Native>>) -> Self[src]

Performs the conversion.

impl From<Vec<Option<<Int32Type as ArrowPrimitiveType>::Native>, Global>> for PrimitiveArray<Int32Type>[src]

fn from(data: Vec<Option<<Int32Type as ArrowPrimitiveType>::Native>>) -> Self[src]

Performs the conversion.

impl From<Vec<Option<<Int64Type as ArrowPrimitiveType>::Native>, Global>> for PrimitiveArray<Int64Type>[src]

fn from(data: Vec<Option<<Int64Type as ArrowPrimitiveType>::Native>>) -> Self[src]

Performs the conversion.

impl From<Vec<Option<<Int8Type as ArrowPrimitiveType>::Native>, Global>> for PrimitiveArray<Int8Type>[src]

fn from(data: Vec<Option<<Int8Type as ArrowPrimitiveType>::Native>>) -> Self[src]

Performs the conversion.

impl From<Vec<Option<<IntervalDayTimeType as ArrowPrimitiveType>::Native>, Global>> for PrimitiveArray<IntervalDayTimeType>[src]

fn from(
    data: Vec<Option<<IntervalDayTimeType as ArrowPrimitiveType>::Native>>
) -> Self
[src]

Performs the conversion.

impl From<Vec<Option<<IntervalYearMonthType as ArrowPrimitiveType>::Native>, Global>> for PrimitiveArray<IntervalYearMonthType>[src]

fn from(
    data: Vec<Option<<IntervalYearMonthType as ArrowPrimitiveType>::Native>>
) -> Self
[src]

Performs the conversion.

impl From<Vec<Option<<Time32MillisecondType as ArrowPrimitiveType>::Native>, Global>> for PrimitiveArray<Time32MillisecondType>[src]

fn from(
    data: Vec<Option<<Time32MillisecondType as ArrowPrimitiveType>::Native>>
) -> Self
[src]

Performs the conversion.

impl From<Vec<Option<<Time32SecondType as ArrowPrimitiveType>::Native>, Global>> for PrimitiveArray<Time32SecondType>[src]

fn from(
    data: Vec<Option<<Time32SecondType as ArrowPrimitiveType>::Native>>
) -> Self
[src]

Performs the conversion.

impl From<Vec<Option<<Time64MicrosecondType as ArrowPrimitiveType>::Native>, Global>> for PrimitiveArray<Time64MicrosecondType>[src]

fn from(
    data: Vec<Option<<Time64MicrosecondType as ArrowPrimitiveType>::Native>>
) -> Self
[src]

Performs the conversion.

impl From<Vec<Option<<Time64NanosecondType as ArrowPrimitiveType>::Native>, Global>> for PrimitiveArray<Time64NanosecondType>[src]

fn from(
    data: Vec<Option<<Time64NanosecondType as ArrowPrimitiveType>::Native>>
) -> Self
[src]

Performs the conversion.

impl From<Vec<Option<<TimestampMicrosecondType as ArrowPrimitiveType>::Native>, Global>> for PrimitiveArray<TimestampMicrosecondType>[src]

fn from(
    data: Vec<Option<<TimestampMicrosecondType as ArrowPrimitiveType>::Native>>
) -> Self
[src]

Performs the conversion.

impl From<Vec<Option<<TimestampMillisecondType as ArrowPrimitiveType>::Native>, Global>> for PrimitiveArray<TimestampMillisecondType>[src]

fn from(
    data: Vec<Option<<TimestampMillisecondType as ArrowPrimitiveType>::Native>>
) -> Self
[src]

Performs the conversion.

impl From<Vec<Option<<TimestampNanosecondType as ArrowPrimitiveType>::Native>, Global>> for PrimitiveArray<TimestampNanosecondType>[src]

fn from(
    data: Vec<Option<<TimestampNanosecondType as ArrowPrimitiveType>::Native>>
) -> Self
[src]

Performs the conversion.

impl From<Vec<Option<<TimestampSecondType as ArrowPrimitiveType>::Native>, Global>> for PrimitiveArray<TimestampSecondType>[src]

fn from(
    data: Vec<Option<<TimestampSecondType as ArrowPrimitiveType>::Native>>
) -> Self
[src]

Performs the conversion.

impl From<Vec<Option<<UInt16Type as ArrowPrimitiveType>::Native>, Global>> for PrimitiveArray<UInt16Type>[src]

fn from(data: Vec<Option<<UInt16Type as ArrowPrimitiveType>::Native>>) -> Self[src]

Performs the conversion.

impl From<Vec<Option<<UInt32Type as ArrowPrimitiveType>::Native>, Global>> for PrimitiveArray<UInt32Type>[src]

fn from(data: Vec<Option<<UInt32Type as ArrowPrimitiveType>::Native>>) -> Self[src]

Performs the conversion.

impl From<Vec<Option<<UInt64Type as ArrowPrimitiveType>::Native>, Global>> for PrimitiveArray<UInt64Type>[src]

fn from(data: Vec<Option<<UInt64Type as ArrowPrimitiveType>::Native>>) -> Self[src]

Performs the conversion.

impl From<Vec<Option<<UInt8Type as ArrowPrimitiveType>::Native>, Global>> for PrimitiveArray<UInt8Type>[src]

fn from(data: Vec<Option<<UInt8Type as ArrowPrimitiveType>::Native>>) -> Self[src]

Performs the conversion.

impl<T: ArrowPrimitiveType, Ptr: Borrow<Option<<T as ArrowPrimitiveType>::Native>>> FromIterator<Ptr> for PrimitiveArray<T>[src]

fn from_iter<I: IntoIterator<Item = Ptr>>(iter: I) -> Self[src]

Creates a value from an iterator. Read more

impl<'a, T: ArrowPrimitiveType> IntoIterator for &'a PrimitiveArray<T>[src]

type Item = Option<<T as ArrowPrimitiveType>::Native>

The type of the elements being iterated over.

type IntoIter = PrimitiveIter<'a, T>

Which kind of iterator are we turning this into?

fn into_iter(self) -> Self::IntoIter[src]

Creates an iterator from a value. Read more

impl<T: ArrowPrimitiveType> JsonEqual for PrimitiveArray<T>[src]

Implement array equals for numeric type

fn equals_json(&self, json: &[&Value]) -> bool[src]

Checks whether arrow array equals to json array.

fn equals_json_values(&self, json: &[Value]) -> bool[src]

Checks whether arrow array equals to json array.

impl<T: ArrowPrimitiveType> PartialEq<PrimitiveArray<T>> for PrimitiveArray<T>[src]

fn eq(&self, other: &PrimitiveArray<T>) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests for !=.

impl<T: ArrowPrimitiveType> PartialEq<Value> for PrimitiveArray<T>[src]

fn eq(&self, json: &Value) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests for !=.

Auto Trait Implementations

impl<T> RefUnwindSafe for PrimitiveArray<T> where
    <T as ArrowPrimitiveType>::Native: RefUnwindSafe

impl<T> Send for PrimitiveArray<T>

impl<T> Sync for PrimitiveArray<T>

impl<T> Unpin for PrimitiveArray<T>

impl<T> UnwindSafe for PrimitiveArray<T> where
    <T as ArrowPrimitiveType>::Native: RefUnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

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

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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

Performs the conversion.

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

pub fn vzip(self) -> V