alamb commented on code in PR #7039:
URL: https://github.com/apache/arrow-rs/pull/7039#discussion_r1932472166
##########
arrow-array/src/array/list_array.rs:
##########
@@ -120,8 +120,41 @@ impl OffsetSizeTrait for i64 {
/// (offsets[i], │ ListArray (Array)
/// offsets[i+1]) └ ─ ─ ─ ─
─ ─ ┘ │
/// └ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─
─ ─ ─ ─ ─
+/// ```
+///
+/// # Slicing
+///
+/// Slicing a `ListArray` creates a new `ListArray` without copying any data,
+/// but this means the Values and Offsets may have "unused" data
///
+/// For exmaple, calling `slice(1, 3)` on the `ListArray` in the above example
+/// would result in the following. Note
///
+/// 1. `Values` array is unchanged
+/// 2. `Offsets` do not start at `0` nor cover all values in the Values array.
+///
+/// ```text
+/// ┌ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─
+/// ┌ ─ ─ ─ ─ ─ ─ ┐
│
+/// │ ╔═══╗ ╔═══╗
+/// │ ║ 1 ║ ║ A ║ │ 0
│
+/// ┌─────────────┐ ┌───────┐ │ ┌───┐ ╔═══╗ ╠═══╣ ╠═══╣
+/// │ [] (empty) │ │ (3,3) │ │ 1 │ ║ 3 ║ │ ║ 1 ║ ║ B ║ │ 1
│
Review Comment:
I will update
--
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]