vibhatha commented on code in PR #40985:
URL: https://github.com/apache/arrow/pull/40985#discussion_r1550632245
##########
java/vector/src/test/java/org/apache/arrow/vector/TestDenseUnionVector.java:
##########
@@ -99,6 +99,44 @@ public void testDenseUnionVector() throws Exception {
}
}
+ @Test
+ public void testSetOffset() {
+ try (DenseUnionVector duv = DenseUnionVector.empty("foo", allocator)) {
+ duv.allocateNew();
+ byte i32TypeId = duv.registerNewTypeId(Field.notNullable("i32",
MinorType.INT.getType()));
+ byte f64TypeId = duv.registerNewTypeId(Field.notNullable("f64",
MinorType.FLOAT8.getType()));
+
+ IntVector i32Vector = ((IntVector) duv.addVector(i32TypeId, new
IntVector("i32", allocator)));
Review Comment:
Should we use try-with-resources?
##########
java/vector/src/main/codegen/templates/DenseUnionVector.java:
##########
@@ -908,6 +908,14 @@ private int getTypeBufferValueCapacity() {
return (int) typeBuffer.capacity() / TYPE_WIDTH;
}
+ public void setOffset(int index, int offset) {
+ while (index >= getOffsetBufferValueCapacity()) {
Review Comment:
just curious: when to reallocate?
--
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]