Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
ttnghia committed Jun 14, 2023
1 parent 4f09f43 commit a40e667
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion java/src/test/java/ai/rapids/cudf/ColumnVectorTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -2877,7 +2877,7 @@ void testListConcatByRowIgnoreNull() {
}

@Test
void testFlattenLists() {
void testFlattenListsNoNulls() {
HostColumnVector.ListType listType = new HostColumnVector.ListType(true,
new HostColumnVector.BasicType(true, DType.INT32));
HostColumnVector.ListType listOfListsType = new HostColumnVector.ListType(true, listType);
Expand All @@ -2893,6 +2893,23 @@ void testFlattenLists() {
}
}

@Test
void testFlattenListsWithNulls() {
HostColumnVector.ListType listType = new HostColumnVector.ListType(true,
new HostColumnVector.BasicType(true, DType.INT32));
HostColumnVector.ListType listOfListsType = new HostColumnVector.ListType(true, listType);

try (ColumnVector input = ColumnVector.fromLists(listOfListsType,
Arrays.asList(null, Arrays.asList(3), Arrays.asList(4, 5, 6)),
Arrays.asList(Arrays.asList(null, 8, 9), Arrays.asList(10, 11, 12, 13, 14, null)));
ColumnVector result = input.flattenLists(true);
ColumnVector expected = ColumnVector.fromLists(listType,
null,
Arrays.asList(null, 8, 9, 10, 11, 12, 13, 14, null))) {
assertColumnsAreEqual(expected, result);
}
}

@Test
void testPrefixSum() {
try (ColumnVector v1 = ColumnVector.fromLongs(1, 2, 3, 5, 8, 10);
Expand Down

0 comments on commit a40e667

Please sign in to comment.