This is an automated email from the ASF dual-hosted git repository.

deshanxiao pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/orc.git


The following commit(s) were added to refs/heads/main by this push:
     new 61038ff08 ORC-1614: Use `directOut.put(out)` instead of 
`directOut.put(out.array())` in `TestBrotli` test
61038ff08 is described below

commit 61038ff08ef9d38481c6107fcb21a3da51e602cb
Author: sychen <[email protected]>
AuthorDate: Fri Feb 9 17:28:39 2024 -0800

    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 <[email protected]>
    Signed-off-by: deshanxiao <[email protected]>
---
 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 e5d23ca45..1cc9f8d2e 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 class TestBrotli {
           brotliCodec.getDefaultOptions()));
       out.flip();
       // copy heap buffer to direct buffer.
-      directOut.put(out.array());
+      directOut.put(out);
       directOut.flip();
 
       brotliCodec.decompress(directOut, directResult);

Reply via email to