pub trait FixedSizeListArrayExt {
// Required methods
fn try_new_from_values<T: Array + 'static>(
values: T,
list_size: i32,
) -> Result<FixedSizeListArray, ArrowError>;
fn sample(&self, n: usize) -> Result<FixedSizeListArray, ArrowError>;
fn convert_to_floating_point(
&self,
) -> Result<FixedSizeListArray, ArrowError>;
}Required Methods§
Sourcefn try_new_from_values<T: Array + 'static>(
values: T,
list_size: i32,
) -> Result<FixedSizeListArray, ArrowError>
fn try_new_from_values<T: Array + 'static>( values: T, list_size: i32, ) -> Result<FixedSizeListArray, ArrowError>
Create an FixedSizeListArray from values and list size.
use arrow_array::{Int64Array, FixedSizeListArray};
use arrow_array::types::Int64Type;
use lance_arrow::FixedSizeListArrayExt;
let int_values = Int64Array::from_iter(0..10);
let fixed_size_list_arr = FixedSizeListArray::try_new_from_values(int_values, 2).unwrap();
assert_eq!(fixed_size_list_arr,
FixedSizeListArray::from_iter_primitive::<Int64Type, _, _>(vec![
Some(vec![Some(0), Some(1)]),
Some(vec![Some(2), Some(3)]),
Some(vec![Some(4), Some(5)]),
Some(vec![Some(6), Some(7)]),
Some(vec![Some(8), Some(9)])
], 2))Sourcefn sample(&self, n: usize) -> Result<FixedSizeListArray, ArrowError>
fn sample(&self, n: usize) -> Result<FixedSizeListArray, ArrowError>
Sample n rows from the FixedSizeListArray
use arrow_array::{Int64Array, FixedSizeListArray, Array};
use lance_arrow::FixedSizeListArrayExt;
let int_values = Int64Array::from_iter(0..256);
let fixed_size_list_arr = FixedSizeListArray::try_new_from_values(int_values, 16).unwrap();
let sampled = fixed_size_list_arr.sample(10).unwrap();
assert_eq!(sampled.len(), 10);
assert_eq!(sampled.value_length(), 16);
assert_eq!(sampled.values().len(), 160);Sourcefn convert_to_floating_point(&self) -> Result<FixedSizeListArray, ArrowError>
fn convert_to_floating_point(&self) -> Result<FixedSizeListArray, ArrowError>
Ensure the FixedSizeListArray of Float16, Float32, Float64, Int8, Int16, Int32, Int64, UInt8, UInt32 type to its closest floating point type.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.