Jefffrey commented on code in PR #7007: URL: https://github.com/apache/arrow-rs/pull/7007#discussion_r1925886055
########## arrow-array/src/array/list_view_array.rs: ########## @@ -32,16 +32,55 @@ pub type ListViewArray = GenericListViewArray<i32>; /// A [`GenericListViewArray`] of variable size lists, storing offsets as `i64`. pub type LargeListViewArray = GenericListViewArray<i64>; +/// An array of [variable length lists], specifically in the [list-view layout]. /// -/// Different from [`crate::GenericListArray`] as it stores both an offset and length -/// meaning that take / filter operations can be implemented without copying the underlying data. +/// Differs from [`GenericListArray`] (which represents the [list layout]) in that +/// the sizes of the child arrays are explicitly encoded in a separate buffer, instead +/// of being derived from the difference between subsequent offsets in the offset buffer. /// -/// [Variable-size List Layout: ListView Layout]: https://arrow.apache.org/docs/format/Columnar.html#listview-layout +/// This allows the offsets (and subsequently child data) to be out of order. It also +/// allows take / filter operations to be implemented without copying the underlying data. +/// +/// # Representation +/// +/// Given the same example array from [`GenericListArray`], it would be represented +/// as such via a list-view layout array: +/// +/// ```text +/// ┌ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ +/// ┌ ─ ─ ─ ─ ─ ─ ┐ │ +/// ┌─────────────┐ ┌───────┐ │ ┌───┐ ┌───┐ ┌───┐ ┌───┐ ┌───┐ +/// │ [A,B,C] │ │ (0,3) │ │ 1 │ │ 0 │ │ 3 │ │ │ 1 │ │ A │ │ 0 │ +/// ├─────────────┤ ├───────┤ │ ├───┤ ├───┤ ├───┤ ├───┤ ├───┤ +/// │ [] │ │ (3,0) │ │ 1 │ │ 3 │ │ 0 │ │ │ 1 │ │ B │ │ 1 │ +/// ├─────────────┤ ├───────┤ │ ├───┤ ├───┤ ├───┤ ├───┤ ├───┤ +/// │ NULL │ │ (?,?) │ │ 0 │ │ ? │ │ ? │ │ │ 1 │ │ C │ │ 2 │ +/// ├─────────────┤ ├───────┤ │ ├───┤ ├───┤ ├───┤ ├───┤ ├───┤ +/// │ [D] │ │ (4,1) │ │ 1 │ │ 4 │ │ 1 │ │ │ ? │ │ ? │ │ 3 │ Review Comment: I've added another example which shows this in use :+1: -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
