Repository navigation
docs: document RunArray logical offset/len and child array slicing - #11710
Conversation
Co-Authored-By: Claude Fable 5.1 <[email protected]>
| /// ├─────────────────┤ | ||
| /// RunArray │ B │ run length of 'B' = run_ends[2] - run_ends[1] = 3 | ||
| /// length = 3 └─────────────────┘ | ||
| /// offset = 0, len = 6 └─────────────────┘ |
| /// | ||
| /// ```text | ||
| /// ┌ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─┐ | ||
| /// ┌─────────────────┐ ┌─────────┐ ┌ ─ ─ ─ ─ ─ ─ ─ ─ ┐ |
There was a problem hiding this comment.
I really wanted this PR when reviewing #11668 (review)
| /// | ||
| /// The values in `run_ends` represent indexes of the *unsliced* logical array. | ||
| /// This allows zero-copy [`RunArray::slice`]: `run_ends` and `values` are left | ||
| /// untouched and only `offset` and `len` are adjusted. |
There was a problem hiding this comment.
side note, actually had an idea where we did actually slice them:
though havent had time to explore this further
Co-Authored-By: Claude Fable 5.1 <[email protected]>
mbutrovich
left a comment
There was a problem hiding this comment.
Thanks for writing this up @alamb! Since the bug originated from my attempts with PBT, I'm happy to see more invariants spelled out.
| /// * every run end is greater than zero and `run_ends` is strictly increasing | ||
| /// * `run_ends` has no null values | ||
| /// * `run_ends` and `values` have the same length | ||
| /// * if `len > 0`, the last run end is greater than or equal to `offset + len`. |
There was a problem hiding this comment.
if
len > 0, the last run end is greater than or equal tooffset + len.
Is the len > 0 condition intended? The REE layout does not mention a parent offset, so as I read it the spec is silent. C++ requires the last run end to cover offset + length when the run ends are non-empty, even for length == 0. With run ends [1], offset = 2 and len = 0, validate_full accepts the array on main and, as I read the C++ code, C++ rejects it.
| /// Panics if the [`RunArray` invariants] are not satisfied: | ||
| /// | ||
| /// - `run_ends` does not contain strictly increasing values greater than zero | ||
| /// - The last value of `run_ends` is less than `logical_offset + logical_length` |
There was a problem hiding this comment.
- The last value of
run_endsis less thanlogical_offset + logical_length
Should this item say "when logical_length is not 0"? The code only asserts it under if logical_length != 0, and the new # offset and len section on RunArray already says len > 0.
|
merging up to fix CI |
|
Thank you -- sorry for the delay, I have addressed @mbutrovich 's comments now |
Which issue does this PR close?
ArrayDatavalidation does not check that run ends coveroffset + len#11587 and fix: use correct length in runarray validation #11668Rationale for this change
While reviewing #11668 I was unclear about the relationship between a
RunArray's logicaloffset/lenand the contents of itsrun_endschild as it was not documented anywhere onRunArrayitselfWhat changes are included in this PR?
Documentation only, on
pub struct RunArray:Are these changes tested?
Yes, by CI
Are there any significant user-facing changes?
Only docs