Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<#if mode == "Single">
<#assign containerClass = "MapVector" />
<#else>
<#assign containerClass = "MapVector" />
<#assign containerClass = "NullableMapVector" />
</#if>

<#include "/@includes/license.ftl" />
Expand Down
8 changes: 4 additions & 4 deletions java/vector/src/main/codegen/templates/MapWriters.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
<@pp.changeOutputFile name="/org/apache/arrow/vector/complex/impl/${mode}MapWriter.java" />
<#assign index = "idx()">
<#if mode == "Single">
<#assign containerClass = "NonNullableMapVector" />
<#else>
<#assign containerClass = "MapVector" />
<#else>
<#assign containerClass = "NullableMapVector" />
</#if>

<#include "/@includes/license.ftl" />
Expand Down Expand Up @@ -51,7 +51,7 @@ public class ${mode}MapWriter extends AbstractFieldWriter {
private final Map<String, FieldWriter> fields = Maps.newHashMap();
public ${mode}MapWriter(${containerClass} container) {
<#if mode == "Single">
if (container instanceof MapVector) {
if (container instanceof NullableMapVector) {
throw new IllegalArgumentException("Invalid container: " + container);
}
</#if>
Expand Down Expand Up @@ -124,7 +124,7 @@ public MapWriter map(String name) {
FieldWriter writer = fields.get(finalName);
if(writer == null){
int vectorCount=container.size();
MapVector vector = container.addOrGet(name, FieldType.nullable(MinorType.MAP.getType()), MapVector.class);
NullableMapVector vector = container.addOrGet(name, FieldType.nullable(MinorType.MAP.getType()), NullableMapVector.class);
writer = new PromotableWriter(vector, container, getNullableMapWriterFactory());
if(vectorCount != container.size()) {
writer.allocate();
Expand Down
10 changes: 5 additions & 5 deletions java/vector/src/main/codegen/templates/UnionVector.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@


/**
* A vector which can hold values of different types. It does so by using a MapVector which contains a vector for each
* primitive type that is stored. MapVector is used in order to take advantage of its serialization/deserialization methods,
* A vector which can hold values of different types. It does so by using a NullableMapVector which contains a vector for each
* primitive type that is stored. NullableMapVector is used in order to take advantage of its serialization/deserialization methods,
* as well as the addOrGet method.
*
* For performance reasons, UnionVector stores a cached reference to each subtype vector, to avoid having to do the map lookup
Expand All @@ -65,7 +65,7 @@ public class UnionVector implements FieldVector {
MapVector internalMap;
protected ArrowBuf typeBuffer;

private MapVector mapVector;
private NullableMapVector mapVector;
private ListVector listVector;

private FieldReader reader;
Expand Down Expand Up @@ -174,10 +174,10 @@ public long getOffsetBufferAddress() {
@Override
public ArrowBuf getOffsetBuffer() { throw new UnsupportedOperationException(); }

public MapVector getMap() {
public NullableMapVector getMap() {
if (mapVector == null) {
int vectorCount = internalMap.size();
mapVector = addOrGet(MinorType.MAP, MapVector.class);
mapVector = addOrGet(MinorType.MAP, NullableMapVector.class);
if (internalMap.size() > vectorCount) {
mapVector.allocateNew();
if (callBack != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import org.apache.arrow.memory.OutOfMemoryException;
import org.apache.arrow.memory.BaseAllocator;
import org.apache.arrow.memory.BufferAllocator;
import org.apache.arrow.vector.complex.MapVector;
import org.apache.arrow.vector.complex.NullableMapVector;
import org.apache.arrow.vector.ipc.message.ArrowFieldNode;
import org.apache.arrow.vector.types.pojo.Field;
import org.apache.arrow.vector.types.pojo.FieldType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ protected boolean supportsDirectRead() {
// return the child vector's ordinal in the composite container
public abstract VectorWithOrdinal getChildVectorWithOrdinal(String name);

public MapVector addOrGetMap(String name) {
return addOrGet(name, FieldType.nullable(new Struct()), MapVector.class);
public NullableMapVector addOrGetMap(String name) {
return addOrGet(name, FieldType.nullable(new Struct()), NullableMapVector.class);
}

public ListVector addOrGetList(String name) {
Expand Down
Loading