alamb opened a new pull request, #11710: URL: https://github.com/apache/arrow-rs/pull/11710
# Which issue does this PR close? - Related to #11587 and #11668 # Rationale for this change While reviewing #11668 it became clear that the relationship between a `RunArray`'s logical `offset` / `len` and the contents of its `run_ends` child is not documented anywhere on `RunArray` itself. In particular: - `Array::len` / `Array::offset` refer to the *logical* array, not to the number of runs - run ends are indexes into the *unsliced* logical array and are not rewritten when the array is sliced - the last run end must be `>= offset + len` (when `len > 0`), which is the invariant #11668 fixes the validation of - whether the `run_ends` and `values` children may themselves be sliced # What changes are included in this PR? Documentation only, on `pub struct RunArray`: - Fix the existing diagram's label (`length = 3` was the physical length; it now says `offset = 0, len = 6`) and a `runs_ends` typo - New "Logical `offset` and `len`" section explaining the invariants, with a second diagram showing the same array after `slice(1, 3)` and which logical indexes are visible - New "Slicing of the child arrays" section: `values` may carry an offset, while the `run_ends` child is treated as unsliced (its `ArrayData` offset is ignored by `From<ArrayData> for RunArray`; `try_new` takes `PrimitiveArray::values`, which already accounts for slicing) # Are these changes tested? Docs only. Verified with `cargo doc -p arrow-array --no-deps --all-features` with `-D warnings` and `typos`. # Are there any significant user-facing changes? No -- 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]
