UtkarshSahay123 commented on PR #9015:
URL: https://github.com/apache/arrow-rs/pull/9015#issuecomment-3669214607

   Thanks for the clarification — that helps.
   
   You’re absolutely right that slicing a (Large)StringArray does not change
   the
   underlying data buffer, and that the stored offsets remain relative to that
   buffer.
   
   The concern here is not that slicing mutates offsets, but that substring
   operates on value-relative ranges derived from the offset pairs, while the
   existing UTF-8 boundary validation reasons about the full buffer. This means
   the validation is effectively checking a stronger condition than required:
   that the offset is a UTF-8 boundary in the entire buffer, rather than within
   the value’s byte range.
   
   Conceptually, substring only needs to ensure that the computed offset is a
   valid UTF-8 boundary relative to the value slice `[offsets[i],
   offsets[i+1])`.
   Validating against the full buffer can reject offsets that are value-aligned
   but not globally meaningful outside that range.
   
   That said, I agree that this distinction is subtle, and without a concrete
   example where the current implementation produces incorrect results, the
   change may not be justified. I will try to construct a minimal reproducer or
   add a targeted test demonstrating this behavior. If I’m unable to do so, I’m
   happy to drop or revise the change.
   
   Thanks again for taking the time to review this — I appreciate the guidance.
   
   Utkarsh Sahay
   
   On Thu, 18 Dec 2025, 1:53 pm Martin Hilton, ***@***.***>
   wrote:
   
   > ***@***.**** commented on this pull request.
   >
   > I don't understand why this change is necessary. Slicing a
   > (Large)StringArray doesn't change the data buffer, so the offsets into
   > the data buffer also do not change. Do you have an example of a StringArray
   > where the existing code produces incorrect results?
   >
   > —
   > Reply to this email directly, view it on GitHub
   > 
<https://github.com/apache/arrow-rs/pull/9015#pullrequestreview-3591379860>,
   > or unsubscribe
   > 
<https://github.com/notifications/unsubscribe-auth/AYHU2BMNJILFA3HEP4Q7QTD4CJP7PAVCNFSM6AAAAACPMSF64KVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZTKOJRGM3TSOBWGA>
   > .
   > You are receiving this because you authored the thread.Message ID:
   > ***@***.***>
   >
   


-- 
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]

Reply via email to