Skip to content

Commit

Permalink
fix: adding listviewvector
Browse files Browse the repository at this point in the history
  • Loading branch information
vibhatha committed Aug 13, 2024
1 parent 23035f2 commit 18670bc
Showing 1 changed file with 23 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.apache.arrow.memory.RootAllocator;
import org.apache.arrow.vector.complex.FixedSizeListVector;
import org.apache.arrow.vector.complex.ListVector;
import org.apache.arrow.vector.complex.ListViewVector;
import org.apache.arrow.vector.complex.NonNullableStructVector;
import org.apache.arrow.vector.complex.StructVector;
import org.apache.arrow.vector.complex.UnionVector;
Expand Down Expand Up @@ -187,7 +188,10 @@ public void testListTypeReset() {
"VarList", allocator, FieldType.nullable(MinorType.INT.getType()), null);
final FixedSizeListVector fixedList =
new FixedSizeListVector(
"FixedList", allocator, FieldType.nullable(new FixedSizeList(2)), null)) {
"FixedList", allocator, FieldType.nullable(new FixedSizeList(2)), null);
final ListViewVector variableViewList =
new ListViewVector(
"VarListView", allocator, FieldType.nullable(MinorType.INT.getType()), null)) {
// ListVector
variableList.allocateNewSafe();
variableList.startNewValue(0);
Expand All @@ -201,6 +205,13 @@ public void testListTypeReset() {
fixedList.setNull(0);
fixedList.setValueCount(1);
resetVectorAndVerify(fixedList, fixedList.getBuffers(false));

// ListViewVector
variableViewList.allocateNewSafe();
variableViewList.startNewValue(0);
variableViewList.endValue(0, 0);
variableViewList.setValueCount(1);
resetVectorAndVerify(variableViewList, variableViewList.getBuffers(false));
}
}

Expand All @@ -211,7 +222,10 @@ public void testListTypeResetAndClear() {
"VarList", allocator, FieldType.nullable(MinorType.INT.getType()), null);
final FixedSizeListVector fixedList =
new FixedSizeListVector(
"FixedList", allocator, FieldType.nullable(new FixedSizeList(2)), null)) {
"FixedList", allocator, FieldType.nullable(new FixedSizeList(2)), null);
final ListViewVector variableViewList =
new ListViewVector(
"VarListView", allocator, FieldType.nullable(MinorType.INT.getType()), null)) {
// ListVector
variableList.allocateNewSafe();
variableList.startNewValue(0);
Expand All @@ -225,6 +239,13 @@ public void testListTypeResetAndClear() {
fixedList.setNull(0);
fixedList.setValueCount(1);
resetClearVectorAndVerify(fixedList, fixedList.getBuffers(true));

// ListViewVector
variableViewList.allocateNewSafe();
variableViewList.startNewValue(0);
variableViewList.endValue(0, 0);
variableViewList.setValueCount(1);
resetClearVectorAndVerify(variableViewList, variableViewList.getBuffers(true));
}
}

Expand Down

0 comments on commit 18670bc

Please sign in to comment.