Skip to content

fix(arrow/scalar): use wide offsets for large binary scalars - #1108

Open
fallintoplace wants to merge 3 commits into
apache:mainfrom
fallintoplace:fix/scalar-large-offsets
Open

fix(arrow/scalar): use wide offsets for large binary scalars#1108
fallintoplace wants to merge 3 commits into
apache:mainfrom
fallintoplace:fix/scalar-large-offsets

Conversation

@fallintoplace

@fallintoplace fallintoplace commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Rationale for this change

MakeArrayFromScalar currently uses 32-bit offsets for every binary-like scalar. LargeBinary and LargeString require 64-bit offsets, so their arrays can have the wrong physical layout.

What changes are included in this PR?

Select the offset width from the scalar type and test ordinary and large binary values, including validation and buffer size.

Are these changes tested?

  • go test ./arrow/scalar

Are there any user-facing changes?

No API changes. This corrects the reported behavior while preserving the existing ownership and compatibility contracts.

@fallintoplace fallintoplace changed the title fix(arrow/scalar): use 64-bit offsets for large binary arrays fix(arrow/scalar): use wide offsets for large binary scalars Aug 5, 2026
Comment thread arrow/scalar/scalar.go Outdated
createOffsets := func(valLength int64) *memory.Buffer {
buffer := memory.NewResizableBuffer(mem)
buffer.Resize(arrow.Int32Traits.BytesRequired(length + 1))
if sc.DataType().ID() == arrow.LARGE_BINARY || sc.DataType().ID() == arrow.LARGE_STRING {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we also need to check for LARGE_LIST?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants