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

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


The following commit(s) were added to refs/heads/branch-2.0 by this push:
     new 72d21650b ORC-1623: Use `directOut.put(out)` instead of 
`directOut.put(out.array())` in `TestZstd` test
72d21650b is described below

commit 72d21650be10582c755c34298472037810575e53
Author: sychen <syc...@ctrip.com>
AuthorDate: Mon Feb 19 17:23:58 2024 -0800

    ORC-1623: Use `directOut.put(out)` instead of `directOut.put(out.array())` 
in `TestZstd` test
    
    ### What changes were proposed in this pull request?
    This PR aims to use `directOut.put(out)` instead of 
`directOut.put(out.array())` in `TestZstd` test.
    
    ### Why are the changes needed?
    Improve the readability of test code.
    
    ### How was this patch tested?
    GA
    
    ### Was this patch authored or co-authored using generative AI tooling?
    No
    
    Closes #1806 from cxzl25/ORC-1623.
    
    Authored-by: sychen <syc...@ctrip.com>
    Signed-off-by: deshanxiao <deshanx...@microsoft.com>
    (cherry picked from commit fb1c4cb9461d207db652fc253396e57640ed805b)
    Signed-off-by: deshanxiao <deshanx...@microsoft.com>
---
 java/core/src/test/org/apache/orc/impl/TestZstd.java | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/java/core/src/test/org/apache/orc/impl/TestZstd.java 
b/java/core/src/test/org/apache/orc/impl/TestZstd.java
index dfa310a40..a7301a826 100644
--- a/java/core/src/test/org/apache/orc/impl/TestZstd.java
+++ b/java/core/src/test/org/apache/orc/impl/TestZstd.java
@@ -136,12 +136,10 @@ public class TestZstd {
       // write bytes to heap buffer.
       assertTrue(zstdCodec.compress(in, out, null,
               zstdCodec.getDefaultOptions()));
-      int position = out.position();
       out.flip();
       // copy heap buffer to direct buffer.
-      directOut.put(out.array());
+      directOut.put(out);
       directOut.flip();
-      directOut.limit(position);
 
       zstdCodec.decompress(directOut, directResult);
 

Reply via email to