Skip to content

Commit

Permalink
ARROW-46: ListVector should initialize bits in allocateNew
Browse files Browse the repository at this point in the history
  • Loading branch information
minji-kim authored and StevenMPhillips committed Mar 9, 2016
1 parent 31def7d commit e822ea7
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ public UnionListWriter getWriter() {
@Override
public void allocateNew() throws OutOfMemoryException {
super.allocateNewSafe();
bits.allocateNewSafe();
}

public void transferTo(ListVector target) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,13 @@
import java.nio.charset.Charset;

import org.apache.arrow.memory.RootAllocator;
import org.apache.arrow.vector.complex.ListVector;
import org.apache.arrow.vector.complex.MapVector;
import org.apache.arrow.vector.complex.RepeatedListVector;
import org.apache.arrow.vector.complex.RepeatedMapVector;
import org.apache.arrow.vector.types.MaterializedField;
import org.apache.arrow.vector.types.Types;
import org.apache.arrow.vector.types.Types.MinorType;
import org.apache.arrow.vector.util.BasicTypeHelper;
import org.apache.arrow.vector.util.OversizedAllocationException;
import org.apache.arrow.vector.holders.BitHolder;
Expand Down Expand Up @@ -518,4 +521,21 @@ public void testVVInitialCapacity() throws Exception {
}
}

@Test
public void testListVectorShouldNotThrowOversizedAllocationException() throws Exception {
final MaterializedField field = MaterializedField.create(EMPTY_SCHEMA_PATH,
Types.optional(MinorType.LIST));
ListVector vector = new ListVector(field, allocator, null);
ListVector vectorFrom = new ListVector(field, allocator, null);
vectorFrom.allocateNew();

for (int i = 0; i < 10000; i++) {
vector.allocateNew();
vector.copyFromSafe(0, 0, vectorFrom);
vector.clear();
}

vectorFrom.clear();
vector.clear();
}
}

0 comments on commit e822ea7

Please sign in to comment.