vibhatha commented on code in PR #44241:
URL: https://github.com/apache/arrow/pull/44241#discussion_r1800304703


##########
java/vector/src/main/java/org/apache/arrow/vector/complex/RunEndEncodedVector.java:
##########
@@ -312,8 +302,142 @@ public TransferPair getTransferPair(Field field, 
BufferAllocator allocator, Call
    */
   @Override
   public TransferPair makeTransferPair(ValueVector target) {
-    throw new UnsupportedOperationException(
-        "RunEndEncodedVector does not support makeTransferPair(ValueVector)");
+    return new TransferImpl((RunEndEncodedVector) target);
+  }
+
+  private class TransferImpl implements TransferPair {
+
+    RunEndEncodedVector to;
+    TransferPair dataTransferPair;
+    TransferPair reeTransferPair;
+
+    public TransferImpl(String name, BufferAllocator allocator, CallBack 
callBack) {
+      this(new RunEndEncodedVector(name, allocator, field.getFieldType(), 
callBack));
+    }
+
+    public TransferImpl(Field field, BufferAllocator allocator, CallBack 
callBack) {
+      this(new RunEndEncodedVector(field, allocator, callBack));
+    }
+
+    public TransferImpl(RunEndEncodedVector to) {
+      this.to = to;
+      if (to.getRunEndsVector() instanceof ZeroVector) {
+        to.initializeChildrenFromFields(field.getChildren());
+      }
+      reeTransferPair = 
getRunEndsVector().makeTransferPair(to.getRunEndsVector());
+      dataTransferPair = 
getValuesVector().makeTransferPair(to.getValuesVector());
+    }
+
+    /**
+     * Transfer this vector'data to another vector. The memory associated with 
this vector is
+     * transferred to the allocator of target vector for accounting and 
management purposes.
+     */
+    @Override
+    public void transfer() {
+      to.clear();
+      dataTransferPair.transfer();
+      reeTransferPair.transfer();
+      if (valueCount > 0) {
+        to.setValueCount(valueCount);
+      }
+      clear();
+    }
+
+    /**
+     * Slice this vector at desired index and length and transfer the 
corresponding data to the

Review Comment:
   ```suggestion
        * Slice this vector at the desired index and length, then transfer the 
corresponding data to the
   ```



##########
java/vector/src/main/java/org/apache/arrow/vector/complex/RunEndEncodedVector.java:
##########
@@ -312,8 +302,142 @@ public TransferPair getTransferPair(Field field, 
BufferAllocator allocator, Call
    */
   @Override
   public TransferPair makeTransferPair(ValueVector target) {
-    throw new UnsupportedOperationException(
-        "RunEndEncodedVector does not support makeTransferPair(ValueVector)");
+    return new TransferImpl((RunEndEncodedVector) target);
+  }
+
+  private class TransferImpl implements TransferPair {
+
+    RunEndEncodedVector to;
+    TransferPair dataTransferPair;
+    TransferPair reeTransferPair;
+
+    public TransferImpl(String name, BufferAllocator allocator, CallBack 
callBack) {
+      this(new RunEndEncodedVector(name, allocator, field.getFieldType(), 
callBack));
+    }
+
+    public TransferImpl(Field field, BufferAllocator allocator, CallBack 
callBack) {
+      this(new RunEndEncodedVector(field, allocator, callBack));
+    }
+
+    public TransferImpl(RunEndEncodedVector to) {
+      this.to = to;
+      if (to.getRunEndsVector() instanceof ZeroVector) {
+        to.initializeChildrenFromFields(field.getChildren());
+      }
+      reeTransferPair = 
getRunEndsVector().makeTransferPair(to.getRunEndsVector());
+      dataTransferPair = 
getValuesVector().makeTransferPair(to.getValuesVector());
+    }
+
+    /**
+     * Transfer this vector'data to another vector. The memory associated with 
this vector is
+     * transferred to the allocator of target vector for accounting and 
management purposes.
+     */
+    @Override
+    public void transfer() {
+      to.clear();
+      dataTransferPair.transfer();
+      reeTransferPair.transfer();
+      if (valueCount > 0) {
+        to.setValueCount(valueCount);
+      }
+      clear();
+    }
+
+    /**
+     * Slice this vector at desired index and length and transfer the 
corresponding data to the

Review Comment:
   nit: 
   
   ```suggestion
        * Slice this vector at the desired index and length, then transfer the 
corresponding data to the
   ```



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to