qzyu999 opened a new issue, #842:
URL: https://github.com/apache/arrow-go/issues/842

   ### Describe the bug
   
   The `ObjectValue.ValueByKey` function in `parquet/variant/variant.go` 
implements a custom binary search on the `v.value` array of field IDs. It 
initializes the search bounds using `i, j := 0, n` (an exclusive upper bound).
   However, when the target key is smaller than the key at `mid`, it updates 
`j` to `mid - 1`:
   
   ```go
   case 1:
       j = mid - 1
   ```
   
   Because `j` is an exclusive upper bound (the search space is `[i, j)`), 
setting `j = mid - 1` excludes the element at index `mid - 1` from the search 
space entirely. If the target key is located at `mid - 1`, the lookup will fail 
and return `arrow.ErrNotFound`.
   
   This issue occurs for objects containing >= 32 elements, where the binary 
search is active.
   


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