Type Alias LargeStringArray
pub type LargeStringArray = Utf8Array<i64>;
Aliased Type§
struct LargeStringArray { /* private fields */ }
Implementations
§impl<O> Utf8Array<O>where
O: Offset,
impl<O> Utf8Array<O>where
O: Offset,
pub fn try_new(
dtype: ArrowDataType,
offsets: OffsetsBuffer<O>,
values: Buffer<u8>,
validity: Option<Bitmap>,
) -> Result<Utf8Array<O>, PolarsError>
pub fn try_new( dtype: ArrowDataType, offsets: OffsetsBuffer<O>, values: Buffer<u8>, validity: Option<Bitmap>, ) -> Result<Utf8Array<O>, PolarsError>
Returns a [Utf8Array
] created from its internal representation.
§Errors
This function returns an error iff:
- The last offset is greater than the values’ length.
- the validity’s length is not equal to
offsets.len_proxy()
. - The
dtype
’s [crate::datatypes::PhysicalType
] is not equal to eitherUtf8
orLargeUtf8
. - The
values
between two consecutiveoffsets
are not valid utf8
§Implementation
This function is O(N)
- checking utf8 is O(N)
pub fn from_slice<T, P>(slice: P) -> Utf8Array<O>
pub fn from_slice<T, P>(slice: P) -> Utf8Array<O>
Returns a [Utf8Array
] from a slice of &str
.
A convenience method that uses [Self::from_trusted_len_values_iter
].
pub fn from<T, P>(slice: P) -> Utf8Array<O>
pub fn from<T, P>(slice: P) -> Utf8Array<O>
Returns a new [Utf8Array
] from a slice of &str
.
A convenience method that uses [Self::from_trusted_len_iter
].
pub fn iter(
&self,
) -> ZipValidity<&str, ArrayValuesIter<'_, Utf8Array<O>>, BitmapIter<'_>>
pub fn iter( &self, ) -> ZipValidity<&str, ArrayValuesIter<'_, Utf8Array<O>>, BitmapIter<'_>>
Returns an iterator of Option<&str>
pub fn values_iter(&self) -> ArrayValuesIter<'_, Utf8Array<O>>
pub fn values_iter(&self) -> ArrayValuesIter<'_, Utf8Array<O>>
Returns an iterator of &str
pub fn non_null_values_iter(&self) -> NonNullValuesIter<'_, Utf8Array<O>>
pub fn non_null_values_iter(&self) -> NonNullValuesIter<'_, Utf8Array<O>>
Returns an iterator of the non-null values `&str.
pub fn value(&self, i: usize) -> &str
pub fn value(&self, i: usize) -> &str
Returns the value of the element at index i
, ignoring the array’s validity.
§Panic
This function panics iff i >= self.len
.
pub unsafe fn value_unchecked(&self, i: usize) -> &str
pub unsafe fn value_unchecked(&self, i: usize) -> &str
Returns the value of the element at index i
, ignoring the array’s validity.
§Safety
This function is safe iff i < self.len
.
pub fn dtype(&self) -> &ArrowDataType
pub fn dtype(&self) -> &ArrowDataType
Returns the ArrowDataType
of this array.
pub fn offsets(&self) -> &OffsetsBuffer<O>
pub fn offsets(&self) -> &OffsetsBuffer<O>
Returns the offsets of this [Utf8Array
].
pub unsafe fn slice_unchecked(&mut self, offset: usize, length: usize)
pub unsafe fn slice_unchecked(&mut self, offset: usize, length: usize)
pub unsafe fn sliced_unchecked(
self,
offset: usize,
length: usize,
) -> Utf8Array<O>
pub unsafe fn sliced_unchecked( self, offset: usize, length: usize, ) -> Utf8Array<O>
pub fn with_validity(self, validity: Option<Bitmap>) -> Utf8Array<O>
pub fn with_validity(self, validity: Option<Bitmap>) -> Utf8Array<O>
pub fn set_validity(&mut self, validity: Option<Bitmap>)
pub fn set_validity(&mut self, validity: Option<Bitmap>)
pub fn take_validity(&mut self) -> Option<Bitmap>
pub fn take_validity(&mut self) -> Option<Bitmap>
Takes the validity of this array, leaving it without a validity mask.
pub fn boxed(self) -> Box<dyn Array>
pub fn boxed(self) -> Box<dyn Array>
Boxes this array into a Box<dyn Array>
.
pub fn arced(self) -> Arc<dyn Array>
pub fn arced(self) -> Arc<dyn Array>
Arcs this array into a std::sync::Arc<dyn Array>
.
pub fn into_inner(
self,
) -> (ArrowDataType, OffsetsBuffer<O>, Buffer<u8>, Option<Bitmap>)
pub fn into_inner( self, ) -> (ArrowDataType, OffsetsBuffer<O>, Buffer<u8>, Option<Bitmap>)
Returns its internal representation
pub fn into_mut(self) -> Either<Utf8Array<O>, MutableUtf8Array<O>> ⓘ
pub fn into_mut(self) -> Either<Utf8Array<O>, MutableUtf8Array<O>> ⓘ
Try to convert this Utf8Array
to a MutableUtf8Array
pub fn new_empty(dtype: ArrowDataType) -> Utf8Array<O>
pub fn new_empty(dtype: ArrowDataType) -> Utf8Array<O>
Returns a new empty [Utf8Array
].
The array is guaranteed to have no elements nor validity.
pub fn new_null(dtype: ArrowDataType, length: usize) -> Utf8Array<O>
pub fn new_null(dtype: ArrowDataType, length: usize) -> Utf8Array<O>
Returns a new [Utf8Array
] whose all slots are null / None
.
pub fn default_dtype() -> ArrowDataType
pub fn default_dtype() -> ArrowDataType
Returns a default ArrowDataType
of this array, which depends on the generic parameter O
: DataType::Utf8
or DataType::LargeUtf8
pub unsafe fn new_unchecked(
dtype: ArrowDataType,
offsets: OffsetsBuffer<O>,
values: Buffer<u8>,
validity: Option<Bitmap>,
) -> Utf8Array<O>
pub unsafe fn new_unchecked( dtype: ArrowDataType, offsets: OffsetsBuffer<O>, values: Buffer<u8>, validity: Option<Bitmap>, ) -> Utf8Array<O>
Creates a new [Utf8Array
] without checking for offsets monotinicity nor utf8-validity
§Panic
This function panics (in debug mode only) iff:
- The last offset is greater than the values’ length.
- the validity’s length is not equal to
offsets.len_proxy()
. - The
dtype
’s [crate::datatypes::PhysicalType
] is not equal to eitherUtf8
orLargeUtf8
.
§Safety
This function is unsound iff:
- The
values
between two consecutiveoffsets
are not valid utf8
§Implementation
This function is O(1)
pub fn new(
dtype: ArrowDataType,
offsets: OffsetsBuffer<O>,
values: Buffer<u8>,
validity: Option<Bitmap>,
) -> Utf8Array<O>
pub fn new( dtype: ArrowDataType, offsets: OffsetsBuffer<O>, values: Buffer<u8>, validity: Option<Bitmap>, ) -> Utf8Array<O>
Creates a new [Utf8Array
].
§Panics
This function panics iff:
offsets.last()
is greater thanvalues.len()
.- the validity’s length is not equal to
offsets.len_proxy()
. - The
dtype
’s [crate::datatypes::PhysicalType
] is not equal to eitherUtf8
orLargeUtf8
. - The
values
between two consecutiveoffsets
are not valid utf8
§Implementation
This function is O(N)
- checking utf8 is O(N)
pub fn from_trusted_len_values_iter<T, I>(iterator: I) -> Utf8Array<O>
pub fn from_trusted_len_values_iter<T, I>(iterator: I) -> Utf8Array<O>
Returns a (non-null) [Utf8Array
] created from a [TrustedLen
] of &str
.
§Implementation
This function is O(N)
pub fn from_iter_values<T, I>(iterator: I) -> Utf8Array<O>
pub fn from_iter_values<T, I>(iterator: I) -> Utf8Array<O>
Creates a new [Utf8Array
] from a Iterator
of &str
.
pub unsafe fn from_trusted_len_iter_unchecked<I, P>(iterator: I) -> Utf8Array<O>
pub unsafe fn from_trusted_len_iter_unchecked<I, P>(iterator: I) -> Utf8Array<O>
Creates a [Utf8Array
] from an iterator of trusted length.
§Safety
The iterator must be TrustedLen
.
I.e. that size_hint().1
correctly reports its length.
pub fn from_trusted_len_iter<I, P>(iterator: I) -> Utf8Array<O>
pub fn from_trusted_len_iter<I, P>(iterator: I) -> Utf8Array<O>
Creates a [Utf8Array
] from an iterator of trusted length.
pub unsafe fn try_from_trusted_len_iter_unchecked<E, I, P>(
iterator: I,
) -> Result<Utf8Array<O>, E>
pub unsafe fn try_from_trusted_len_iter_unchecked<E, I, P>( iterator: I, ) -> Result<Utf8Array<O>, E>
Creates a [Utf8Array
] from an falible iterator of trusted length.
§Safety
The iterator must be TrustedLen
.
I.e. that size_hint().1
correctly reports its length.
pub fn try_from_trusted_len_iter<E, I, P>(iter: I) -> Result<Utf8Array<O>, E>
pub fn try_from_trusted_len_iter<E, I, P>(iter: I) -> Result<Utf8Array<O>, E>
Creates a [Utf8Array
] from an fallible iterator of trusted length.
pub fn apply_validity<F>(&mut self, f: F)where
F: FnOnce(Bitmap) -> Bitmap,
pub fn apply_validity<F>(&mut self, f: F)where
F: FnOnce(Bitmap) -> Bitmap,
Applies a function f
to the validity of this array.
This is an API to leverage clone-on-write
§Panics
This function panics if the function f
modifies the length of the [Bitmap
].
pub fn to_binary(&self) -> BinaryArray<O>
Trait Implementations
§impl<O> Array for Utf8Array<O>where
O: Offset,
impl<O> Array for Utf8Array<O>where
O: Offset,
§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Any
, which enables downcasting to concrete types.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Any
, which enables mutable downcasting to concrete types.§fn len(&self) -> usize
fn len(&self) -> usize
Array
]. Every array has a length corresponding to the number of
elements (slots).§fn dtype(&self) -> &ArrowDataType
fn dtype(&self) -> &ArrowDataType
ArrowDataType
of the [Array
]. In combination with [Array::as_any
], this can be
used to downcast trait objects (dyn Array
) to concrete arrays.§fn split_at_boxed(&self, offset: usize) -> (Box<dyn Array>, Box<dyn Array>)
fn split_at_boxed(&self, offset: usize) -> (Box<dyn Array>, Box<dyn Array>)
Self
] at offset
into two boxed [Array
]s where offset <= self.len()
.§unsafe fn split_at_boxed_unchecked(
&self,
offset: usize,
) -> (Box<dyn Array>, Box<dyn Array>)
unsafe fn split_at_boxed_unchecked( &self, offset: usize, ) -> (Box<dyn Array>, Box<dyn Array>)
§unsafe fn slice_unchecked(&mut self, offset: usize, length: usize)
unsafe fn slice_unchecked(&mut self, offset: usize, length: usize)
Array
]. Read more§fn validity(&self) -> Option<&Bitmap>
fn validity(&self) -> Option<&Bitmap>
Array
]: every array has an optional [Bitmap
] that, when available
specifies whether the array slot is valid or not (null).
When the validity is None
, all slots are valid.§fn with_validity(&self, validity: Option<Bitmap>) -> Box<dyn Array>
fn with_validity(&self, validity: Option<Bitmap>) -> Box<dyn Array>
Array
] with a new assigned bitmap. Read more§fn null_count(&self) -> usize
fn null_count(&self) -> usize
Array
]. Read morefn has_nulls(&self) -> bool
§unsafe fn is_null_unchecked(&self, i: usize) -> bool
unsafe fn is_null_unchecked(&self, i: usize) -> bool
i
is null. Read more§impl<'a, O> ArrayAccessor<'a> for Utf8Array<O>where
O: Offset,
impl<'a, O> ArrayAccessor<'a> for Utf8Array<O>where
O: Offset,
§impl<T> ArrayFromIter<Option<T>> for Utf8Array<i64>where
T: StrIntoBytes,
impl<T> ArrayFromIter<Option<T>> for Utf8Array<i64>where
T: StrIntoBytes,
fn arr_from_iter<I>(iter: I) -> Utf8Array<i64>where
I: IntoIterator<Item = Option<T>>,
fn arr_from_iter_trusted<I>(iter: I) -> Utf8Array<i64>
fn try_arr_from_iter<E, I>(iter: I) -> Result<Utf8Array<i64>, E>
fn try_arr_from_iter_trusted<E, I>(iter: I) -> Result<Utf8Array<i64>, E>
§impl<T> ArrayFromIter<T> for Utf8Array<i64>where
T: StrIntoBytes,
impl<T> ArrayFromIter<T> for Utf8Array<i64>where
T: StrIntoBytes,
fn arr_from_iter<I>(iter: I) -> Utf8Array<i64>where
I: IntoIterator<Item = T>,
fn arr_from_iter_trusted<I>(iter: I) -> Utf8Array<i64>
fn try_arr_from_iter<E, I>(iter: I) -> Result<Utf8Array<i64>, E>where
I: IntoIterator<Item = Result<T, E>>,
fn try_arr_from_iter_trusted<E, I>(iter: I) -> Result<Utf8Array<i64>, E>where
I: IntoIterator<Item = Result<T, E>>,
§impl FromDataUtf8 for Utf8Array<i64>
impl FromDataUtf8 for Utf8Array<i64>
§impl<O, P> FromIterator<Option<P>> for Utf8Array<O>
impl<O, P> FromIterator<Option<P>> for Utf8Array<O>
§fn from_iter<I>(iter: I) -> Utf8Array<O>where
I: IntoIterator<Item = Option<P>>,
fn from_iter<I>(iter: I) -> Utf8Array<O>where
I: IntoIterator<Item = Option<P>>,
§impl<O> GenericBinaryArray<O> for Utf8Array<O>where
O: Offset,
impl<O> GenericBinaryArray<O> for Utf8Array<O>where
O: Offset,
§impl<O> MinMaxKernel for Utf8Array<O>where
O: Offset,
impl<O> MinMaxKernel for Utf8Array<O>where
O: Offset,
type Scalar<'a> = &'a str
fn min_ignore_nan_kernel( &self, ) -> Option<<Utf8Array<O> as MinMaxKernel>::Scalar<'_>>
fn max_ignore_nan_kernel( &self, ) -> Option<<Utf8Array<O> as MinMaxKernel>::Scalar<'_>>
fn min_propagate_nan_kernel( &self, ) -> Option<<Utf8Array<O> as MinMaxKernel>::Scalar<'_>>
fn max_propagate_nan_kernel( &self, ) -> Option<<Utf8Array<O> as MinMaxKernel>::Scalar<'_>>
fn min_max_ignore_nan_kernel( &self, ) -> Option<(Self::Scalar<'_>, Self::Scalar<'_>)>
fn min_max_propagate_nan_kernel( &self, ) -> Option<(Self::Scalar<'_>, Self::Scalar<'_>)>
§impl ParameterFreeDtypeStaticArray for Utf8Array<i64>
impl ParameterFreeDtypeStaticArray for Utf8Array<i64>
fn get_dtype() -> ArrowDataType
§impl<O> Splitable for Utf8Array<O>where
O: Offset,
impl<O> Splitable for Utf8Array<O>where
O: Offset,
fn check_bound(&self, offset: usize) -> bool
§unsafe fn _split_at_unchecked(
&self,
offset: usize,
) -> (Utf8Array<O>, Utf8Array<O>)
unsafe fn _split_at_unchecked( &self, offset: usize, ) -> (Utf8Array<O>, Utf8Array<O>)
split_at_unchecked
. For any usage, prefer the using
split_at
or split_at_unchecked
. Read more§fn split_at(&self, offset: usize) -> (Self, Self)
fn split_at(&self, offset: usize) -> (Self, Self)
Self
] at offset
where offset <= self.len()
.