ViggoC commented on code in PR #884:
URL: https://github.com/apache/arrow-java/pull/884#discussion_r2465601509


##########
vector/src/main/java/org/apache/arrow/vector/util/VectorAppender.java:
##########
@@ -698,4 +703,70 @@ public ValueVector visit(ExtensionTypeVector<?> 
deltaVector, Void value) {
     deltaVector.getUnderlyingVector().accept(underlyingAppender, null);
     return targetVector;
   }
+
+  @Override
+  public ValueVector visit(RunEndEncodedVector deltaVector, Void value) {
+    Preconditions.checkArgument(
+        typeVisitor.equals(deltaVector),
+        "The vector to append must have the same type as the targetVector 
being appended");
+
+    if (deltaVector.getValueCount() == 0) {
+      return targetVector; // optimization, nothing to append, return
+    }
+
+    RunEndEncodedVector targetEncodedVector = (RunEndEncodedVector) 
targetVector;
+
+    final int targetLogicalValueCount = targetEncodedVector.getValueCount();
+
+    // Append the values vector first.
+    VectorAppender valueAppender = new 
VectorAppender(targetEncodedVector.getValuesVector());
+    deltaVector.getValuesVector().accept(valueAppender, null);
+
+    // Then append the run-ends vector.
+    BaseIntVector targetRunEndsVector = (BaseIntVector) 
targetEncodedVector.getRunEndsVector();
+    BaseIntVector deltaRunEndsVector = (BaseIntVector) 
deltaVector.getRunEndsVector();
+
+    // Shift the delta run-ends vector in-place before appending.
+    shiftRunEndsVector(
+        deltaRunEndsVector,
+        deltaRunEndsVector.getDataBuffer(),
+        targetLogicalValueCount,
+        deltaRunEndsVector.getValueCount());

Review Comment:
   ok,i'll do the copy and shift like BaseVariableWidthVector



-- 
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