-
Notifications
You must be signed in to change notification settings - Fork 486
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ORC-1613: Zstd decompression supports direct buffer #1789
Conversation
@@ -214,6 +214,11 @@ public boolean compress(ByteBuffer in, ByteBuffer out, | |||
|
|||
@Override | |||
public void decompress(ByteBuffer in, ByteBuffer out) throws IOException { | |||
if (in.isDirect() && out.isDirect()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a question. When is this used in Apache ORC code base?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we use zerocopy orc.use.zerocopy=true
, we may use the direct buffer, which can fallback to the original way of reading if the codec doesn't implement DirectDecompressionCodec
.
orc/java/core/src/java/org/apache/orc/impl/RecordReaderUtils.java
Lines 600 to 607 in 4eff23a
static HadoopShims.ZeroCopyReaderShim createZeroCopyShim(FSDataInputStream file, | |
CompressionCodec codec, ByteBufferAllocatorPool pool) throws IOException { | |
if ((codec == null || ((codec instanceof DirectDecompressionCodec) && | |
((DirectDecompressionCodec) codec).isAvailable()))) { | |
/* codec is null or is available */ | |
return SHIMS.getZeroCopyReader(file, pool); | |
} | |
return null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1, LGTM (with one question).
### What changes were proposed in this pull request? `ZstdCodec` implements the `DirectDecompressionCodec` interface. ### Why are the changes needed? `zstd-jni` supports direct buffer decompression, which can reduce Buffer copying. ### How was this patch tested? add UT ### Was this patch authored or co-authored using generative AI tooling? No Closes #1789 from cxzl25/ORC-1613. Authored-by: sychen <sychen@ctrip.com> Signed-off-by: Dongjoon Hyun <dongjoon@apache.org> (cherry picked from commit 25beaa2) Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
Merged to main/2.0. Thank you, @cxzl25 . |
What changes were proposed in this pull request?
ZstdCodec
implements theDirectDecompressionCodec
interface.Why are the changes needed?
zstd-jni
supports direct buffer decompression, which can reduce Buffer copying.How was this patch tested?
add UT
Was this patch authored or co-authored using generative AI tooling?
No