pub struct Rows { /* private fields */ }
Expand description
A row-oriented representation of arrow data, that is normalized for comparison.
See the module level documentation and RowConverter
for more details.
Implementations§
Source§impl Rows
impl Rows
Sourcepub 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)
Sourcepub fn size(&self) -> usize
pub fn size(&self) -> usize
Returns the size of this instance in bytes
Includes the size of Self
.
Sourcepub fn try_into_binary(self) -> Result<BinaryArray, ArrowError>
pub fn try_into_binary(self) -> Result<BinaryArray, 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