From 2ba4987ba0a6d69905ae3c31daa344faa7040fbe Mon Sep 17 00:00:00 2001 From: sychen Date: Fri, 9 Feb 2024 17:28:39 -0800 Subject: [PATCH] ORC-1614: Use `directOut.put(out)` instead of `directOut.put(out.array())` in `TestBrotli` test ### What changes were proposed in this pull request? Set ByteBuffer limit in `TestBrotli` test ### Why are the changes needed? `TestBrotli#testDirectDecompress` attempts to put the compressed result in direct ByteBuffer. When calling `decompress`, we will find that the input buffer length is still `10000` not `217` since we put the array without `limit` on the length. ```java directOut.put(out.array()); directOut.flip(); ``` This PR is aimed to use `directOut.put(out)` instead of `directOut.put(out.array())` ### How was this patch tested? GA ### Was this patch authored or co-authored using generative AI tooling? No Closes #1790 from cxzl25/ORC-1614. Authored-by: sychen Signed-off-by: deshanxiao --- java/core/src/test/org/apache/orc/impl/TestBrotli.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java/core/src/test/org/apache/orc/impl/TestBrotli.java b/java/core/src/test/org/apache/orc/impl/TestBrotli.java index e5d23ca452..1cc9f8d2ee 100644 --- a/java/core/src/test/org/apache/orc/impl/TestBrotli.java +++ b/java/core/src/test/org/apache/orc/impl/TestBrotli.java @@ -138,7 +138,7 @@ public void testDirectDecompress() { brotliCodec.getDefaultOptions())); out.flip(); // copy heap buffer to direct buffer. - directOut.put(out.array()); + directOut.put(out); directOut.flip(); brotliCodec.decompress(directOut, directResult);