lirui-apache commented on a change in pull request #11275: 
[FLINK-16359][table-runtime] Introduce WritableVectors for abstract writing
URL: https://github.com/apache/flink/pull/11275#discussion_r386270935
 
 

 ##########
 File path: 
flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/dataformat/vector/heap/HeapIntVector.java
 ##########
 @@ -47,4 +49,45 @@ public int getInt(int i) {
                        return dictionary.decodeToInt(dictionaryIds.vector[i]);
                }
        }
+
+       @Override
+       public void setInt(int i, int value) {
+               if (i >= vector.length) {
+                       throw new RuntimeException();
+               }
+               vector[i] = value;
+       }
+
+       @Override
+       public void setIntsFromBinary(int rowId, int count, byte[] src, int 
srcIndex) {
+               if (LITTLE_ENDIAN) {
+                       UNSAFE.copyMemory(src, BYTE_ARRAY_OFFSET + srcIndex, 
vector,
+                                       INT_ARRAY_OFFSET + rowId * 4L, count * 
4L);
+               } else {
+                       long srcOffset = srcIndex + BYTE_ARRAY_OFFSET;
+                       for (int i = 0; i < count; ++i, srcOffset += 4) {
+                               vector[i + rowId] = 
Integer.reverseBytes(UNSAFE.getInt(src, srcOffset));
+                       }
+               }
+       }
+
+       @Override
+       public void setInts(int rowId, int count, int value) {
+               if (rowId + count - 1 >= vector.length) {
+                       throw new RuntimeException();
 
 Review comment:
   Add a meaningful message, or throw an index-out-of-bound exception?

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to