neilconway opened a new pull request, #25481: URL: https://github.com/apache/datafusion/pull/25481
## Which issue does this PR close? - N/A ## Rationale for this change Code that works with Arrow arrays often neglects to account for slicing: that is, all of the array's backing values might not be visible, so code should generally not iterate over values outside the visible range, or assume that the raw length of the backing array is equivalent to the logical length of the array. To simplify common coding patterns in this area and to encourage correct usage, this PR introduces two helper functions: * `offset_span` returns `(first_offset, value_len)`, the "visible" span described by an `OffsetBuffer` * `offset_span_len` returns `value_len`, the number of values covered by an `OffsetBuffer` This replaces typical boilerplate required to handle sliced arrays. ## What changes are included in this PR? * Introduce two new helper functions * Adopt those helper functions through DataFusion, replacing hand-written offset arithmetic * Simplify or eliminate several helpers that did similar things already (e.g., `estimate_byte_data_size` in `encoding/inner.rs`) * Add unit test ## What is the testing strategy for this PR? Existing tests pass; new unit tests added. ## Are there any 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
