pub type GenericStringArray<OffsetSize> = GenericByteArray<GenericStringType<OffsetSize>>;
Expand description
A GenericByteArray
for storing str
Aliased Type§
struct GenericStringArray<OffsetSize> { /* private fields */ }
Implementations§
Source§impl<OffsetSize: OffsetSizeTrait> GenericStringArray<OffsetSize>
impl<OffsetSize: OffsetSizeTrait> GenericStringArray<OffsetSize>
Sourcepub const fn get_data_type() -> DataType
👎Deprecated: please use Self::DATA_TYPE
instead
pub const fn get_data_type() -> DataType
Self::DATA_TYPE
insteadGet the data type of the array.
Sourcepub fn num_chars(&self, i: usize) -> usize
pub fn num_chars(&self, i: usize) -> usize
Returns the number of Unicode Scalar Value
in the string at index i
.
§Performance
This function has O(n)
time complexity where n
is the string length.
If you can make sure that all chars in the string are in the range U+0x0000
~ U+0x007F
,
please use the function value_length
which has O(1) time complexity.
Sourcepub fn take_iter<'a>(
&'a self,
indexes: impl Iterator<Item = Option<usize>> + 'a,
) -> impl Iterator<Item = Option<&'a str>>
pub fn take_iter<'a>( &'a self, indexes: impl Iterator<Item = Option<usize>> + 'a, ) -> impl Iterator<Item = Option<&'a str>>
Returns an iterator that returns the values of array.value(i)
for an iterator with each element i
Sourcepub unsafe fn take_iter_unchecked<'a>(
&'a self,
indexes: impl Iterator<Item = Option<usize>> + 'a,
) -> impl Iterator<Item = Option<&'a str>>
pub unsafe fn take_iter_unchecked<'a>( &'a self, indexes: impl Iterator<Item = Option<usize>> + 'a, ) -> impl Iterator<Item = Option<&'a str>>
Returns an iterator that returns the values of array.value(i)
for an iterator with each element i
§Safety
caller must ensure that the indexes in the iterator are less than the array.len()
Sourcepub fn try_from_binary(
v: GenericBinaryArray<OffsetSize>,
) -> Result<Self, ArrowError>
pub fn try_from_binary( v: GenericBinaryArray<OffsetSize>, ) -> Result<Self, ArrowError>
Fallibly creates a GenericStringArray
from a GenericBinaryArray
returning
an error if GenericBinaryArray
contains invalid UTF-8 data
Source§impl<T: ByteArrayType> GenericByteArray<T>
impl<T: ByteArrayType> GenericByteArray<T>
Sourcepub fn new(
offsets: OffsetBuffer<T::Offset>,
values: Buffer,
nulls: Option<NullBuffer>,
) -> Self
pub fn new( offsets: OffsetBuffer<T::Offset>, values: Buffer, nulls: Option<NullBuffer>, ) -> Self
Create a new GenericByteArray
from the provided parts, panicking on failure
§Panics
Panics if GenericByteArray::try_new
returns an error
Sourcepub fn try_new(
offsets: OffsetBuffer<T::Offset>,
values: Buffer,
nulls: Option<NullBuffer>,
) -> Result<Self, ArrowError>
pub fn try_new( offsets: OffsetBuffer<T::Offset>, values: Buffer, nulls: Option<NullBuffer>, ) -> Result<Self, ArrowError>
Create a new GenericByteArray
from the provided parts, returning an error on failure
§Errors
offsets.len() - 1 != nulls.len()
- Any consecutive pair of
offsets
does not denote a valid slice ofvalues
Sourcepub unsafe fn new_unchecked(
offsets: OffsetBuffer<T::Offset>,
values: Buffer,
nulls: Option<NullBuffer>,
) -> Self
pub unsafe fn new_unchecked( offsets: OffsetBuffer<T::Offset>, values: Buffer, nulls: Option<NullBuffer>, ) -> Self
Create a new GenericByteArray
from the provided parts, without validation
§Safety
Safe if Self::try_new
would not error
Sourcepub fn new_null(len: usize) -> Self
pub fn new_null(len: usize) -> Self
Create a new GenericByteArray
of length len
where all values are null
Sourcepub fn from_iter_values<Ptr, I>(iter: I) -> Self
pub fn from_iter_values<Ptr, I>(iter: I) -> Self
Creates a GenericByteArray
based on an iterator of values without nulls
Sourcepub fn into_parts(self) -> (OffsetBuffer<T::Offset>, Buffer, Option<NullBuffer>)
pub fn into_parts(self) -> (OffsetBuffer<T::Offset>, Buffer, Option<NullBuffer>)
Deconstruct this array into its constituent parts
Sourcepub fn value_length(&self, i: usize) -> T::Offset
pub fn value_length(&self, i: usize) -> T::Offset
Sourcepub fn offsets(&self) -> &OffsetBuffer<T::Offset>
pub fn offsets(&self) -> &OffsetBuffer<T::Offset>
Returns a reference to the offsets of this array
Unlike Self::value_offsets
this returns the OffsetBuffer
allowing for zero-copy cloning
Sourcepub fn values(&self) -> &Buffer
pub fn values(&self) -> &Buffer
Returns the values of this array
Unlike Self::value_data
this returns the Buffer
allowing for zero-copy cloning
Sourcepub fn value_data(&self) -> &[u8] ⓘ
pub fn value_data(&self) -> &[u8] ⓘ
Returns the raw value data
Sourcepub fn value_offsets(&self) -> &[T::Offset]
pub fn value_offsets(&self) -> &[T::Offset]
Returns the offset values in the offsets buffer
Sourcepub unsafe fn value_unchecked(&self, i: usize) -> &T::Native
pub unsafe fn value_unchecked(&self, i: usize) -> &T::Native
Returns the element at index i
§Safety
Caller is responsible for ensuring that the index is within the bounds of the array
Sourcepub fn slice(&self, offset: usize, length: usize) -> Self
pub fn slice(&self, offset: usize, length: usize) -> Self
Returns a zero-copy slice of this array with the indicated offset and length.
Sourcepub fn into_builder(self) -> Result<GenericByteBuilder<T>, Self>
pub fn into_builder(self) -> Result<GenericByteBuilder<T>, Self>
Returns GenericByteBuilder
of this byte array for mutating its values if the underlying
offset and data buffers are not shared by others.
Trait Implementations§
Source§impl<OffsetSize: OffsetSizeTrait> From<GenericByteArray<GenericBinaryType<OffsetSize>>> for GenericStringArray<OffsetSize>
impl<OffsetSize: OffsetSizeTrait> From<GenericByteArray<GenericBinaryType<OffsetSize>>> for GenericStringArray<OffsetSize>
Source§fn from(v: GenericBinaryArray<OffsetSize>) -> Self
fn from(v: GenericBinaryArray<OffsetSize>) -> Self
Source§impl<OffsetSize: OffsetSizeTrait> From<GenericListArray<OffsetSize>> for GenericStringArray<OffsetSize>
impl<OffsetSize: OffsetSizeTrait> From<GenericListArray<OffsetSize>> for GenericStringArray<OffsetSize>
Source§fn from(v: GenericListArray<OffsetSize>) -> Self
fn from(v: GenericListArray<OffsetSize>) -> Self
Source§impl<OffsetSize: OffsetSizeTrait> From<Vec<&str>> for GenericStringArray<OffsetSize>
impl<OffsetSize: OffsetSizeTrait> From<Vec<&str>> for GenericStringArray<OffsetSize>
Source§impl<OffsetSize: OffsetSizeTrait> From<Vec<Option<&str>>> for GenericStringArray<OffsetSize>
impl<OffsetSize: OffsetSizeTrait> From<Vec<Option<&str>>> for GenericStringArray<OffsetSize>
Source§impl<OffsetSize: OffsetSizeTrait> From<Vec<Option<String>>> for GenericStringArray<OffsetSize>
impl<OffsetSize: OffsetSizeTrait> From<Vec<Option<String>>> for GenericStringArray<OffsetSize>
Source§impl<OffsetSize: OffsetSizeTrait> From<Vec<String>> for GenericStringArray<OffsetSize>
impl<OffsetSize: OffsetSizeTrait> From<Vec<String>> for GenericStringArray<OffsetSize>
Source§impl<OffsetSize: OffsetSizeTrait> PartialEq for GenericStringArray<OffsetSize>
impl<OffsetSize: OffsetSizeTrait> PartialEq for GenericStringArray<OffsetSize>
Source§impl<'a, O: OffsetSizeTrait> StringArrayType<'a> for &'a GenericStringArray<O>
impl<'a, O: OffsetSizeTrait> StringArrayType<'a> for &'a GenericStringArray<O>
Source§impl<T: ByteArrayType> Array for GenericByteArray<T>
impl<T: ByteArrayType> Array for GenericByteArray<T>
Source§fn slice(&self, offset: usize, length: usize) -> ArrayRef
fn slice(&self, offset: usize, length: usize) -> ArrayRef
Source§fn offset(&self) -> usize
fn offset(&self) -> usize
0
. Read moreSource§fn nulls(&self) -> Option<&NullBuffer>
fn nulls(&self) -> Option<&NullBuffer>
Source§fn logical_null_count(&self) -> usize
fn logical_null_count(&self) -> usize
Source§fn get_buffer_memory_size(&self) -> usize
fn get_buffer_memory_size(&self) -> usize
Source§fn get_array_memory_size(&self) -> usize
fn get_array_memory_size(&self) -> usize
get_buffer_memory_size()
and
includes the overhead of the data structures that contain the pointers to the various buffers.Source§fn logical_nulls(&self) -> Option<NullBuffer>
fn logical_nulls(&self) -> Option<NullBuffer>
NullBuffer
that represents the logical
null values of this array, if any. Read moreSource§fn null_count(&self) -> usize
fn null_count(&self) -> usize
Source§fn is_nullable(&self) -> bool
fn is_nullable(&self) -> bool
false
if the array is guaranteed to not contain any logical nulls Read more