You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "zeroshade (via GitHub)" <gi...@apache.org> on 2023/11/13 21:11:49 UTC

Re: [I] [Go] ValueOffset of array.Binary panics on last index [arrow]

zeroshade commented on issue #38458:
URL: https://github.com/apache/arrow/issues/38458#issuecomment-1809129687

   Sorry for the delay here, I've been at a conference all last week, and an off-site for the week before that.
   
   > Just to note here, using `ValueLen` directly on the array.Binary also panics on the last row index, it also checks for >= on data slice.
   
   This doesn't quite make sense to me. `ValueLen` *should* use `>=` just like `Value` does, because the indices are 0-based. `ValueLen` as it currently is implemented will correctly return the length for the last element in a binary column, and this is verified in the unit tests in `binary_test.go` via `TestBinaryValueLen`. You should never be calling `ValueLen(col.Len())` because it's 0-based, you would call `ValueLen(col.Len()-1)` to get the length of the last element, which would pass the check for `>= a.data.length`.
   
   Am I missing something? Can you provide some sample code that calls `ValueLen` and panics on the last row index that I could test?
   
   Otherwise, I'm gonna put together a PR to add `ValueLen` to the interface


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org