viirya commented on code in PR #40043:
URL: https://github.com/apache/arrow/pull/40043#discussion_r1485837791
##########
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:
This address test failure in `TestStructVector`. When duplicate field names
exist in `initializeChildrenFromFields` call, the initial offset buffer in
previous vectors will cause memory leak. So these duplicate vectors are closed
here.
--
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]