[#2646] feat(netty): Support converting CompositeByteBuf to a direct nio buffer#2732
Draft
wForget wants to merge 1 commit intoapache:masterfrom
Draft
[#2646] feat(netty): Support converting CompositeByteBuf to a direct nio buffer#2732wForget wants to merge 1 commit intoapache:masterfrom
wForget wants to merge 1 commit intoapache:masterfrom
Conversation
a79336f to
cf88297
Compare
wForget
commented
Feb 25, 2026
| if (buf instanceof CompositeByteBuf && buf.isDirect() && buf.nioBufferCount() > 1 | ||
| && NettyUtils.preferDirectForCompositeBuffer()) { | ||
| int length = buf.readableBytes(); | ||
| ByteBuffer merged = ByteBuffer.allocateDirect(length).order(buf.order()); |
Member
Author
There was a problem hiding this comment.
Although this still involves one data copy, it is an improvement for gluten scenarios.
- Before, there were two data copies: Netty direct buffer → NIO heap buffer → Gluten native side.
- After, there is only one data copy: Netty direct buffer → NIO direct buffer → Gluten native side (no copy).
cf88297 to
6b7587f
Compare
6b7587f to
c8e30e3
Compare
Member
Author
|
cc @zuston |
zuston
reviewed
Feb 28, 2026
Member
zuston
left a comment
There was a problem hiding this comment.
It looks OK for me, but I hope the related options could be scoped into the RssClientConf.java
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
Support converting CompositeByteBuf to a direct nio buffer
Why are the changes needed?
CompositeByteBuf.nioBuffer will return a heap buffer if the composite buffer has more than one component, even if all components are direct buffers. In native client scenarios (like gluten), we prefer to use direct buffer to reduce data copying.
closes #2646
Does this PR introduce any user-facing change?
yes, a new configuration
How was this patch tested?
Tested it locally, after adding the following configuration, the gluten shuffle reader will use LowCopyNettyJniByteInputStream.