Skip to content

THRIFT-6080: Stop copying a binary field on every call to its byte[] getter - #3966

Open
slachiewicz wants to merge 1 commit into
apache:masterfrom
slachiewicz:THRIFT-6080
Open

slachiewicz wants to merge 1 commit into
apache:masterfrom
slachiewicz:THRIFT-6080

Conversation

@slachiewicz

Copy link
Copy Markdown
Member

The generated byte[] getX() now assigns the right-sized buffer directly instead of going through setX(), whose copyBinary copied the bytes on every call. The method still returns the field's own array, as before. This is the part of THRIFT-6080 that changes no behaviour; union getters, bufferForX() and unsafe_binaries are left for the discussion on the ticket.

Verified: the new TestStruct case fails without the change; gradle test in lib/java → 379 passed.

…getter

Client: java

The generated byte[] getX() right-sized the field and stored it through setX(),
which copies again with copyBinary, so every call copied the bytes although it
returns the field's own array either way. It now assigns the right-sized buffer
directly, as Apache Accumulo already does by patching the generated code.
Union getters and bufferForX() are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mergeable mergeable Bot added java Pull requests that update Java code compiler labels Sep 27, 2026
@slachiewicz
slachiewicz marked this pull request as ready for review September 27, 2026 16:27

This branch has not been deployed

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

Labels

compiler java Pull requests that update Java code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant