Skip to content

Commit

Permalink
ORC-1614: Use directOut.put(out) instead of `directOut.put(out.arra…
Browse files Browse the repository at this point in the history
…y())` 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 <sychen@ctrip.com>
Signed-off-by: deshanxiao <deshanxiao@microsoft.com>
  • Loading branch information
cxzl25 authored and deshanxiao committed Feb 10, 2024
1 parent 0409fd6 commit 2ba4987
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion java/core/src/test/org/apache/orc/impl/TestBrotli.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 2ba4987

Please sign in to comment.