pub struct FixedSizeBinaryArray {
data_type: DataType,
value_data: Buffer,
nulls: Option<NullBuffer>,
len: usize,
value_length: i32,
}
Expand description
An array of fixed size binary arrays
§Examples
Create an array from an iterable argument of byte slices.
use arrow_array::{Array, FixedSizeBinaryArray};
let input_arg = vec![ vec![1, 2], vec![3, 4], vec![5, 6] ];
let arr = FixedSizeBinaryArray::try_from_iter(input_arg.into_iter()).unwrap();
assert_eq!(3, arr.len());
Create an array from an iterable argument of sparse byte slices.
Sparsity means that the input argument can contain None
items.
use arrow_array::{Array, FixedSizeBinaryArray};
let input_arg = vec![ None, Some(vec![7, 8]), Some(vec![9, 10]), None, Some(vec![13, 14]) ];
let arr = FixedSizeBinaryArray::try_from_sparse_iter_with_size(input_arg.into_iter(), 2).unwrap();
assert_eq!(5, arr.len())
Fields§
§data_type: DataType
§value_data: Buffer
§nulls: Option<NullBuffer>
§len: usize
§value_length: i32
Implementations§
Source§impl FixedSizeBinaryArray
impl FixedSizeBinaryArray
Sourcepub fn new(size: i32, values: Buffer, nulls: Option<NullBuffer>) -> Self
pub fn new(size: i32, values: Buffer, nulls: Option<NullBuffer>) -> Self
Create a new FixedSizeBinaryArray
with size
element size, panicking on failure
§Panics
Panics if Self::try_new
returns an error
Sourcepub fn try_new(
size: i32,
values: Buffer,
nulls: Option<NullBuffer>,
) -> Result<Self, ArrowError>
pub fn try_new( size: i32, values: Buffer, nulls: Option<NullBuffer>, ) -> Result<Self, ArrowError>
Create a new FixedSizeBinaryArray
from the provided parts, returning an error on failure
§Errors
size < 0
values.len() / size != nulls.len()
Sourcepub fn new_null(size: i32, len: usize) -> Self
pub fn new_null(size: i32, len: usize) -> Self
Create a new FixedSizeBinaryArray
of length len
where all values are null
§Panics
Panics if
size < 0
size * len
would overflowusize
Sourcepub fn into_parts(self) -> (i32, Buffer, Option<NullBuffer>)
pub fn into_parts(self) -> (i32, Buffer, Option<NullBuffer>)
Deconstruct this array into its constituent parts
Sourcepub unsafe fn value_unchecked(&self, i: usize) -> &[u8] ⓘ
pub unsafe fn value_unchecked(&self, i: usize) -> &[u8] ⓘ
Returns the element at index i
as a byte slice.
§Safety
Caller is responsible for ensuring that the index is within the bounds of the array
Sourcepub fn value_offset(&self, i: usize) -> i32
pub fn value_offset(&self, i: usize) -> i32
Returns the offset for the element at index i
.
Note this doesn’t do any bound checking, for performance reason.
Sourcepub fn value_length(&self) -> i32
pub fn value_length(&self) -> i32
Returns the length for an element.
All elements have the same length as the array is a fixed size.
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 slice(&self, offset: usize, len: usize) -> Self
pub fn slice(&self, offset: usize, len: usize) -> Self
Returns a zero-copy slice of this array with the indicated offset and length.
Sourcepub fn try_from_sparse_iter<T, U>(iter: T) -> Result<Self, ArrowError>
👎Deprecated since 28.0.0: This function will fail if the iterator produces only None values; prefer try_from_sparse_iter_with_size
pub fn try_from_sparse_iter<T, U>(iter: T) -> Result<Self, ArrowError>
try_from_sparse_iter_with_size
Create an array from an iterable argument of sparse byte slices.
Sparsity means that items returned by the iterator are optional, i.e input argument can
contain None
items.
§Examples
use arrow_array::FixedSizeBinaryArray;
let input_arg = vec![
None,
Some(vec![7, 8]),
Some(vec![9, 10]),
None,
Some(vec![13, 14]),
None,
];
let array = FixedSizeBinaryArray::try_from_sparse_iter(input_arg.into_iter()).unwrap();
§Errors
Returns error if argument has length zero, or sizes of nested slices don’t match.
Sourcepub fn try_from_sparse_iter_with_size<T, U>(
iter: T,
size: i32,
) -> Result<Self, ArrowError>
pub fn try_from_sparse_iter_with_size<T, U>( iter: T, size: i32, ) -> Result<Self, ArrowError>
Create an array from an iterable argument of sparse byte slices.
Sparsity means that items returned by the iterator are optional, i.e input argument can
contain None
items. In cases where the iterator returns only None
values, this
also takes a size parameter to ensure that the a valid FixedSizeBinaryArray is still
created.
§Examples
use arrow_array::FixedSizeBinaryArray;
let input_arg = vec![
None,
Some(vec![7, 8]),
Some(vec![9, 10]),
None,
Some(vec![13, 14]),
None,
];
let array = FixedSizeBinaryArray::try_from_sparse_iter_with_size(input_arg.into_iter(), 2).unwrap();
§Errors
Returns error if argument has length zero, or sizes of nested slices don’t match.
Sourcepub fn try_from_iter<T, U>(iter: T) -> Result<Self, ArrowError>
pub fn try_from_iter<T, U>(iter: T) -> Result<Self, ArrowError>
Create an array from an iterable argument of byte slices.
§Examples
use arrow_array::FixedSizeBinaryArray;
let input_arg = vec![
vec![1, 2],
vec![3, 4],
vec![5, 6],
];
let array = FixedSizeBinaryArray::try_from_iter(input_arg.into_iter()).unwrap();
§Errors
Returns error if argument has length zero, or sizes of nested slices don’t match.
fn value_offset_at(&self, i: usize) -> i32
Sourcepub fn iter(&self) -> FixedSizeBinaryIter<'_>
pub fn iter(&self) -> FixedSizeBinaryIter<'_>
constructs a new iterator
Trait Implementations§
Source§impl Array for FixedSizeBinaryArray
impl Array for FixedSizeBinaryArray
Source§fn data_type(&self) -> &DataType
fn data_type(&self) -> &DataType
DataType
] of this array. Read moreSource§fn slice(&self, offset: usize, length: usize) -> ArrayRef
fn slice(&self, offset: usize, length: usize) -> ArrayRef
Source§fn shrink_to_fit(&mut self)
fn shrink_to_fit(&mut self)
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 moreSource§impl<'a> ArrayAccessor for &'a FixedSizeBinaryArray
impl<'a> ArrayAccessor for &'a FixedSizeBinaryArray
Source§impl Clone for FixedSizeBinaryArray
impl Clone for FixedSizeBinaryArray
Source§fn clone(&self) -> FixedSizeBinaryArray
fn clone(&self) -> FixedSizeBinaryArray
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for FixedSizeBinaryArray
impl Debug for FixedSizeBinaryArray
Source§impl From<ArrayData> for FixedSizeBinaryArray
impl From<ArrayData> for FixedSizeBinaryArray
Source§impl From<FixedSizeBinaryArray> for ArrayData
impl From<FixedSizeBinaryArray> for ArrayData
Source§fn from(array: FixedSizeBinaryArray) -> Self
fn from(array: FixedSizeBinaryArray) -> Self
Source§impl From<FixedSizeListArray> for FixedSizeBinaryArray
impl From<FixedSizeListArray> for FixedSizeBinaryArray
Creates a FixedSizeBinaryArray
from FixedSizeList<u8>
array