diff --git a/cpp/tests/transform/row_bit_count_test.cu b/cpp/tests/transform/row_bit_count_test.cu index 636869cfaff..a2ad9b2ab77 100644 --- a/cpp/tests/transform/row_bit_count_test.cu +++ b/cpp/tests/transform/row_bit_count_test.cu @@ -87,14 +87,21 @@ std::pair, std::unique_ptr> build_list_column() using LCW = cudf::test::lists_column_wrapper; constexpr size_type type_size = sizeof(device_storage_type_t) * CHAR_BIT; - // clang-format off - cudf::test::lists_column_wrapper col{ {{1, 2}, {3, 4, 5}}, - LCW{LCW{}}, - {LCW{10}}, - {{6, 7, 8}, {9}}, - {{-1, -2}, {-3, -4}}, - {{-5, -6, -7}, {-8, -9}} }; - // clang-format on + // { + // {{1, 2}, {3, 4, 5}}, + // {{}}, + // {LCW{10}}, + // {{6, 7, 8}, {9}}, + // {{-1, -2}, {-3, -4}}, + // {{-5, -6, -7}, {-8, -9}} + // } + cudf::test::fixed_width_column_wrapper values{ + 1, 2, 3, 4, 5, 10, 6, 7, 8, 9, -1, -2, -3, -4, -5, -6, -7, -8, -9}; + cudf::test::fixed_width_column_wrapper inner_offsets{ + 0, 2, 5, 6, 9, 10, 12, 14, 17, 19}; + auto inner_list = cudf::make_lists_column(9, inner_offsets.release(), values.release(), 0, {}); + cudf::test::fixed_width_column_wrapper outer_offsets{0, 2, 2, 3, 5, 7, 9}; + auto list = cudf::make_lists_column(6, outer_offsets.release(), std::move(inner_list), 0, {}); // expected size = (num rows at level 1 + num_rows at level 2) + # values in the leaf cudf::test::fixed_width_column_wrapper expected{ @@ -105,7 +112,7 @@ std::pair, std::unique_ptr> build_list_column() ((4 + 8) * CHAR_BIT) + (type_size * 4), ((4 + 8) * CHAR_BIT) + (type_size * 5)}; - return {col.release(), expected.release()}; + return {std::move(list), expected.release()}; } TYPED_TEST(RowBitCountTyped, Lists) @@ -128,18 +135,26 @@ TYPED_TEST(RowBitCountTyped, ListsWithNulls) using LCW = cudf::test::lists_column_wrapper; constexpr size_type type_size = sizeof(device_storage_type_t) * CHAR_BIT; - std::vector valids{true, false, true}; - std::vector valids2{false, true, false}; - std::vector valids3{true, false}; - - // clang-format off - cudf::test::lists_column_wrapper col{ {{1, 2}, {{3, 4, 5}, valids.begin()}}, - LCW{LCW{}}, - {LCW{10}}, - {{{{6, 7, 8}, valids2.begin()}, {9}}, valids3.begin()} }; - // clang-format on - - table_view t({col}); + // { + // {{1, 2}, {3, null, 5}}, + // {{}}, + // {LCW{10}}, + // {{null, 7, null}, null}, + // } + cudf::test::fixed_width_column_wrapper values{{1, 2, 3, 4, 5, 10, 6, 7, 8}, + {1, 1, 1, 0, 1, 1, 0, 1, 0}}; + cudf::test::fixed_width_column_wrapper inner_offsets{0, 2, 5, 6, 9, 9}; + std::vector inner_list_validity{1, 1, 1, 1, 0}; + auto inner_list = cudf::make_lists_column( + 5, + inner_offsets.release(), + values.release(), + 1, + cudf::test::detail::make_null_mask(inner_list_validity.begin(), inner_list_validity.end())); + cudf::test::fixed_width_column_wrapper outer_offsets{0, 2, 2, 3, 5}; + auto list = cudf::make_lists_column(4, outer_offsets.release(), std::move(inner_list), 0, {}); + + table_view t({*list}); auto result = cudf::row_bit_count(t); // expected size = (num rows at level 1 + num_rows at level 2) + # values in the leaf + validity