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
30 changes: 15 additions & 15 deletions java/tools/src/test/java/org/apache/arrow/tools/EchoServerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@
import org.apache.arrow.memory.BufferAllocator;
import org.apache.arrow.memory.RootAllocator;
import org.apache.arrow.vector.FieldVector;
import org.apache.arrow.vector.NullableIntVector;
import org.apache.arrow.vector.NullableTinyIntVector;
import org.apache.arrow.vector.NullableVarCharVector;
import org.apache.arrow.vector.IntVector;
import org.apache.arrow.vector.TinyIntVector;
import org.apache.arrow.vector.VarCharVector;
import org.apache.arrow.vector.VectorSchemaRoot;
import org.apache.arrow.vector.complex.ListVector;
import org.apache.arrow.vector.complex.impl.UnionListWriter;
Expand Down Expand Up @@ -92,7 +92,7 @@ public static void stopEchoServer() throws IOException, InterruptedException {

private void testEchoServer(int serverPort,
Field field,
NullableTinyIntVector vector,
TinyIntVector vector,
int batches)
throws UnknownHostException, IOException {
VectorSchemaRoot root = new VectorSchemaRoot(asList(field), asList((FieldVector) vector), 0);
Expand All @@ -115,7 +115,7 @@ private void testEchoServer(int serverPort,

assertEquals(new Schema(asList(field)), reader.getVectorSchemaRoot().getSchema());

NullableTinyIntVector readVector = (NullableTinyIntVector) reader.getVectorSchemaRoot()
TinyIntVector readVector = (TinyIntVector) reader.getVectorSchemaRoot()
.getFieldVectors().get(0);
for (int i = 0; i < batches; i++) {
Assert.assertTrue(reader.loadNextBatch());
Expand All @@ -140,8 +140,8 @@ public void basicTest() throws InterruptedException, IOException {
"testField",
new FieldType(true, new ArrowType.Int(8, true), null, null),
Collections.<Field>emptyList());
NullableTinyIntVector vector =
new NullableTinyIntVector("testField", FieldType.nullable(TINYINT.getType()), alloc);
TinyIntVector vector =
new TinyIntVector("testField", FieldType.nullable(TINYINT.getType()), alloc);
Schema schema = new Schema(asList(field));

// Try an empty stream, just the header.
Expand All @@ -158,13 +158,13 @@ public void basicTest() throws InterruptedException, IOException {
public void testFlatDictionary() throws IOException {
DictionaryEncoding writeEncoding = new DictionaryEncoding(1L, false, null);
try (BufferAllocator allocator = new RootAllocator(Long.MAX_VALUE);
NullableIntVector writeVector =
new NullableIntVector(
IntVector writeVector =
new IntVector(
"varchar",
new FieldType(true, MinorType.INT.getType(), writeEncoding, null),
allocator);
NullableVarCharVector writeDictionaryVector =
new NullableVarCharVector(
VarCharVector writeDictionaryVector =
new VarCharVector(
"dict",
FieldType.nullable(VARCHAR.getType()),
allocator)) {
Expand Down Expand Up @@ -218,7 +218,7 @@ public void testFlatDictionary() throws IOException {

Dictionary dictionary = reader.lookup(1L);
Assert.assertNotNull(dictionary);
NullableVarCharVector dictionaryVector = ((NullableVarCharVector) dictionary.getVector());
VarCharVector dictionaryVector = ((VarCharVector) dictionary.getVector());
Assert.assertEquals(3, dictionaryVector.getValueCount());
Assert.assertEquals(new Text("foo"), dictionaryVector.getObject(0));
Assert.assertEquals(new Text("bar"), dictionaryVector.getObject(1));
Expand All @@ -231,8 +231,8 @@ public void testFlatDictionary() throws IOException {
public void testNestedDictionary() throws IOException {
DictionaryEncoding writeEncoding = new DictionaryEncoding(2L, false, null);
try (BufferAllocator allocator = new RootAllocator(Long.MAX_VALUE);
NullableVarCharVector writeDictionaryVector =
new NullableVarCharVector("dictionary", FieldType.nullable(VARCHAR.getType()), allocator);
VarCharVector writeDictionaryVector =
new VarCharVector("dictionary", FieldType.nullable(VARCHAR.getType()), allocator);
ListVector writeVector = ListVector.empty("list", allocator)) {

// data being written:
Expand Down Expand Up @@ -300,7 +300,7 @@ public void testNestedDictionary() throws IOException {

Dictionary readDictionary = reader.lookup(2L);
Assert.assertNotNull(readDictionary);
NullableVarCharVector dictionaryVector = ((NullableVarCharVector) readDictionary.getVector());
VarCharVector dictionaryVector = ((VarCharVector) readDictionary.getVector());
Assert.assertEquals(2, dictionaryVector.getValueCount());
Assert.assertEquals(new Text("foo"), dictionaryVector.getObject(0));
Assert.assertEquals(new Text("bar"), dictionaryVector.getObject(1));
Expand Down
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 = "NullableMapVector" />
<#assign containerClass = "MapVector" />
</#if>

<#include "/@includes/license.ftl" />
Expand Down
12 changes: 4 additions & 8 deletions java/vector/src/main/codegen/templates/ComplexReaders.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@
@SuppressWarnings("unused")
public class ${name}ReaderImpl extends AbstractFieldReader {

private final ${nullMode}${name}Vector vector;
private final ${name}Vector vector;

public ${name}ReaderImpl(${nullMode}${name}Vector vector){
public ${name}ReaderImpl(${name}Vector vector){
super();
this.vector = vector;
}
Expand All @@ -69,11 +69,7 @@ public Field getField(){
}

public boolean isSet(){
<#if nullMode == "Nullable">
return !vector.isNull(idx());
<#else>
return true;
</#if>
return !vector.isNull(idx());
}

public void copyAsValue(${minor.class?cap_first}Writer writer){
Expand All @@ -88,7 +84,7 @@ public void copyAsField(String name, MapWriter writer){

<#if nullMode != "Nullable">
public void read(${minor.class?cap_first}Holder h){
vector.getAccessor().get(idx(), h);
vector.get(idx(), h);
}
</#if>

Expand Down
10 changes: 4 additions & 6 deletions java/vector/src/main/codegen/templates/ComplexWriters.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@
@SuppressWarnings("unused")
public class ${eName}WriterImpl extends AbstractFieldWriter {

final Nullable${name}Vector vector;
final ${name}Vector vector;

public ${eName}WriterImpl(Nullable${name}Vector vector) {
public ${eName}WriterImpl(${name}Vector vector) {
this.vector = vector;
}

Expand Down Expand Up @@ -82,7 +82,7 @@ public void write(${minor.class?cap_first}Holder h) {
vector.getMutator().setValueCount(idx()+1);
}

public void write(Nullable${minor.class?cap_first}Holder h) {
public void write(${minor.class?cap_first}Holder h) {
mutator.addSafe(idx(), h);
vector.getMutator().setValueCount(idx()+1);
}
Expand Down Expand Up @@ -111,7 +111,7 @@ public void write(Nullable${minor.class}Holder h) {
}

public void write${minor.class}(<#list fields as field>${field.type} ${field.name}<#if field_has_next>, </#if></#list>) {
vector.setSafe(idx()<#if mode == "Nullable">, 1</#if><#list fields as field><#if field.include!true >, ${field.name}</#if></#list>);
vector.setSafe(idx(), 1<#list fields as field><#if field.include!true >, ${field.name}</#if></#list>);
vector.setValueCount(idx()+1);
}

Expand All @@ -122,13 +122,11 @@ public void write(Nullable${minor.class}Holder h) {
}
</#if>

<#if mode == "Nullable">
public void writeNull() {
vector.setNull(idx());
vector.setValueCount(idx()+1);
}
</#if>
</#if>
}

<@pp.changeOutputFile name="/org/apache/arrow/vector/complex/writer/${eName}Writer.java" />
Expand Down
Loading