pitrou commented on code in PR #40043:
URL: https://github.com/apache/arrow/pull/40043#discussion_r1486509813
##########
java/flight/flight-core/src/test/java/org/apache/arrow/flight/TestDictionaryUtils.java:
##########
@@ -87,6 +87,8 @@ public void testCreateSchema() {
assertEquals(1, dictionaryUsed.size());
assertEquals(0, dictionaryUsed.first());
+
+ dictVec.close();
Review Comment:
Same here?
##########
java/adapter/jdbc/src/test/java/org/apache/arrow/adapter/jdbc/ResultSetUtilityTest.java:
##########
@@ -50,6 +50,7 @@ public void testZeroRowResultSet() throws Exception {
assertNotNull("VectorSchemaRoot from first next() result should never
be null", root);
assertEquals("VectorSchemaRoot from empty ResultSet should have zero
rows", 0, root.getRowCount());
assertFalse("hasNext() should return false on empty ResultSets after
initial next() call", iter.hasNext());
+ root.close();
Review Comment:
Perhaps we can use a `try` instead of calling `close` explicitly?
##########
java/vector/src/main/java/org/apache/arrow/vector/BaseLargeVariableWidthVector.java:
##########
@@ -73,7 +73,8 @@ public BaseLargeVariableWidthVector(Field field, final
BufferAllocator allocator
lastValueCapacity = INITIAL_VALUE_ALLOCATION - 1;
valueCount = 0;
lastSet = -1;
- offsetBuffer = allocator.getEmpty();
+ // According to Arrow spec, the offsets buffer contains length + 1 elements
+ allocateOffsetBuffer(OFFSET_WIDTH);
Review Comment:
It might be expensive to do this up front every time an empty vector is
created. Should this be done lazily?
##########
java/vector/src/main/java/org/apache/arrow/vector/complex/AbstractStructVector.java:
##########
@@ -233,6 +233,11 @@ public <T extends FieldVector> T getChild(String name,
Class<T> clazz) {
protected ValueVector add(String childName, FieldType fieldType) {
FieldVector vector = fieldType.createNewSingleVector(childName, allocator,
callBack);
+
+ if (conflictPolicy == ConflictPolicy.CONFLICT_REPLACE &&
vectors.containsKey(childName)) {
+ vectors.getAll(childName).forEach(c -> c.close());
+ }
Review Comment:
Shouldn't this be done in `putVector` instead?
--
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]