You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2022/10/24 04:24:34 UTC

[GitHub] [flink] luoyuxia commented on a diff in pull request #20830: [FLINK-29271]Change to byte array from bytebuffer to improve performance and compatible direct byte buffers

luoyuxia commented on code in PR #20830:
URL: https://github.com/apache/flink/pull/20830#discussion_r1002872635


##########
flink-formats/flink-parquet/src/main/java/org/apache/flink/formats/parquet/vector/reader/RunLengthDecoder.java:
##########
@@ -265,8 +265,16 @@ void readNextGroup() {
                     while (valueIndex < this.currentCount) {
                         // values are bit packed 8 at a time, so reading bitWidth will always work
                         ByteBuffer buffer = in.slice(bitWidth);
-                        this.packer.unpack8Values(
-                                buffer, buffer.position(), this.currentBuffer, valueIndex);
+                        if (buffer.hasArray()) {
+                            this.packer.unpack8Values(

Review Comment:
   I'm wondering why this changes will improve perfermance. IIUC, from the code
   ```java
   public void unpack8Values(final byte[] input, final int inPos, final int[] output, final int outPos) {
       unpack8Values(ByteBuffer.wrap(input), inPos, output, outPos);
     }
   ```
    the method just delegates to `unpack8Values` and it needs extra `ByteBuffer.wrap(input)`.
   Could you please explain a little bit?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org