KurtYoung commented on a change in pull request #7996: 
[FLINK-11871][table-runtime-blink] Introduce LongHybridHashTable to improve 
performance when join key fits in long
URL: https://github.com/apache/flink/pull/7996#discussion_r266840300
 
 

 ##########
 File path: 
flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/util/SegmentsUtil.java
 ##########
 @@ -159,6 +175,47 @@ private static void copyMultiSegmentsToUnsafe(
                }
        }
 
+
+       /**
+        * Copy bytes of segments to output view.
+        * Note: It just copies the data in, not include the length.
+        *
+        * @param segments    source segments
+        * @param offset      offset for segments
+        * @param sizeInBytes size in bytes
+        * @param target      target output view
+        */
+       public static void copyToView(
+                       MemorySegment[] segments,
+                       int offset,
+                       int sizeInBytes,
+                       DataOutputView target) throws IOException {
+               for (MemorySegment sourceSegment : segments) {
+                       int curSegRemain = sourceSegment.size() - offset;
+                       if (curSegRemain > 0) {
+                               int copySize = Math.min(curSegRemain, 
sizeInBytes);
+
+                               byte[] bytes = new byte[copySize];
 
 Review comment:
   i think allocate reuse bytes make sense

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to