Skip to content

Commit

Permalink
changed to use instanceof and added test
Browse files Browse the repository at this point in the history
  • Loading branch information
BryanCutler committed Sep 20, 2017
1 parent 2923a45 commit c240378
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ public int getBufferSize() {

@Override
public Field getField() {
if (getDataVector() == ZeroVector.INSTANCE) {
if (getDataVector() instanceof ZeroVector) {
return new Field(name, fieldType, ImmutableList.of(new Field(DATA_VECTOR_NAME, FieldType.nullable(Null.INSTANCE), null)));
}
return new Field(name, fieldType, ImmutableList.of(getDataVector().getField()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -628,4 +628,16 @@ public void testGetBufferAddress() throws Exception {
assertEquals(offsetAddress, buffers.get(1).memoryAddress());
}
}

@Test
public void testConsistentChildName() throws Exception {
try (ListVector listVector = ListVector.empty("sourceVector", allocator)) {
String emptyListStr = listVector.getField().toString();
assertTrue(emptyListStr.contains(ListVector.DATA_VECTOR_NAME));

listVector.addOrGetVector(FieldType.nullable(MinorType.INT.getType()));
String emptyVectorStr = listVector.getField().toString();
assertTrue(emptyVectorStr.contains(ListVector.DATA_VECTOR_NAME));
}
}
}

0 comments on commit c240378

Please sign in to comment.