Struct Rows
pub struct Rows {
pub(crate) buffer: Vec<u8>,
pub(crate) offsets: Vec<usize>,
pub(crate) config: RowConfig,
}Expand description
A row-oriented representation of arrow data, that is normalized for comparison.
See the module level documentation and RowConverter for more details.
Fields§
§buffer: Vec<u8>§offsets: Vec<usize>§config: RowConfigImplementations§
§impl Rows
impl Rows
pub unsafe fn row_unchecked(&self, index: usize) -> Row<'_>
pub unsafe fn row_unchecked(&self, index: usize) -> Row<'_>
Returns the row at index without bounds checking
§Safety
Caller must ensure that index is less than the number of offsets (#rows + 1)
pub fn try_into_binary(
self,
) -> Result<GenericByteArray<GenericBinaryType<i32>>, ArrowError>
pub fn try_into_binary( self, ) -> Result<GenericByteArray<GenericBinaryType<i32>>, ArrowError>
Create a BinaryArray from the Rows data without reallocating the underlying bytes.
let converter = RowConverter::new(vec![SortField::new(DataType::Utf8)]).unwrap();
let array = StringArray::from(vec!["hello", "world", "a", "a", "hello"]);
let rows = converter.convert_columns(&[Arc::new(array)]).unwrap();
// We can convert rows into binary format and back.
let values: Vec<OwnedRow> = rows.iter().map(|r| r.owned()).collect();
let binary = rows.try_into_binary().expect("known-small array");
let parser = converter.parser();
let parsed: Vec<OwnedRow> =
binary.iter().flatten().map(|b| parser.parse(b).owned()).collect();
assert_eq!(values, parsed);§Errors
This function will return an error if there is more data than can be stored in a BinaryArray – i.e. if the total data size is more than 2GiB.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Rows
impl RefUnwindSafe for Rows
impl Send for Rows
impl Sync for Rows
impl Unpin for Rows
impl UnwindSafe for Rows
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more