GH-939: Remove reflection for gRPC buffers by xborder · Pull Request #954 · apache/arrow-java (original) (raw)

@xborder

What's Changed

Closes #939.

@github-actions

This comment has been minimized.

@xborder xborder changed the titleGH-939: Remove relection GH-939: Remove reflection for gRPC buffers

Jan 11, 2026

@xborder xborder marked this pull request as ready for review

January 11, 2026 15:02

lidavidm

Comment on lines +463 to +466

| if (detachedByteBuffer == null || !detachedByteBuffer.isDirect()) { | | -------------------------------------------------------------------- | | closeQuietly(detachedStream); | | return null; | | } |

Choose a reason for hiding this comment

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

Since we detached the stream, if we give up here, aren't we erroneously going to discard the actual data? My understanding of Detachable is that the original stream is now invalid, right?

Choose a reason for hiding this comment

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

good catch. Actually this is redundant, the isDirect is already checked at the beginning of the method so I just removed it

lidavidm

Choose a reason for hiding this comment

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

All builds fail:

Error:  Non-test scoped test only dependencies found:
Error:     io.grpc:grpc-core:jar:1.78.0:compile

lidavidm

Choose a reason for hiding this comment

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

Approved CI

@lidavidm

CC @ejona86 in case you do want to look over this

@lidavidm

@xborder it seems this doesn't actually work...

@xborder

@lidavidm Seems like a chicken and the egg problem. grpc-core can't be a compile dependency because it is detected as unused by CI although it is still required in runtime (AddWritableBuffer still needs it for reflection).
Marking it with a runtime scope causes the tests I created to fail because they require the dependency in compile time.

I've changed the tests to use a mock for the dependency it had on grpc-core. This seemed to have solved the issues from the two previous runs but probably diminishes the relevance of these tests

@jbonofre

@xborder thanks for the update. Let me take a look.

@xborder

@lidavidm I think there's something I overlooked. frame() is iterating over the stream, if I detach it when reading APP_METADATA_TAG it invalidates the same stream it is iterating. Let me rework on this and I'll keep you posted

jbonofre

@xborder

@jbonofre I tried to reproduce this on a Windows 11 VM and couldn't. Could this be a flaky test?

@xborder

@xborder

@xborder

@xborder

@xborder

Scope detached FlightData buffers to a message-local allocator and retain them into downstream allocators as messages are consumed

@xborder

laurentgo

@xborder

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})