Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[gpuCI] Forward-merge branch-21.10 to branch-21.12 [skip gpuci] #9295

Merged
merged 1 commit into from
Sep 24, 2021
Merged
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
4 changes: 4 additions & 0 deletions cpp/src/lists/interleave_columns.cu
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,10 @@ struct compute_string_sizes_and_interleave_lists_fn {
auto const start_str_idx = list_offsets[list_id];
auto const end_str_idx = list_offsets[list_id + 1];

// In case of empty list (i.e. it doesn't contain any string element), we just ignore it because
// there will not be anything to store for that list in the child column.
if (start_str_idx == end_str_idx) { return; }

// read_idx and write_idx are indices of string elements.
size_type write_idx = dst_list_offsets[idx];

Expand Down
36 changes: 28 additions & 8 deletions cpp/tests/lists/combine/concatenate_rows_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ struct ListConcatenateRowsTypedTest : public cudf::test::BaseFixture {
using TypesForTest = cudf::test::Concat<cudf::test::IntegralTypesNotBool,
cudf::test::FloatingPointTypes,
cudf::test::FixedPointTypes>;
TYPED_TEST_CASE(ListConcatenateRowsTypedTest, TypesForTest);
TYPED_TEST_SUITE(ListConcatenateRowsTypedTest, TypesForTest);

TYPED_TEST(ListConcatenateRowsTypedTest, ConcatenateEmptyColumns)
{
Expand Down Expand Up @@ -110,22 +110,26 @@ TYPED_TEST(ListConcatenateRowsTypedTest, SimpleInputNoNull)
{
using ListsCol = cudf::test::lists_column_wrapper<TypeParam>;

auto const col1 = ListsCol{{1, 2}, {3, 4}, {5, 6}}.release();
auto const col2 = ListsCol{{7, 8}, {9, 10}, {11, 12}}.release();
auto const expected = ListsCol{{1, 2, 7, 8}, {3, 4, 9, 10}, {5, 6, 11, 12}}.release();
auto const results = cudf::lists::concatenate_rows(TView{{col1->view(), col2->view()}});
auto const col1 = ListsCol{{1, 2}, {3, 4}, {5, 6}}.release();
auto const empty_lists = ListsCol{ListsCol{}, ListsCol{}, ListsCol{}}.release();
auto const col2 = ListsCol{{7, 8}, {9, 10}, {11, 12}}.release();
auto const expected = ListsCol{{1, 2, 7, 8}, {3, 4, 9, 10}, {5, 6, 11, 12}}.release();
auto const results =
cudf::lists::concatenate_rows(TView{{col1->view(), empty_lists->view(), col2->view()}});
CUDF_TEST_EXPECT_COLUMNS_EQUIVALENT(*expected, *results, verbosity);
}

TYPED_TEST(ListConcatenateRowsTypedTest, SimpleInputWithNullableChild)
{
using ListsCol = cudf::test::lists_column_wrapper<TypeParam>;

auto const col1 = ListsCol{{1, 2}, ListsCol{{null}, null_at(0)}, {5, 6}}.release();
auto const col2 = ListsCol{{7, 8}, {9, 10}, {11, 12}}.release();
auto const col1 = ListsCol{{1, 2}, ListsCol{{null}, null_at(0)}, {5, 6}}.release();
auto const empty_lists = ListsCol{{ListsCol{}, ListsCol{}, ListsCol{}}, null_at(2)}.release();
auto const col2 = ListsCol{{7, 8}, {9, 10}, {11, 12}}.release();
auto const expected =
ListsCol{{1, 2, 7, 8}, ListsCol{{null, 9, 10}, null_at(0)}, {5, 6, 11, 12}}.release();
auto const results = cudf::lists::concatenate_rows(TView{{col1->view(), col2->view()}});
auto const results =
cudf::lists::concatenate_rows(TView{{col1->view(), empty_lists->view(), col2->view()}});
CUDF_TEST_EXPECT_COLUMNS_EQUIVALENT(*expected, *results, verbosity);
}

Expand Down Expand Up @@ -466,3 +470,19 @@ TEST_F(ListConcatenateRowsTest, SlicedStringsColumnsInputWithNulls)
CUDF_TEST_EXPECT_COLUMNS_EQUIVALENT(*expected, *results, verbosity);
}
}

TEST_F(ListConcatenateRowsTest, StringsColumnsWithEmptyListTest)
{
auto const col1 = StrListsCol{{"1", "2", "3", "4"}}.release();
auto const col2 = StrListsCol{{"a", "b", "c"}}.release();
auto const col3 = StrListsCol{StrListsCol{}}.release();
auto const col4 = StrListsCol{{"x", "y", "" /*NULL*/, "z"}, null_at(2)}.release();
auto const col5 = StrListsCol{{StrListsCol{}}, null_at(0)}.release();
auto const expected =
StrListsCol{{"1", "2", "3", "4", "a", "b", "c", "x", "y", "" /*NULL*/, "z"}, null_at(9)}
.release();
auto const results = cudf::lists::concatenate_rows(
TView{{col1->view(), col2->view(), col3->view(), col4->view(), col5->view()}});

CUDF_TEST_EXPECT_COLUMNS_EQUIVALENT(*expected, *results, verbosity);
}