Skip to content

[Go] *array.Binary.ValueOffset doesn't work correctly #41

@Korzhenevskyi

Description

@Korzhenevskyi

Describe the bug, including details regarding any error messages, version, and platform.

https://github.com/apache/arrow/blob/main/go/arrow/array/binary.go#L76 -- this place is incorrect. For example, valueOffsets contain 6 offsets for the array with 5 elements, but calling array.ValueOffset(5) will cause the panic although the element exists.

It must be

func (a *Binary) ValueOffset(i int) int {
	if i < 0 || i > a.array.data.length {
		panic("arrow/array: index out of range")
	}
	return int(a.valueOffsets[a.array.data.offset+i])
}

similar to strings https://github.com/apache/arrow/blob/main/go/arrow/array/string.go#L66.

Component(s)

Go

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions