You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@orc.apache.org by de...@apache.org on 2024/02/20 01:24:18 UTC

(orc) branch main updated: ORC-1623: Use `directOut.put(out)` instead of `directOut.put(out.array())` in `TestZstd` test

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 fb1c4cb94 ORC-1623: Use `directOut.put(out)` instead of `directOut.put(out.array())` in `TestZstd` test
fb1c4cb94 is described below

commit fb1c4cb9461d207db652fc253396e57640ed805b
Author: sychen <sy...@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 <sy...@ctrip.com>
    Signed-off-by: deshanxiao <de...@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);