diff --git a/cpp/include/cudf/io/parquet.hpp b/cpp/include/cudf/io/parquet.hpp index ee03a382bec..bfe76d5690c 100644 --- a/cpp/include/cudf/io/parquet.hpp +++ b/cpp/include/cudf/io/parquet.hpp @@ -1200,7 +1200,7 @@ class parquet_writer_options : public parquet_writer_options_base { * @param sink The sink used for writer output * @param table Table to be written to output */ - explicit parquet_writer_options(sink_info const& sink, table_view const& table); + explicit parquet_writer_options(sink_info const& sink, table_view table); public: /** diff --git a/cpp/include/cudf_test/type_list_utilities.hpp b/cpp/include/cudf_test/type_list_utilities.hpp index 1793a8ecce0..3c96c59f0b7 100644 --- a/cpp/include/cudf_test/type_list_utilities.hpp +++ b/cpp/include/cudf_test/type_list_utilities.hpp @@ -414,9 +414,8 @@ struct RemoveIfImpl> { template struct RemoveIfImpl> { - using type = - Concat::value, Types<>, Types>::type, - typename RemoveIfImpl>::type>; + using type = Concat::value, Types<>, Types>, + typename RemoveIfImpl>::type>; }; // @endcond diff --git a/cpp/src/io/functions.cpp b/cpp/src/io/functions.cpp index 0ca54da5aaf..de8eea9e99b 100644 --- a/cpp/src/io/functions.cpp +++ b/cpp/src/io/functions.cpp @@ -38,6 +38,7 @@ #include #include +#include namespace cudf::io { @@ -852,8 +853,8 @@ void parquet_writer_options_base::set_sorting_columns(std::vector gather(rmm::cuda_stream_view stream, - rmm::device_async_resource_ref mr) const + [[nodiscard]] rmm::device_uvector gather(rmm::cuda_stream_view stream, + rmm::device_async_resource_ref mr) const { rmm::device_uvector output{size(), stream, mr}; auto output_it = output.begin(); diff --git a/cpp/tests/ast/transform_tests.cpp b/cpp/tests/ast/transform_tests.cpp index 6b350c137d0..94d76b28293 100644 --- a/cpp/tests/ast/transform_tests.cpp +++ b/cpp/tests/ast/transform_tests.cpp @@ -108,14 +108,14 @@ TEST_F(TransformTest, NullLiteral) auto expression = cudf::ast::operation(cudf::ast::ast_operator::IDENTITY, literal); auto result = cudf::compute_column(table, expression); - auto expected = column_wrapper({-123, -123, -123, -123}, {0, 0, 0, 0}); + auto expected = column_wrapper({-123, -123, -123, -123}, {false, false, false, false}); CUDF_TEST_EXPECT_COLUMNS_EQUAL(expected, result->view(), verbosity); } TEST_F(TransformTest, IsNull) { - auto c_0 = column_wrapper{{0, 1, 2, 0}, {0, 1, 1, 0}}; + auto c_0 = column_wrapper{{0, 1, 2, 0}, {false, true, true, false}}; auto table = cudf::table_view{{c_0}}; // result of IS_NULL on literal, will be a column of table size, with all values set to @@ -378,7 +378,7 @@ TEST_F(TransformTest, DeeplyNestedArithmeticLogicalExpression) auto expressions = std::list(); auto op = arithmetic_operator; - expressions.push_back(cudf::ast::operation(op, col_ref, col_ref)); + expressions.emplace_back(op, col_ref, col_ref); for (int64_t i = 0; i < depth_level - 1; i++) { if (i == depth_level - 2) { @@ -387,9 +387,9 @@ TEST_F(TransformTest, DeeplyNestedArithmeticLogicalExpression) op = arithmetic_operator; } if (nested_left_tree) { - expressions.push_back(cudf::ast::operation(op, expressions.back(), col_ref)); + expressions.emplace_back(op, expressions.back(), col_ref); } else { - expressions.push_back(cudf::ast::operation(op, col_ref, expressions.back())); + expressions.emplace_back(op, col_ref, expressions.back()); } } return expressions; @@ -717,15 +717,15 @@ TEST_F(TransformTest, BasicEqualityNullEqualNoNulls) TEST_F(TransformTest, BasicEqualityNormalEqualWithNulls) { - auto c_0 = column_wrapper{{3, 20, 1, 50}, {1, 1, 0, 0}}; - auto c_1 = column_wrapper{{3, 7, 1, 0}, {1, 1, 0, 0}}; + auto c_0 = column_wrapper{{3, 20, 1, 50}, {true, true, false, false}}; + auto c_1 = column_wrapper{{3, 7, 1, 0}, {true, true, false, false}}; auto table = cudf::table_view{{c_0, c_1}}; auto col_ref_0 = cudf::ast::column_reference(0); auto col_ref_1 = cudf::ast::column_reference(1); auto expression = cudf::ast::operation(cudf::ast::ast_operator::EQUAL, col_ref_0, col_ref_1); - auto expected = column_wrapper{{true, false, true, true}, {1, 1, 0, 0}}; + auto expected = column_wrapper{{true, false, true, true}, {true, true, false, false}}; auto result = cudf::compute_column(table, expression); CUDF_TEST_EXPECT_COLUMNS_EQUAL(expected, result->view(), verbosity); @@ -733,23 +733,24 @@ TEST_F(TransformTest, BasicEqualityNormalEqualWithNulls) TEST_F(TransformTest, BasicEqualityNulls) { - auto c_0 = column_wrapper{{3, 20, 1, 2, 50}, {1, 1, 0, 1, 0}}; - auto c_1 = column_wrapper{{3, 7, 1, 2, 0}, {1, 1, 1, 0, 0}}; + auto c_0 = column_wrapper{{3, 20, 1, 2, 50}, {true, true, false, true, false}}; + auto c_1 = column_wrapper{{3, 7, 1, 2, 0}, {true, true, true, false, false}}; auto table = cudf::table_view{{c_0, c_1}}; auto col_ref_0 = cudf::ast::column_reference(0); auto col_ref_1 = cudf::ast::column_reference(1); auto expression = cudf::ast::operation(cudf::ast::ast_operator::NULL_EQUAL, col_ref_0, col_ref_1); - auto expected = column_wrapper{{true, false, false, false, true}, {1, 1, 1, 1, 1}}; - auto result = cudf::compute_column(table, expression); + auto expected = + column_wrapper{{true, false, false, false, true}, {true, true, true, true, true}}; + auto result = cudf::compute_column(table, expression); CUDF_TEST_EXPECT_COLUMNS_EQUAL(expected, result->view(), verbosity); } TEST_F(TransformTest, UnaryNotNulls) { - auto c_0 = column_wrapper{{3, 0, 0, 50}, {0, 0, 1, 1}}; + auto c_0 = column_wrapper{{3, 0, 0, 50}, {false, false, true, true}}; auto table = cudf::table_view{{c_0}}; auto col_ref_0 = cudf::ast::column_reference(0); @@ -757,22 +758,22 @@ TEST_F(TransformTest, UnaryNotNulls) auto expression = cudf::ast::operation(cudf::ast::ast_operator::NOT, col_ref_0); auto result = cudf::compute_column(table, expression); - auto expected = column_wrapper{{false, true, true, false}, {0, 0, 1, 1}}; + auto expected = column_wrapper{{false, true, true, false}, {false, false, true, true}}; CUDF_TEST_EXPECT_COLUMNS_EQUAL(expected, result->view(), verbosity); } TEST_F(TransformTest, BasicAdditionNulls) { - auto c_0 = column_wrapper{{3, 20, 1, 50}, {0, 0, 1, 1}}; - auto c_1 = column_wrapper{{10, 7, 20, 0}, {0, 1, 0, 1}}; + auto c_0 = column_wrapper{{3, 20, 1, 50}, {false, false, true, true}}; + auto c_1 = column_wrapper{{10, 7, 20, 0}, {false, true, false, true}}; auto table = cudf::table_view{{c_0, c_1}}; auto col_ref_0 = cudf::ast::column_reference(0); auto col_ref_1 = cudf::ast::column_reference(1); auto expression = cudf::ast::operation(cudf::ast::ast_operator::ADD, col_ref_0, col_ref_1); - auto expected = column_wrapper{{0, 0, 0, 50}, {0, 0, 0, 1}}; + auto expected = column_wrapper{{0, 0, 0, 50}, {false, false, false, true}}; auto result = cudf::compute_column(table, expression); CUDF_TEST_EXPECT_COLUMNS_EQUAL(expected, result->view(), verbosity); @@ -807,9 +808,9 @@ TEST_F(TransformTest, BasicAdditionLargeNulls) TEST_F(TransformTest, NullLogicalAnd) { auto c_0 = column_wrapper{{false, false, true, true, false, false, true, true}, - {1, 1, 1, 1, 1, 0, 0, 0}}; + {true, true, true, true, true, false, false, false}}; auto c_1 = column_wrapper{{false, true, false, true, true, true, false, true}, - {1, 1, 1, 1, 0, 1, 1, 0}}; + {true, true, true, true, false, true, true, false}}; auto table = cudf::table_view{{c_0, c_1}}; auto col_ref_0 = cudf::ast::column_reference(0); @@ -818,7 +819,7 @@ TEST_F(TransformTest, NullLogicalAnd) cudf::ast::operation(cudf::ast::ast_operator::NULL_LOGICAL_AND, col_ref_0, col_ref_1); auto expected = column_wrapper{{false, false, false, true, false, false, false, true}, - {1, 1, 1, 1, 1, 0, 1, 0}}; + {true, true, true, true, true, false, true, false}}; auto result = cudf::compute_column(table, expression); CUDF_TEST_EXPECT_COLUMNS_EQUAL(expected, result->view(), verbosity); @@ -827,9 +828,9 @@ TEST_F(TransformTest, NullLogicalAnd) TEST_F(TransformTest, NullLogicalOr) { auto c_0 = column_wrapper{{false, false, true, true, false, false, true, true}, - {1, 1, 1, 1, 1, 0, 1, 0}}; + {true, true, true, true, true, false, true, false}}; auto c_1 = column_wrapper{{false, true, false, true, true, true, false, true}, - {1, 1, 1, 1, 0, 1, 0, 0}}; + {true, true, true, true, false, true, false, false}}; auto table = cudf::table_view{{c_0, c_1}}; auto col_ref_0 = cudf::ast::column_reference(0); @@ -838,7 +839,7 @@ TEST_F(TransformTest, NullLogicalOr) cudf::ast::operation(cudf::ast::ast_operator::NULL_LOGICAL_OR, col_ref_0, col_ref_1); auto expected = column_wrapper{{false, true, true, true, false, true, true, true}, - {1, 1, 1, 1, 0, 1, 1, 0}}; + {true, true, true, true, false, true, true, false}}; auto result = cudf::compute_column(table, expression); CUDF_TEST_EXPECT_COLUMNS_EQUAL(expected, result->view(), verbosity); diff --git a/cpp/tests/binaryop/binop-compiled-test.cpp b/cpp/tests/binaryop/binop-compiled-test.cpp index 06e0d193d80..ac2dded0162 100644 --- a/cpp/tests/binaryop/binop-compiled-test.cpp +++ b/cpp/tests/binaryop/binop-compiled-test.cpp @@ -45,7 +45,7 @@ template <> auto lhs_random_column(cudf::size_type size) { return cudf::test::strings_column_wrapper({"eee", "bb", "", "", "aa", "bbb", "ééé"}, - {1, 1, 0, 1, 1, 1, 1}); + {true, true, false, true, true, true, true}); } template auto rhs_random_column(cudf::size_type size) @@ -56,7 +56,7 @@ template <> auto rhs_random_column(cudf::size_type size) { return cudf::test::strings_column_wrapper({"ééé", "bbb", "aa", "", "", "bb", "eee"}, - {1, 1, 1, 1, 0, 1, 1}); + {true, true, true, true, false, true, true}); } // combinations to test diff --git a/cpp/tests/binaryop/util/operation.h b/cpp/tests/binaryop/util/operation.h index c900c4c558c..ef1ccfccab5 100644 --- a/cpp/tests/binaryop/util/operation.h +++ b/cpp/tests/binaryop/util/operation.h @@ -48,7 +48,7 @@ struct Add { void>* = nullptr> OutT operator()(TypeLhs lhs, TypeRhs rhs) const { - using TypeCommon = typename std::common_type::type; + using TypeCommon = std::common_type_t; return static_cast(static_cast(lhs) + static_cast(rhs)); } }; @@ -72,7 +72,7 @@ struct Sub { void>* = nullptr> OutT operator()(TypeLhs lhs, TypeRhs rhs) const { - using TypeCommon = typename std::common_type::type; + using TypeCommon = std::common_type_t; return static_cast(static_cast(lhs) - static_cast(rhs)); } }; @@ -83,7 +83,7 @@ struct Mul { std::enable_if_t::value, void>* = nullptr> TypeOut operator()(TypeLhs lhs, TypeRhs rhs) const { - using TypeCommon = typename std::common_type::type; + using TypeCommon = std::common_type_t; return static_cast(static_cast(lhs) * static_cast(rhs)); } @@ -100,7 +100,7 @@ struct Mul { std::enable_if_t<(cudf::is_duration_t::value && std::is_integral_v) || (cudf::is_duration_t::value && std::is_integral_v), void>* = nullptr> - OutT DurationProduct(LhsT x, RhsT y) const + [[nodiscard]] OutT DurationProduct(LhsT x, RhsT y) const { return x * y; } @@ -112,7 +112,7 @@ struct Div { std::enable_if_t::value, void>* = nullptr> TypeOut operator()(TypeLhs lhs, TypeRhs rhs) { - using TypeCommon = typename std::common_type::type; + using TypeCommon = std::common_type_t; return static_cast(static_cast(lhs) / static_cast(rhs)); } @@ -128,7 +128,7 @@ struct Div { typename LhsT, typename RhsT, std::enable_if_t<(std::is_integral_v || cudf::is_duration()), void>* = nullptr> - OutT DurationDivide(LhsT x, RhsT y) const + [[nodiscard]] OutT DurationDivide(LhsT x, RhsT y) const { return x / y; } @@ -191,33 +191,31 @@ struct FloorDiv { template struct Mod { - template ::type>)>* = nullptr> + template >)>* = nullptr> TypeOut operator()(TypeLhs lhs, TypeRhs rhs) { - using TypeCommon = typename std::common_type::type; + using TypeCommon = std::common_type_t; return static_cast(static_cast(lhs) % static_cast(rhs)); } - template ::type, float>)>* = nullptr> + template < + typename OutT = TypeOut, + typename LhsT = TypeLhs, + typename RhsT = TypeRhs, + std::enable_if_t<(std::is_same_v, float>)>* = nullptr> TypeOut operator()(TypeLhs lhs, TypeRhs rhs) { return static_cast(fmod(static_cast(lhs), static_cast(rhs))); } template < - typename OutT = TypeOut, - typename LhsT = TypeLhs, - typename RhsT = TypeRhs, - std::enable_if_t<(std::is_same_v::type, double>)>* = - nullptr> + typename OutT = TypeOut, + typename LhsT = TypeLhs, + typename RhsT = TypeRhs, + std::enable_if_t<(std::is_same_v, double>)>* = nullptr> TypeOut operator()(TypeLhs lhs, TypeRhs rhs) { return static_cast(fmod(static_cast(lhs), static_cast(rhs))); @@ -326,7 +324,7 @@ struct LogBase { template struct PMod { - using CommonArgsT = typename std::common_type::type; + using CommonArgsT = std::common_type_t; TypeOut operator()(TypeLhs x, TypeRhs y) const { @@ -351,8 +349,8 @@ struct PyMod { TypeOut operator()(TypeLhs x, TypeRhs y) const { if constexpr (std::is_floating_point_v or std::is_floating_point_v) { - double x1 = static_cast(x); - double y1 = static_cast(y); + auto x1 = static_cast(x); + auto y1 = static_cast(y); return fmod(fmod(x1, y1) + y1, y1); } else { return ((x % y) + y) % y; diff --git a/cpp/tests/bitmask/bitmask_tests.cpp b/cpp/tests/bitmask/bitmask_tests.cpp index fe221fb1c48..36423656ffd 100644 --- a/cpp/tests/bitmask/bitmask_tests.cpp +++ b/cpp/tests/bitmask/bitmask_tests.cpp @@ -696,8 +696,10 @@ struct MergeBitmaskTest : public cudf::test::BaseFixture {}; TEST_F(MergeBitmaskTest, TestBitmaskAnd) { - cudf::test::fixed_width_column_wrapper const bools_col1({0, 1, 0, 1, 1}, {0, 1, 1, 1, 0}); - cudf::test::fixed_width_column_wrapper const bools_col2({0, 2, 1, 0, 255}, {1, 1, 0, 1, 0}); + cudf::test::fixed_width_column_wrapper const bools_col1({0, 1, 0, 1, 1}, + {false, true, true, true, false}); + cudf::test::fixed_width_column_wrapper const bools_col2({0, 2, 1, 0, 255}, + {true, true, false, true, false}); cudf::test::fixed_width_column_wrapper const bools_col3({0, 2, 1, 0, 255}); auto const input1 = cudf::table_view({bools_col3}); @@ -728,8 +730,10 @@ TEST_F(MergeBitmaskTest, TestBitmaskAnd) TEST_F(MergeBitmaskTest, TestBitmaskOr) { - cudf::test::fixed_width_column_wrapper const bools_col1({0, 1, 0, 1, 1}, {1, 1, 0, 0, 1}); - cudf::test::fixed_width_column_wrapper const bools_col2({0, 2, 1, 0, 255}, {0, 0, 1, 0, 1}); + cudf::test::fixed_width_column_wrapper const bools_col1({0, 1, 0, 1, 1}, + {true, true, false, false, true}); + cudf::test::fixed_width_column_wrapper const bools_col2({0, 2, 1, 0, 255}, + {false, false, true, false, true}); cudf::test::fixed_width_column_wrapper const bools_col3({0, 2, 1, 0, 255}); auto const input1 = cudf::table_view({bools_col3}); diff --git a/cpp/tests/copying/copy_range_tests.cpp b/cpp/tests/copying/copy_range_tests.cpp index 25d93da277b..cb6a38259fc 100644 --- a/cpp/tests/copying/copy_range_tests.cpp +++ b/cpp/tests/copying/copy_range_tests.cpp @@ -234,8 +234,8 @@ TEST_F(CopyRangeTestFixture, CopyWithNullsString) TEST_F(CopyRangeTestFixture, CopyWithTargetNullsString) { - auto target = - cudf::test::strings_column_wrapper({"a", "b", "", "d", "", "é"}, {1, 1, 0, 1, 1, 1}); + auto target = cudf::test::strings_column_wrapper({"a", "b", "", "d", "", "é"}, + {true, true, false, true, true, true}); auto source = cudf::test::strings_column_wrapper({"A", "B", "C", "D", "E", "F"}); auto result = cudf::copy_range(source, target, 1, 5, 1); auto expected = cudf::test::strings_column_wrapper({"a", "B", "C", "D", "E", "é"}); diff --git a/cpp/tests/dictionary/add_keys_test.cpp b/cpp/tests/dictionary/add_keys_test.cpp index 46bf5468922..389a7aefb42 100644 --- a/cpp/tests/dictionary/add_keys_test.cpp +++ b/cpp/tests/dictionary/add_keys_test.cpp @@ -66,8 +66,9 @@ TEST_F(DictionaryAddKeysTest, FloatColumn) TEST_F(DictionaryAddKeysTest, WithNull) { - cudf::test::fixed_width_column_wrapper input{{555, 0, 333, 111, 222, 222, 222, 555, 0}, - {1, 1, 1, 0, 1, 1, 1, 1, 1}}; + cudf::test::fixed_width_column_wrapper input{ + {555, 0, 333, 111, 222, 222, 222, 555, 0}, + {true, true, true, false, true, true, true, true, true}}; cudf::test::fixed_width_column_wrapper new_keys{0, 111, 444, 777}; auto dictionary = cudf::dictionary::encode(input); @@ -85,7 +86,7 @@ TEST_F(DictionaryAddKeysTest, Errors) cudf::test::fixed_width_column_wrapper new_keys{1.0, 2.0, 3.0}; EXPECT_THROW(cudf::dictionary::add_keys(dictionary->view(), new_keys), cudf::data_type_error); - cudf::test::fixed_width_column_wrapper null_keys{{1, 2, 3}, {1, 0, 1}}; + cudf::test::fixed_width_column_wrapper null_keys{{1, 2, 3}, {true, false, true}}; EXPECT_THROW(cudf::dictionary::add_keys(dictionary->view(), null_keys), cudf::logic_error); } diff --git a/cpp/tests/encode/encode_tests.cpp b/cpp/tests/encode/encode_tests.cpp index 4f3463ef00d..aeb4fa40772 100644 --- a/cpp/tests/encode/encode_tests.cpp +++ b/cpp/tests/encode/encode_tests.cpp @@ -99,9 +99,10 @@ TEST_F(EncodeStringTest, SimpleNoNulls) TEST_F(EncodeStringTest, SimpleWithNulls) { - cudf::test::strings_column_wrapper input{{"a", "b", "c", "d", "a"}, {1, 0, 1, 1, 0}}; + cudf::test::strings_column_wrapper input{{"a", "b", "c", "d", "a"}, + {true, false, true, true, false}}; cudf::test::fixed_width_column_wrapper expect{0, 3, 1, 2, 3}; - cudf::test::strings_column_wrapper expect_keys{{"a", "c", "d", "0"}, {1, 1, 1, 0}}; + cudf::test::strings_column_wrapper expect_keys{{"a", "c", "d", "0"}, {true, true, true, false}}; auto const result = cudf::encode(cudf::table_view({input})); CUDF_TEST_EXPECT_COLUMNS_EQUAL(result.first->view().column(0), expect_keys); @@ -110,9 +111,11 @@ TEST_F(EncodeStringTest, SimpleWithNulls) TEST_F(EncodeStringTest, UnorderedWithNulls) { - cudf::test::strings_column_wrapper input{{"ef", "a", "c", "d", "ef", "a"}, {1, 0, 1, 1, 0, 1}}; + cudf::test::strings_column_wrapper input{{"ef", "a", "c", "d", "ef", "a"}, + {true, false, true, true, false, true}}; cudf::test::fixed_width_column_wrapper expect{3, 4, 1, 2, 4, 0}; - cudf::test::strings_column_wrapper expect_keys{{"a", "c", "d", "ef", "0"}, {1, 1, 1, 1, 0}}; + cudf::test::strings_column_wrapper expect_keys{{"a", "c", "d", "ef", "0"}, + {true, true, true, true, false}}; auto const result = cudf::encode(cudf::table_view({input})); CUDF_TEST_EXPECT_COLUMNS_EQUAL(result.first->view().column(0), expect_keys); diff --git a/cpp/tests/groupby/mean_tests.cpp b/cpp/tests/groupby/mean_tests.cpp index 0cb5ee30a8b..e9c72293649 100644 --- a/cpp/tests/groupby/mean_tests.cpp +++ b/cpp/tests/groupby/mean_tests.cpp @@ -49,7 +49,7 @@ TYPED_TEST(groupby_mean_test, basic) { using V = TypeParam; using R = cudf::detail::target_type_t; - using RT = typename std::conditional(), int, double>::type; + using RT = std::conditional_t(), int, double>; cudf::test::fixed_width_column_wrapper keys{1, 2, 3, 1, 2, 2, 1, 3, 3, 2}; cudf::test::fixed_width_column_wrapper vals{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; @@ -114,7 +114,7 @@ TYPED_TEST(groupby_mean_test, null_keys_and_values) { using V = TypeParam; using R = cudf::detail::target_type_t; - using RT = typename std::conditional(), int, double>::type; + using RT = std::conditional_t(), int, double>; cudf::test::fixed_width_column_wrapper keys( {1, 2, 3, 1, 2, 2, 1, 3, 3, 2, 4}, diff --git a/cpp/tests/interop/from_arrow_device_test.cpp b/cpp/tests/interop/from_arrow_device_test.cpp index a4dc7531765..743dfd23307 100644 --- a/cpp/tests/interop/from_arrow_device_test.cpp +++ b/cpp/tests/interop/from_arrow_device_test.cpp @@ -264,11 +264,13 @@ TEST_F(FromArrowDeviceTest, StructColumn) "Samuel Vimes", "Carrot Ironfoundersson", "Angua von Überwald"} .release(); auto str_col2 = - cudf::test::strings_column_wrapper{{"CUDF", "ROCKS", "EVERYWHERE"}, {0, 1, 0}}.release(); + cudf::test::strings_column_wrapper{{"CUDF", "ROCKS", "EVERYWHERE"}, {false, true, false}} + .release(); int num_rows{str_col->size()}; auto int_col = cudf::test::fixed_width_column_wrapper{{48, 27, 25}}.release(); auto int_col2 = - cudf::test::fixed_width_column_wrapper{{12, 24, 47}, {1, 0, 1}}.release(); + cudf::test::fixed_width_column_wrapper{{12, 24, 47}, {true, false, true}} + .release(); auto bool_col = cudf::test::fixed_width_column_wrapper{{true, true, false}}.release(); auto list_col = cudf::test::lists_column_wrapper({{{1, 2}, {3, 4}, {5}}, {{{6}}}, {{7}, {8, 9}}}) @@ -413,7 +415,8 @@ TEST_F(FromArrowDeviceTest, StructColumn) TEST_F(FromArrowDeviceTest, DictionaryIndicesType) { std::vector> columns; - auto col = cudf::test::fixed_width_column_wrapper({1, 2, 5, 2, 7}, {1, 0, 1, 1, 1}); + auto col = cudf::test::fixed_width_column_wrapper({1, 2, 5, 2, 7}, + {true, false, true, true, true}); columns.emplace_back(std::move(cudf::dictionary::encode(col))); columns.emplace_back(std::move(cudf::dictionary::encode(col))); columns.emplace_back(std::move(cudf::dictionary::encode(col))); @@ -448,20 +451,20 @@ TEST_F(FromArrowDeviceTest, DictionaryIndicesType) input_array->length = expected_table.num_rows(); input_array->null_count = 0; - auto col1_indices = - cudf::test::fixed_width_column_wrapper({0, 1, 2, 1, 3}, {1, 0, 1, 1, 1}); + auto col1_indices = cudf::test::fixed_width_column_wrapper( + {0, 1, 2, 1, 3}, {true, false, true, true, true}); populate_from_col(input_array->children[0], col1_indices); populate_from_col(input_array->children[0]->dictionary, cudf::dictionary_column_view{expected_table_view.column(0)}.keys()); - auto col2_indices = - cudf::test::fixed_width_column_wrapper({0, 1, 2, 1, 3}, {1, 0, 1, 1, 1}); + auto col2_indices = cudf::test::fixed_width_column_wrapper( + {0, 1, 2, 1, 3}, {true, false, true, true, true}); populate_from_col(input_array->children[1], col2_indices); populate_from_col(input_array->children[1]->dictionary, cudf::dictionary_column_view{expected_table_view.column(1)}.keys()); - auto col3_indices = - cudf::test::fixed_width_column_wrapper({0, 1, 2, 1, 3}, {1, 0, 1, 1, 1}); + auto col3_indices = cudf::test::fixed_width_column_wrapper( + {0, 1, 2, 1, 3}, {true, false, true, true, true}); populate_from_col(input_array->children[2], col3_indices); populate_from_col(input_array->children[2]->dictionary, cudf::dictionary_column_view{expected_table_view.column(2)}.keys()); @@ -671,8 +674,9 @@ TEST_F(FromArrowDeviceTest, FixedPoint128TableNulls) for (auto const scale : {3, 2, 1, 0, -1, -2, -3}) { auto const data = std::vector<__int128_t>{1, 2, 3, 4, 5, 6, 0, 0}; auto const validity = std::vector{1, 1, 1, 1, 1, 1, 0, 0}; - auto const col = - fp_wrapper<__int128_t>({1, 2, 3, 4, 5, 6, 0, 0}, {1, 1, 1, 1, 1, 1, 0, 0}, scale_type{scale}); + auto const col = fp_wrapper<__int128_t>({1, 2, 3, 4, 5, 6, 0, 0}, + {true, true, true, true, true, true, false, false}, + scale_type{scale}); auto const expected = cudf::table_view({col}); nanoarrow::UniqueSchema input_schema; diff --git a/cpp/tests/interop/from_arrow_host_test.cpp b/cpp/tests/interop/from_arrow_host_test.cpp index cbfa4911c3c..6cd289d2b38 100644 --- a/cpp/tests/interop/from_arrow_host_test.cpp +++ b/cpp/tests/interop/from_arrow_host_test.cpp @@ -303,15 +303,17 @@ TEST_F(FromArrowHostDeviceTest, StructColumn) "Samuel Vimes", "Carrot Ironfoundersson", "Angua von Überwald"} .release(); auto str_col2 = - cudf::test::strings_column_wrapper{{"CUDF", "ROCKS", "EVERYWHERE"}, {0, 1, 0}}.release(); + cudf::test::strings_column_wrapper{{"CUDF", "ROCKS", "EVERYWHERE"}, {false, true, false}} + .release(); int num_rows{str_col->size()}; auto int_col = cudf::test::fixed_width_column_wrapper{{48, 27, 25}}.release(); auto int_col2 = - cudf::test::fixed_width_column_wrapper{{12, 24, 47}, {1, 0, 1}}.release(); - auto bool_col = cudf::test::fixed_width_column_wrapper{{true, true, false}}.release(); - auto list_col = - cudf::test::lists_column_wrapper({{{1, 2}, {3, 4}, {5}}, {{{6}}}, {{7}, {8, 9}}}) + cudf::test::fixed_width_column_wrapper{{12, 24, 47}, {true, false, true}} .release(); + auto bool_col = cudf::test::fixed_width_column_wrapper{{true, true, false}}.release(); + auto list_col = cudf::test::lists_column_wrapper( + {{{1, 2}, {3, 4}, {5}}, {{{6}}}, {{7}, {8, 9}}}) // NOLINT + .release(); vector_of_columns cols2; cols2.push_back(std::move(str_col2)); cols2.push_back(std::move(int_col2)); @@ -470,11 +472,12 @@ TEST_F(FromArrowHostDeviceTest, DictionaryIndicesType) // create equivalent cudf dictionary columns auto keys_col = cudf::test::fixed_width_column_wrapper({1, 2, 5, 7}); - auto ind1_col = cudf::test::fixed_width_column_wrapper({0, 1, 2, 1, 3}, {1, 0, 1, 1, 1}); - auto ind2_col = - cudf::test::fixed_width_column_wrapper({0, 1, 2, 1, 3}, {1, 0, 1, 1, 1}); - auto ind3_col = - cudf::test::fixed_width_column_wrapper({0, 1, 2, 1, 3}, {1, 0, 1, 1, 1}); + auto ind1_col = cudf::test::fixed_width_column_wrapper({0, 1, 2, 1, 3}, + {true, false, true, true, true}); + auto ind2_col = cudf::test::fixed_width_column_wrapper({0, 1, 2, 1, 3}, + {true, false, true, true, true}); + auto ind3_col = cudf::test::fixed_width_column_wrapper({0, 1, 2, 1, 3}, + {true, false, true, true, true}); vector_of_columns columns; columns.emplace_back(cudf::make_dictionary_column(keys_col, ind1_col)); diff --git a/cpp/tests/interop/from_arrow_test.cpp b/cpp/tests/interop/from_arrow_test.cpp index 81c406c0faf..18a89232865 100644 --- a/cpp/tests/interop/from_arrow_test.cpp +++ b/cpp/tests/interop/from_arrow_test.cpp @@ -64,7 +64,7 @@ std::unique_ptr get_cudf_table() "1", "2", }, - {0, 1, 1, 1, 1}) + {false, true, true, true, true}) .release()); // columns.emplace_back(cudf::test::lists_column_wrapper({{1, 2}, {3, 4}, {}, {6}, {7, 8, // 9}}).release()); diff --git a/cpp/tests/interop/to_arrow_device_test.cpp b/cpp/tests/interop/to_arrow_device_test.cpp index 51216a8512c..72e4d1b31d4 100644 --- a/cpp/tests/interop/to_arrow_device_test.cpp +++ b/cpp/tests/interop/to_arrow_device_test.cpp @@ -82,8 +82,8 @@ get_nanoarrow_cudf_table(cudf::size_type length) test_data.string_data.begin(), test_data.string_data.end(), test_data.validity.begin()) .release(); vector_of_columns cols; - cols.push_back(move(int_column)); - cols.push_back(move(str_column)); + cols.push_back(std::move(int_column)); + cols.push_back(std::move(str_column)); auto [null_mask, null_count] = cudf::bools_to_mask(cudf::test::fixed_width_column_wrapper( test_data.bool_data_validity.begin(), test_data.bool_data_validity.end())); columns.emplace_back( @@ -569,15 +569,17 @@ TEST_F(ToArrowDeviceTest, StructColumn) "Samuel Vimes", "Carrot Ironfoundersson", "Angua von Überwald"} .release(); auto str_col2 = - cudf::test::strings_column_wrapper{{"CUDF", "ROCKS", "EVERYWHERE"}, {0, 1, 0}}.release(); + cudf::test::strings_column_wrapper{{"CUDF", "ROCKS", "EVERYWHERE"}, {false, true, false}} + .release(); int num_rows{str_col->size()}; auto int_col = cudf::test::fixed_width_column_wrapper{{48, 27, 25}}.release(); auto int_col2 = - cudf::test::fixed_width_column_wrapper{{12, 24, 47}, {1, 0, 1}}.release(); - auto bool_col = cudf::test::fixed_width_column_wrapper{{true, true, false}}.release(); - auto list_col = - cudf::test::lists_column_wrapper({{{1, 2}, {3, 4}, {5}}, {{{6}}}, {{7}, {8, 9}}}) + cudf::test::fixed_width_column_wrapper{{12, 24, 47}, {true, false, true}} .release(); + auto bool_col = cudf::test::fixed_width_column_wrapper{{true, true, false}}.release(); + auto list_col = cudf::test::lists_column_wrapper( + {{{1, 2}, {3, 4}, {5}}, {{{6}}}, {{7}, {8, 9}}}) // NOLINT + .release(); vector_of_columns cols2; cols2.push_back(std::move(str_col2)); cols2.push_back(std::move(int_col2)); diff --git a/cpp/tests/interop/to_arrow_host_test.cpp b/cpp/tests/interop/to_arrow_host_test.cpp index fc0ed6c9352..46e5c6285ee 100644 --- a/cpp/tests/interop/to_arrow_host_test.cpp +++ b/cpp/tests/interop/to_arrow_host_test.cpp @@ -430,15 +430,17 @@ TEST_F(ToArrowHostDeviceTest, StructColumn) "Samuel Vimes", "Carrot Ironfoundersson", "Angua von Überwald"} .release(); auto str_col2 = - cudf::test::strings_column_wrapper{{"CUDF", "ROCKS", "EVERYWHERE"}, {0, 1, 0}}.release(); + cudf::test::strings_column_wrapper{{"CUDF", "ROCKS", "EVERYWHERE"}, {false, true, false}} + .release(); int num_rows{str_col->size()}; auto int_col = cudf::test::fixed_width_column_wrapper{{48, 27, 25}}.release(); auto int_col2 = - cudf::test::fixed_width_column_wrapper{{12, 24, 47}, {1, 0, 1}}.release(); - auto bool_col = cudf::test::fixed_width_column_wrapper{{true, true, false}}.release(); - auto list_col = - cudf::test::lists_column_wrapper({{{1, 2}, {3, 4}, {5}}, {{{6}}}, {{7}, {8, 9}}}) + cudf::test::fixed_width_column_wrapper{{12, 24, 47}, {true, false, true}} .release(); + auto bool_col = cudf::test::fixed_width_column_wrapper{{true, true, false}}.release(); + auto list_col = cudf::test::lists_column_wrapper( + {{{1, 2}, {3, 4}, {5}}, {{{6}}}, {{7}, {8, 9}}}) // NOLINT + .release(); vector_of_columns cols2; cols2.push_back(std::move(str_col2)); cols2.push_back(std::move(int_col2)); @@ -922,9 +924,10 @@ TEST_F(ToArrowHostDeviceTest, FixedPoint32TableNullsSimple) for (auto const scale : {3, 2, 1, 0, -1, -2, -3}) { auto const data = std::vector<__int128_t>{1, 2, 3, 4, 5, 6, 0, 0}; auto const validity = std::vector{1, 1, 1, 1, 1, 1, 0, 0}; - auto const col = - fp_wrapper({1, 2, 3, 4, 5, 6, 0, 0}, {1, 1, 1, 1, 1, 1, 0, 0}, scale_type{scale}); - auto const input = cudf::table_view({col}); + auto const col = fp_wrapper({1, 2, 3, 4, 5, 6, 0, 0}, + {true, true, true, true, true, true, false, false}, + scale_type{scale}); + auto const input = cudf::table_view({col}); nanoarrow::UniqueSchema expected_schema; ArrowSchemaInit(expected_schema.get()); @@ -977,9 +980,10 @@ TEST_F(ToArrowHostDeviceTest, FixedPoint64TableNullsSimple) for (auto const scale : {3, 2, 1, 0, -1, -2, -3}) { auto const data = std::vector<__int128_t>{1, 2, 3, 4, 5, 6, 0, 0}; auto const validity = std::vector{1, 1, 1, 1, 1, 1, 0, 0}; - auto const col = - fp_wrapper({1, 2, 3, 4, 5, 6, 0, 0}, {1, 1, 1, 1, 1, 1, 0, 0}, scale_type{scale}); - auto const input = cudf::table_view({col}); + auto const col = fp_wrapper({1, 2, 3, 4, 5, 6, 0, 0}, + {true, true, true, true, true, true, false, false}, + scale_type{scale}); + auto const input = cudf::table_view({col}); nanoarrow::UniqueSchema expected_schema; ArrowSchemaInit(expected_schema.get()); @@ -1032,9 +1036,10 @@ TEST_F(ToArrowHostDeviceTest, FixedPoint128TableNullsSimple) for (auto const scale : {3, 2, 1, 0, -1, -2, -3}) { auto const data = std::vector<__int128_t>{1, 2, 3, 4, 5, 6, 0, 0}; auto const validity = std::vector{1, 1, 1, 1, 1, 1, 0, 0}; - auto const col = - fp_wrapper<__int128_t>({1, 2, 3, 4, 5, 6, 0, 0}, {1, 1, 1, 1, 1, 1, 0, 0}, scale_type{scale}); - auto const input = cudf::table_view({col}); + auto const col = fp_wrapper<__int128_t>({1, 2, 3, 4, 5, 6, 0, 0}, + {true, true, true, true, true, true, false, false}, + scale_type{scale}); + auto const input = cudf::table_view({col}); nanoarrow::UniqueSchema expected_schema; ArrowSchemaInit(expected_schema.get()); diff --git a/cpp/tests/interop/to_arrow_test.cpp b/cpp/tests/interop/to_arrow_test.cpp index 90ae12cdd90..5e07da5357e 100644 --- a/cpp/tests/interop/to_arrow_test.cpp +++ b/cpp/tests/interop/to_arrow_test.cpp @@ -112,8 +112,8 @@ std::pair, std::shared_ptr> get_table cudf::test::strings_column_wrapper(string_data.begin(), string_data.end(), validity.begin()) .release(); vector_of_columns cols; - cols.push_back(move(int_column)); - cols.push_back(move(str_column)); + cols.push_back(std::move(int_column)); + cols.push_back(std::move(str_column)); auto [null_mask, null_count] = cudf::bools_to_mask(cudf::test::fixed_width_column_wrapper( bool_data_validity.begin(), bool_data_validity.end())); columns.emplace_back( @@ -288,15 +288,17 @@ TEST_F(ToArrowTest, StructColumn) "Samuel Vimes", "Carrot Ironfoundersson", "Angua von Überwald"} .release(); auto str_col2 = - cudf::test::strings_column_wrapper{{"CUDF", "ROCKS", "EVERYWHERE"}, {0, 1, 0}}.release(); + cudf::test::strings_column_wrapper{{"CUDF", "ROCKS", "EVERYWHERE"}, {false, true, false}} + .release(); int num_rows{str_col->size()}; auto int_col = cudf::test::fixed_width_column_wrapper{{48, 27, 25}}.release(); auto int_col2 = - cudf::test::fixed_width_column_wrapper{{12, 24, 47}, {1, 0, 1}}.release(); - auto bool_col = cudf::test::fixed_width_column_wrapper{{true, true, false}}.release(); - auto list_col = - cudf::test::lists_column_wrapper({{{1, 2}, {3, 4}, {5}}, {{{6}}}, {{7}, {8, 9}}}) + cudf::test::fixed_width_column_wrapper{{12, 24, 47}, {true, false, true}} .release(); + auto bool_col = cudf::test::fixed_width_column_wrapper{{true, true, false}}.release(); + auto list_col = cudf::test::lists_column_wrapper( + {{{1, 2}, {3, 4}, {5}}, {{{6}}}, {{7}, {8, 9}}}) // NOLINT + .release(); vector_of_columns cols2; cols2.push_back(std::move(str_col2)); cols2.push_back(std::move(int_col2)); @@ -473,9 +475,10 @@ TEST_F(ToArrowTest, FixedPoint64TableNullsSimple) for (auto const scale : {3, 2, 1, 0, -1, -2, -3}) { auto const data = std::vector{1, 0, 2, 0, 3, 0, 4, 0, 5, 0, 6, 0, 0, 0, 0, 0}; auto const validity = std::vector{1, 1, 1, 1, 1, 1, 0, 0}; - auto const col = - fp_wrapper({1, 2, 3, 4, 5, 6, 0, 0}, {1, 1, 1, 1, 1, 1, 0, 0}, scale_type{scale}); - auto const input = cudf::table_view({col}); + auto const col = fp_wrapper({1, 2, 3, 4, 5, 6, 0, 0}, + {true, true, true, true, true, true, false, false}, + scale_type{scale}); + auto const input = cudf::table_view({col}); auto const arr = make_decimal128_arrow_array(data, validity, scale); @@ -496,9 +499,10 @@ TEST_F(ToArrowTest, FixedPoint128TableNullsSimple) for (auto const scale : {3, 2, 1, 0, -1, -2, -3}) { auto const data = std::vector<__int128_t>{1, 2, 3, 4, 5, 6, 0, 0}; auto const validity = std::vector{1, 1, 1, 1, 1, 1, 0, 0}; - auto const col = - fp_wrapper<__int128_t>({1, 2, 3, 4, 5, 6, 0, 0}, {1, 1, 1, 1, 1, 1, 0, 0}, scale_type{scale}); - auto const input = cudf::table_view({col}); + auto const col = fp_wrapper<__int128_t>({1, 2, 3, 4, 5, 6, 0, 0}, + {true, true, true, true, true, true, false, false}, + scale_type{scale}); + auto const input = cudf::table_view({col}); auto const arr = make_decimal128_arrow_array(data, validity, scale); @@ -517,8 +521,10 @@ TEST_F(ToArrowTest, FixedPoint64TableNulls) using namespace numeric; for (auto const scale : {3, 2, 1, 0, -1, -2, -3}) { - auto const col = fp_wrapper( - {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, {1, 0, 1, 0, 1, 0, 1, 0, 1, 0}, scale_type{scale}); + auto const col = + fp_wrapper({1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, + {true, false, true, false, true, false, true, false, true, false}, + scale_type{scale}); auto const input = cudf::table_view({col}); auto const expect_data = @@ -542,8 +548,10 @@ TEST_F(ToArrowTest, FixedPoint128TableNulls) using namespace numeric; for (auto const scale : {3, 2, 1, 0, -1, -2, -3}) { - auto const col = fp_wrapper<__int128_t>( - {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, {1, 0, 1, 0, 1, 0, 1, 0, 1, 0}, scale_type{scale}); + auto const col = + fp_wrapper<__int128_t>({1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, + {true, false, true, false, true, false, true, false, true, false}, + scale_type{scale}); auto const input = cudf::table_view({col}); auto const expect_data = std::vector<__int128_t>{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; diff --git a/cpp/tests/io/csv_test.cpp b/cpp/tests/io/csv_test.cpp index dc14824d834..9bd6ff99d40 100644 --- a/cpp/tests/io/csv_test.cpp +++ b/cpp/tests/io/csv_test.cpp @@ -63,9 +63,9 @@ auto dtype() template using column_wrapper = - typename std::conditional, - cudf::test::strings_column_wrapper, - cudf::test::fixed_width_column_wrapper>::type; + std::conditional_t, + cudf::test::strings_column_wrapper, + cudf::test::fixed_width_column_wrapper>; using column = cudf::column; using table = cudf::table; using table_view = cudf::table_view; @@ -954,7 +954,7 @@ TEST_F(CsvReaderTest, Strings) ASSERT_EQ(type_id::STRING, view.column(1).type().id()); expect_column_data_equal( - std::vector{"abc def ghi", "\"jkl mno pqr\"", "stu \"\"vwx\"\" yz"}, + std::vector{"abc def ghi", "\"jkl mno pqr\"", R"(stu ""vwx"" yz)"}, view.column(1)); } @@ -1014,7 +1014,7 @@ TEST_F(CsvReaderTest, StringsQuotesIgnored) ASSERT_EQ(type_id::STRING, view.column(1).type().id()); expect_column_data_equal( - std::vector{"\"abcdef ghi\"", "\"jkl \"\"mno\"\" pqr\"", "stu \"vwx\" yz"}, + std::vector{"\"abcdef ghi\"", R"("jkl ""mno"" pqr")", "stu \"vwx\" yz"}, view.column(1)); } @@ -1830,7 +1830,7 @@ TEST_F(CsvReaderTest, StringsWithWriter) auto int_column = column_wrapper{10, 20, 30}; auto string_column = - column_wrapper{"abc def ghi", "\"jkl mno pqr\"", "stu \"\"vwx\"\" yz"}; + column_wrapper{"abc def ghi", "\"jkl mno pqr\"", R"(stu ""vwx"" yz)"}; cudf::table_view input_table(std::vector{int_column, string_column}); // TODO add quoting style flag? diff --git a/cpp/tests/io/json/json_test.cpp b/cpp/tests/io/json/json_test.cpp index a094ac7d772..a627fd4837c 100644 --- a/cpp/tests/io/json/json_test.cpp +++ b/cpp/tests/io/json/json_test.cpp @@ -68,9 +68,9 @@ auto dtype() template using column_wrapper = - typename std::conditional, - cudf::test::strings_column_wrapper, - cudf::test::fixed_width_column_wrapper>::type; + std::conditional_t, + cudf::test::strings_column_wrapper, + cudf::test::fixed_width_column_wrapper>; cudf::test::TempDirTestEnvironment* const temp_env = static_cast( @@ -858,8 +858,7 @@ TEST_P(JsonReaderRecordTest, JsonLinesObjects) TEST_P(JsonReaderRecordTest, JsonLinesObjectsStrings) { - auto const test_opt = GetParam(); - auto test_json_objects = [test_opt](std::string const& data) { + auto test_json_objects = [](std::string const& data) { cudf::io::json_reader_options in_options = cudf::io::json_reader_options::builder(cudf::io::source_info{data.data(), data.size()}) .lines(true); @@ -2329,7 +2328,7 @@ TEST_F(JsonReaderTest, MixedTypes) { "a": "123" } { "a": null } )", - cudf::test::strings_column_wrapper({"123", ""}, std::vector{1, 0}.begin())); + cudf::test::strings_column_wrapper({"123", ""}, std::vector{true, false}.begin())); // STRUCT mixed: // STRUCT + STR, STRUCT + LIST, STRUCT + null @@ -2349,7 +2348,7 @@ TEST_F(JsonReaderTest, MixedTypes) { "a": null } )", cudf::test::structs_column_wrapper{ - {child_int_col_wrapper}, {1, 0} /*Validity*/ + {child_int_col_wrapper}, {true, false} /*Validity*/ }); // LIST mixed: diff --git a/cpp/tests/io/orc_test.cpp b/cpp/tests/io/orc_test.cpp index 89e704f3ed3..495eb5a6410 100644 --- a/cpp/tests/io/orc_test.cpp +++ b/cpp/tests/io/orc_test.cpp @@ -43,9 +43,9 @@ template using column_wrapper = - typename std::conditional, - cudf::test::strings_column_wrapper, - cudf::test::fixed_width_column_wrapper>::type; + std::conditional_t, + cudf::test::strings_column_wrapper, + cudf::test::fixed_width_column_wrapper>; using str_col = column_wrapper; using bool_col = column_wrapper; @@ -435,8 +435,9 @@ TEST_F(OrcWriterTest, MultiColumnWithNulls) {{9, 8}, {7, 6, 5}, {}, {4}, {3, 2, 1, 0}, {20, 21, 22, 23, 24}, {}, {66, 666}, {}, {-1, -2}}, col0_mask}; auto ages_col = cudf::test::fixed_width_column_wrapper{ - {48, 27, 25, 31, 351, 351, 29, 15, -1, -99}, {1, 0, 1, 1, 0, 1, 1, 1, 0, 1}}; - struct_col col8{{ages_col}, {0, 1, 1, 0, 1, 1, 0, 1, 1, 0}}; + {48, 27, 25, 31, 351, 351, 29, 15, -1, -99}, + {true, false, true, true, false, true, true, true, false, true}}; + struct_col col8{{ages_col}, {false, true, true, false, true, true, false, true, true, false}}; table_view expected({col0, col1, col2, col3, col4, col5, col6, col7, col8}); cudf::io::table_input_metadata expected_metadata(expected); diff --git a/cpp/tests/io/text/multibyte_split_test.cpp b/cpp/tests/io/text/multibyte_split_test.cpp index 408d54bd5ff..74d08061df9 100644 --- a/cpp/tests/io/text/multibyte_split_test.cpp +++ b/cpp/tests/io/text/multibyte_split_test.cpp @@ -145,7 +145,7 @@ TEST_F(MultibyteSplitTest, LargeInput) for (auto i = 0; i < (2 * 32 * 128 * 1024); i++) { host_input += "...:|"; - host_expected.emplace_back(std::string("...:|")); + host_expected.emplace_back("...:|"); } auto expected = strings_column_wrapper{host_expected.begin(), host_expected.end()}; diff --git a/cpp/tests/json/json_tests.cpp b/cpp/tests/json/json_tests.cpp index 42a574ac5c0..060ed6d4be8 100644 --- a/cpp/tests/json/json_tests.cpp +++ b/cpp/tests/json/json_tests.cpp @@ -461,7 +461,7 @@ TEST_F(JsonPathTests, GetJsonObjectNullInputs) auto result_raw = cudf::get_json_object(cudf::strings_column_view(input), json_path); auto result = drop_whitespace(*result_raw); - cudf::test::strings_column_wrapper expected_raw({"b", "", "b", ""}, {1, 0, 1, 0}); + cudf::test::strings_column_wrapper expected_raw({"b", "", "b", ""}, {true, false, true, false}); auto expected = drop_whitespace(expected_raw); CUDF_TEST_EXPECT_COLUMNS_EQUIVALENT(*result, *expected); @@ -476,7 +476,7 @@ TEST_F(JsonPathTests, GetJsonObjectEmptyQuery) std::string json_path(""); auto result = cudf::get_json_object(cudf::strings_column_view(input), json_path); - cudf::test::strings_column_wrapper expected({""}, {0}); + cudf::test::strings_column_wrapper expected({""}, {false}); CUDF_TEST_EXPECT_COLUMNS_EQUIVALENT(*result, expected); } @@ -490,7 +490,7 @@ TEST_F(JsonPathTests, GetJsonObjectEmptyInputsAndOutputs) std::string json_path("$"); auto result = cudf::get_json_object(cudf::strings_column_view(input), json_path); - cudf::test::strings_column_wrapper expected({""}, {0}); + cudf::test::strings_column_wrapper expected({""}, {false}); CUDF_TEST_EXPECT_COLUMNS_EQUIVALENT(*result, expected); } @@ -503,7 +503,7 @@ TEST_F(JsonPathTests, GetJsonObjectEmptyInputsAndOutputs) std::string json_path("$.store.bicycle"); auto result = cudf::get_json_object(cudf::strings_column_view(input), json_path); - cudf::test::strings_column_wrapper expected({""}, {1}); + cudf::test::strings_column_wrapper expected({""}, {true}); CUDF_TEST_EXPECT_COLUMNS_EQUIVALENT(*result, expected); } @@ -608,7 +608,7 @@ TEST_F(JsonPathTests, GetJsonObjectInvalidQuery) std::string json_path("$[*].c"); auto result = cudf::get_json_object(cudf::strings_column_view(input), json_path); - cudf::test::strings_column_wrapper expected({""}, {0}); + cudf::test::strings_column_wrapper expected({""}, {false}); CUDF_TEST_EXPECT_COLUMNS_EQUIVALENT(*result, expected); } @@ -619,7 +619,7 @@ TEST_F(JsonPathTests, GetJsonObjectInvalidQuery) std::string json_path("$[*].c[2]"); auto result = cudf::get_json_object(cudf::strings_column_view(input), json_path); - cudf::test::strings_column_wrapper expected({""}, {0}); + cudf::test::strings_column_wrapper expected({""}, {false}); CUDF_TEST_EXPECT_COLUMNS_EQUIVALENT(*result, expected); } @@ -630,7 +630,7 @@ TEST_F(JsonPathTests, GetJsonObjectInvalidQuery) std::string json_path("$.store.book.price"); auto result = cudf::get_json_object(cudf::strings_column_view(input), json_path); - cudf::test::strings_column_wrapper expected({""}, {0}); + cudf::test::strings_column_wrapper expected({""}, {false}); CUDF_TEST_EXPECT_COLUMNS_EQUIVALENT(*result, expected); } @@ -641,7 +641,7 @@ TEST_F(JsonPathTests, GetJsonObjectInvalidQuery) std::string json_path("$.store.book[4]"); auto result = cudf::get_json_object(cudf::strings_column_view(input), json_path); - cudf::test::strings_column_wrapper expected({""}, {0}); + cudf::test::strings_column_wrapper expected({""}, {false}); CUDF_TEST_EXPECT_COLUMNS_EQUIVALENT(*result, expected); } @@ -696,7 +696,7 @@ TEST_F(JsonPathTests, MixedOutput) "\"b\": [\"c\",null,true,-1]" "}" }, - {1, 1, 0, 1, 1, 1}); + {true, true, false, true, true, true}); // clang-format on CUDF_TEST_EXPECT_COLUMNS_EQUIVALENT(*result, expected); @@ -715,7 +715,7 @@ TEST_F(JsonPathTests, MixedOutput) "", "", }, - {0, 0, 0, 1, 0, 0}); + {false, false, false, true, false, false}); // clang-format on CUDF_TEST_EXPECT_COLUMNS_EQUIVALENT(*result, expected); @@ -733,7 +733,7 @@ TEST_F(JsonPathTests, MixedOutput) "", "", "[\"c\",null,true,-1]"}, - {1, 1, 0, 0, 0, 1}); + {true, true, false, false, false, true}); // clang-format on CUDF_TEST_EXPECT_COLUMNS_EQUIVALENT(*result, expected); @@ -754,7 +754,7 @@ TEST_F(JsonPathTests, MixedOutput) "{\"i\": 10, \"j\": 100}," "[\"c\",null,true,-1]" "]" }, - {1, 1, 0, 1, 1, 1}); + {true, true, false, true, true, true}); // clang-format on CUDF_TEST_EXPECT_COLUMNS_EQUIVALENT(*result, expected); @@ -772,7 +772,7 @@ TEST_F(JsonPathTests, MixedOutput) "", "", "[\"c\",null,true,-1]"}, - {1, 1, 0, 0, 0, 1}); + {true, true, false, false, false, true}); // clang-format on CUDF_TEST_EXPECT_COLUMNS_EQUIVALENT(*result, expected); @@ -886,7 +886,7 @@ TEST_F(JsonPathTests, AllowSingleQuotes) "abc'def", "'abc'def'" }, - {1, 1, 0, 1, 1, 1, 1, 1}); + {true, true, false, true, true, true, true, true}); // clang-format on CUDF_TEST_EXPECT_COLUMNS_EQUIVALENT(*result, expected); diff --git a/cpp/tests/labeling/label_bins_tests.cpp b/cpp/tests/labeling/label_bins_tests.cpp index 1a9e74df9be..644cda83f05 100644 --- a/cpp/tests/labeling/label_bins_tests.cpp +++ b/cpp/tests/labeling/label_bins_tests.cpp @@ -107,7 +107,8 @@ TEST(BinColumnErrorTests, TestMismatchedEdges) // Left edges with nulls. TEST(BinColumnErrorTests, TestLeftEdgesWithNullsBefore) { - fwc_wrapper left_edges{{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, {0, 1, 1, 1, 1, 1, 1, 1, 1, 1}}; + fwc_wrapper left_edges{{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, + {false, true, true, true, true, true, true, true, true, true}}; fwc_wrapper right_edges{1, 2, 3, 4, 5, 6, 7, 8, 9}; fwc_wrapper input{0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5}; @@ -120,7 +121,8 @@ TEST(BinColumnErrorTests, TestLeftEdgesWithNullsBefore) TEST(BinColumnErrorTests, TestRightEdgesWithNullsBefore) { fwc_wrapper left_edges{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; - fwc_wrapper right_edges{{1, 2, 3, 4, 5, 6, 7, 8, 9}, {0, 1, 1, 1, 1, 1, 1, 1, 1, 1}}; + fwc_wrapper right_edges{{1, 2, 3, 4, 5, 6, 7, 8, 9}, + {false, true, true, true, true, true, true, true, true, true}}; fwc_wrapper input{0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5}; EXPECT_THROW( @@ -344,8 +346,8 @@ TYPED_TEST(FixedPointBinTestFixture, TestFixedPointData) cudf::label_bins(input, left_edges, cudf::inclusive::YES, right_edges, cudf::inclusive::NO); // Check that every element is placed in bin 2. - fwc_wrapper expected{{2, 2, 2, 2, 2, 2, 2, 2, 2, 2}, - {1, 1, 1, 1, 1, 1, 1, 1, 1, 1}}; + fwc_wrapper expected{ + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2}, {true, true, true, true, true, true, true, true, true, true}}; CUDF_TEST_EXPECT_COLUMNS_EQUAL(expected, result->view()); }; @@ -363,7 +365,7 @@ TEST(TestStringData, SimpleStringTest) auto result = cudf::label_bins(input, left_edges, cudf::inclusive::YES, right_edges, cudf::inclusive::NO); - fwc_wrapper expected{{0, 1, 2, 3, 4}, {1, 1, 1, 1, 1}}; + fwc_wrapper expected{{0, 1, 2, 3, 4}, {true, true, true, true, true}}; CUDF_TEST_EXPECT_COLUMNS_EQUAL(expected, result->view()); }; @@ -392,7 +394,21 @@ TEST(TestStringData, NonAsciiStringTest) cudf::label_bins(input, left_edges, cudf::inclusive::NO, right_edges, cudf::inclusive::NO); fwc_wrapper expected{{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0}}; + {true, + true, + true, + true, + false, + false, + false, + false, + false, + true, + false, + false, + false, + true, + false}}; CUDF_TEST_EXPECT_COLUMNS_EQUAL(expected, result->view()); } @@ -422,14 +438,15 @@ TEST(TestStringData, SlicedNonAsciiStringTest) { auto result = cudf::label_bins( sliced_inputs[0], left_edges, cudf::inclusive::NO, right_edges, cudf::inclusive::NO); - fwc_wrapper expected{{0, 0, 0, 0}, {1, 1, 1, 0}}; + fwc_wrapper expected{{0, 0, 0, 0}, {true, true, true, false}}; CUDF_TEST_EXPECT_COLUMNS_EQUAL(expected, result->view()); } { auto result = cudf::label_bins( sliced_inputs[1], left_edges, cudf::inclusive::NO, right_edges, cudf::inclusive::NO); - fwc_wrapper expected{{0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 1, 0}}; + fwc_wrapper expected{{0, 0, 0, 0, 0, 0}, + {false, false, false, false, true, false}}; CUDF_TEST_EXPECT_COLUMNS_EQUAL(expected, result->view()); } } diff --git a/cpp/tests/lists/extract_tests.cpp b/cpp/tests/lists/extract_tests.cpp index 92dd5df5ec7..b9a5edc8a6a 100644 --- a/cpp/tests/lists/extract_tests.cpp +++ b/cpp/tests/lists/extract_tests.cpp @@ -113,53 +113,62 @@ TEST_F(ListsExtractTest, ExtractElementStrings) { auto result = cudf::lists::extract_list_element(cudf::lists_column_view(input), 0); - cudf::test::strings_column_wrapper expected({"", "", "are", "tést", ""}, {1, 0, 1, 1, 1}); + cudf::test::strings_column_wrapper expected({"", "", "are", "tést", ""}, + {true, false, true, true, true}); CUDF_TEST_EXPECT_COLUMNS_EQUAL(expected, *result); } { auto result = cudf::lists::extract_list_element(cudf::lists_column_view(input), 1); cudf::test::strings_column_wrapper expected({"Héllo", "", "some", "String", ""}, - {1, 0, 1, 1, 0}); + {true, false, true, true, false}); CUDF_TEST_EXPECT_COLUMNS_EQUAL(expected, *result); } { auto result = cudf::lists::extract_list_element(cudf::lists_column_view(input), 2); - cudf::test::strings_column_wrapper expected({"thesé", "", "", "", ""}, {1, 0, 1, 0, 0}); + cudf::test::strings_column_wrapper expected({"thesé", "", "", "", ""}, + {true, false, true, false, false}); CUDF_TEST_EXPECT_COLUMNS_EQUAL(expected, *result); } { auto result = cudf::lists::extract_list_element(cudf::lists_column_view(input), 3); - cudf::test::strings_column_wrapper expected({"", "", "z", "", ""}, {0, 0, 1, 0, 0}); + cudf::test::strings_column_wrapper expected({"", "", "z", "", ""}, + {false, false, true, false, false}); CUDF_TEST_EXPECT_COLUMNS_EQUAL(expected, *result); } { auto result = cudf::lists::extract_list_element(cudf::lists_column_view(input), 4); - cudf::test::strings_column_wrapper expected({"", "", "", "", ""}, {0, 0, 0, 0, 0}); + cudf::test::strings_column_wrapper expected({"", "", "", "", ""}, + {false, false, false, false, false}); CUDF_TEST_EXPECT_COLUMNS_EQUAL(expected, *result); } { auto result = cudf::lists::extract_list_element(cudf::lists_column_view(input), -1); - cudf::test::strings_column_wrapper expected({"thesé", "", "z", "String", ""}, {1, 0, 1, 1, 1}); + cudf::test::strings_column_wrapper expected({"thesé", "", "z", "String", ""}, + {true, false, true, true, true}); CUDF_TEST_EXPECT_COLUMNS_EQUAL(expected, *result); } { auto result = cudf::lists::extract_list_element(cudf::lists_column_view(input), -2); - cudf::test::strings_column_wrapper expected({"Héllo", "", "", "tést", ""}, {1, 0, 1, 1, 0}); + cudf::test::strings_column_wrapper expected({"Héllo", "", "", "tést", ""}, + {true, false, true, true, false}); CUDF_TEST_EXPECT_COLUMNS_EQUAL(expected, *result); } { auto result = cudf::lists::extract_list_element(cudf::lists_column_view(input), -3); - cudf::test::strings_column_wrapper expected({"", "", "some", "", ""}, {1, 0, 1, 0, 0}); + cudf::test::strings_column_wrapper expected({"", "", "some", "", ""}, + {true, false, true, false, false}); CUDF_TEST_EXPECT_COLUMNS_EQUAL(expected, *result); } { auto result = cudf::lists::extract_list_element(cudf::lists_column_view(input), -4); - cudf::test::strings_column_wrapper expected({"", "", "are", "", ""}, {0, 0, 1, 0, 0}); + cudf::test::strings_column_wrapper expected({"", "", "are", "", ""}, + {false, false, true, false, false}); CUDF_TEST_EXPECT_COLUMNS_EQUAL(expected, *result); } { auto result = cudf::lists::extract_list_element(cudf::lists_column_view(input), -5); - cudf::test::strings_column_wrapper expected({"", "", "", "", ""}, {0, 0, 0, 0, 0}); + cudf::test::strings_column_wrapper expected({"", "", "", "", ""}, + {false, false, false, false, false}); CUDF_TEST_EXPECT_COLUMNS_EQUAL(expected, *result); } } @@ -230,7 +239,7 @@ TEST_F(ListsExtractTest, ExtractElementEmpty) LCW null_strings({LCW{"", "", ""}}, thrust::make_constant_iterator(0)); result = cudf::lists::extract_list_element(cudf::lists_column_view(null_strings), 1); - cudf::test::strings_column_wrapper expected_null({""}, {0}); + cudf::test::strings_column_wrapper expected_null({""}, {false}); CUDF_TEST_EXPECT_COLUMNS_EQUIVALENT(expected_null, *result); } @@ -249,12 +258,14 @@ TEST_F(ListsExtractTest, ExtractElementWithNulls) } { auto result = cudf::lists::extract_list_element(cudf::lists_column_view(input), 1); - cudf::test::strings_column_wrapper expected({"", "", "", "strings"}, {0, 0, 0, 1}); + cudf::test::strings_column_wrapper expected({"", "", "", "strings"}, + {false, false, false, true}); CUDF_TEST_EXPECT_COLUMNS_EQUIVALENT(expected, *result); } { auto result = cudf::lists::extract_list_element(cudf::lists_column_view(input), -1); - cudf::test::strings_column_wrapper expected({"thesé", "are", "", "strings"}, {1, 1, 0, 1}); + cudf::test::strings_column_wrapper expected({"thesé", "are", "", "strings"}, + {true, true, false, true}); CUDF_TEST_EXPECT_COLUMNS_EQUIVALENT(expected, *result); } } diff --git a/cpp/tests/merge/merge_test.cpp b/cpp/tests/merge/merge_test.cpp index 2e09f25b51f..43a45d7dc31 100644 --- a/cpp/tests/merge/merge_test.cpp +++ b/cpp/tests/merge/merge_test.cpp @@ -767,14 +767,14 @@ TEST_F(MergeTest, StructsWithNulls) // clang-format off cudf::test::fixed_width_column_wrapper t0_col0{0, 2, 4, 6, 8}; - cudf::test::strings_column_wrapper t0_scol0{{"abc", "def", "ghi", "jkl", "mno"}, {1, 1, 0, 0, 1}}; - cudf::test::fixed_width_column_wrapper t0_scol1{{1, 2, 3, 4, 5}, {0, 1, 0, 0, 1}}; - cudf::test::structs_column_wrapper t0_col1({t0_scol0, t0_scol1}, {1, 0, 1, 0, 0}); + cudf::test::strings_column_wrapper t0_scol0{{"abc", "def", "ghi", "jkl", "mno"}, {true, true, false, false, true}}; + cudf::test::fixed_width_column_wrapper t0_scol1{{1, 2, 3, 4, 5}, {false, true, false, false, true}}; + cudf::test::structs_column_wrapper t0_col1({t0_scol0, t0_scol1}, {true, false, true, false, false}); cudf::test::fixed_width_column_wrapper t1_col0{1, 3, 5, 7, 9}; cudf::test::strings_column_wrapper t1_scol0{"pqr", "stu", "vwx", "yzz", "000"}; - cudf::test::fixed_width_column_wrapper t1_scol1{{-1, -2, -3, -4, -5}, {1, 1, 1, 0, 0}}; - cudf::test::structs_column_wrapper t1_col1({t1_scol0, t1_scol1}, {1, 1, 1, 1, 0}); + cudf::test::fixed_width_column_wrapper t1_scol1{{-1, -2, -3, -4, -5}, {true, true, true, false, false}}; + cudf::test::structs_column_wrapper t1_col1({t1_scol0, t1_scol1}, {true, true, true, true, false}); cudf::table_view t0({t0_col0, t0_col1}); cudf::table_view t1({t1_col0, t1_col1}); @@ -783,10 +783,10 @@ TEST_F(MergeTest, StructsWithNulls) cudf::test::fixed_width_column_wrapper e_col0{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; cudf::test::strings_column_wrapper e_scol0{{"abc", "pqr", "def", "stu", "ghi", "vwx", "jkl", "yzz", "mno", "000"}, - {1, 1, 0, 1, 0, 1, 0, 1, 0, 1}}; + {true, true, false, true, false, true, false, true, false, true}}; cudf::test::fixed_width_column_wrapper e_scol1{{1, -1, 2, -2, 3, -3, 4, -4, 5, -5}, - {0, 1, 0, 1, 0, 1, 0, 0, 0, 0}}; - cudf::test::structs_column_wrapper e_col1({e_scol0, e_scol1}, {1, 1, 0, 1, 1, 1, 0, 1, 0, 0}); + {false, true, false, true, false, true, false, false, false, false}}; + cudf::test::structs_column_wrapper e_col1({e_scol0, e_scol1}, {true, true, false, true, true, true, false, true, false, false}); cudf::table_view expected({e_col0, e_col1}); @@ -841,18 +841,18 @@ TEST_F(MergeTest, StructsNestedWithNulls) cudf::test::fixed_width_column_wrapper t0_col0{8, 6, 4, 2, 0}; cudf::test::strings_column_wrapper t0_scol0{"mno", "jkl", "ghi", "def", "abc"}; - cudf::test::fixed_width_column_wrapper t0_scol1{{5, 4, 3, 2, 1}, {1, 1, 0, 1, 1}}; - cudf::test::strings_column_wrapper t0_sscol0{{"5555", "4444", "333", "22", "1"}, {1, 0, 1, 1, 0}}; + cudf::test::fixed_width_column_wrapper t0_scol1{{5, 4, 3, 2, 1}, {true, true, false, true, true}}; + cudf::test::strings_column_wrapper t0_sscol0{{"5555", "4444", "333", "22", "1"}, {true, false, true, true, false}}; cudf::test::fixed_width_column_wrapper t0_sscol1{50, 40, 30, 20, 10}; - cudf::test::structs_column_wrapper t0_scol2({t0_sscol0, t0_sscol1}, {0, 0, 1, 1, 1}); - cudf::test::structs_column_wrapper t0_col1({t0_scol0, t0_scol1, t0_scol2}, {0, 0, 1, 1, 1}); + cudf::test::structs_column_wrapper t0_scol2({t0_sscol0, t0_sscol1}, {false, false, true, true, true}); + cudf::test::structs_column_wrapper t0_col1({t0_scol0, t0_scol1, t0_scol2}, {false, false, true, true, true}); cudf::test::fixed_width_column_wrapper t1_col0{9, 7, 5, 3, 1}; cudf::test::strings_column_wrapper t1_scol0{"000", "yzz", "vwx", "stu", "pqr"}; - cudf::test::fixed_width_column_wrapper t1_scol1{{-5, -4, -3, -2, -1}, {1, 1, 1, 0, 1}}; - cudf::test::strings_column_wrapper t1_sscol0{{"-5555", "-4444", "-333", "-22", "-1"}, {1, 1, 1, 1, 1}}; + cudf::test::fixed_width_column_wrapper t1_scol1{{-5, -4, -3, -2, -1}, {true, true, true, false, true}}; + cudf::test::strings_column_wrapper t1_sscol0{{"-5555", "-4444", "-333", "-22", "-1"}, {true, true, true, true, true}}; cudf::test::fixed_width_column_wrapper t1_sscol1{-50, -40, -30, -20, -10}; - cudf::test::structs_column_wrapper t1_scol2({t1_sscol0, t1_sscol1}, {1, 1, 1, 1, 0}); + cudf::test::structs_column_wrapper t1_scol2({t1_sscol0, t1_sscol1}, {true, true, true, true, false}); cudf::test::structs_column_wrapper t1_col1({t1_scol0, t1_scol1, t1_scol2}); cudf::table_view t0({t0_col0 , t0_col1}); @@ -863,12 +863,12 @@ TEST_F(MergeTest, StructsNestedWithNulls) cudf::test::fixed_width_column_wrapper e_col0{9, 8, 7, 6, 5, 4, 3, 2, 1, 0}; cudf::test::strings_column_wrapper e_scol0{"000", "mno", "yzz", "jkl", "vwx", "ghi", "stu", "def", "pqr", "abc"}; cudf::test::fixed_width_column_wrapper e_scol1{{-5, 5, -4, 4, -3, 3, -2, 2, -1, 1}, - { 1, 1, 1, 1, 1, 0, 0, 1, 1, 1}}; + { true, true, true, true, true, false, false, true, true, true}}; cudf::test::strings_column_wrapper e_sscol0{{"-5555", "5555", "-4444", "4444", "-333", "333", "-22", "22", "-1", "1"}, - { 1, 0, 1, 0, 1, 1, 1, 1, 0, 0}}; + { true, false, true, false, true, true, true, true, false, false}}; cudf::test::fixed_width_column_wrapper e_sscol1{-50, 50, -40, 40, -30, 30, -20, 20, -10, 10}; - cudf::test::structs_column_wrapper e_scol2({e_sscol0, e_sscol1}, {1, 0, 1, 0, 1, 1, 1, 1, 0, 1}); - cudf::test::structs_column_wrapper e_col1({e_scol0, e_scol1, e_scol2}, {1, 0, 1, 0, 1, 1, 1, 1, 1, 1}); + cudf::test::structs_column_wrapper e_scol2({e_sscol0, e_sscol1}, {true, false, true, false, true, true, true, true, false, true}); + cudf::test::structs_column_wrapper e_col1({e_scol0, e_scol1, e_scol2}, {true, false, true, false, true, true, true, true, true, true}); cudf::table_view expected({e_col0, e_col1}); diff --git a/cpp/tests/reductions/ewm_tests.cpp b/cpp/tests/reductions/ewm_tests.cpp index 09cec688509..f0dd3d10880 100644 --- a/cpp/tests/reductions/ewm_tests.cpp +++ b/cpp/tests/reductions/ewm_tests.cpp @@ -67,8 +67,9 @@ TYPED_TEST(TypedEwmScanTest, Ewm) TYPED_TEST(TypedEwmScanTest, EwmWithNulls) { auto const v = make_vector({1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0}); - auto const b = thrust::host_vector(std::vector{1, 0, 1, 0, 0, 1, 1}); - auto col = this->make_column(v, b); + auto const b = + thrust::host_vector(std::vector{true, false, true, false, false, true, true}); + auto col = this->make_column(v, b); auto const expected_ewma_vals_adjust = cudf::test::fixed_width_column_wrapper{{1.0, diff --git a/cpp/tests/replace/clamp_test.cpp b/cpp/tests/replace/clamp_test.cpp index 239c9ce6ddd..dbacf68adb4 100644 --- a/cpp/tests/replace/clamp_test.cpp +++ b/cpp/tests/replace/clamp_test.cpp @@ -384,7 +384,7 @@ struct ClampStringTest : public cudf::test::BaseFixture {}; TEST_F(ClampStringTest, WithNullableColumn) { std::vector strings{"A", "b", "c", "", "e", "F", "G", "H", "", "j", "B"}; - std::vector valids{1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1}; + std::vector valids{true, true, true, false, true, true, true, true, false, true, true}; cudf::test::strings_column_wrapper input(strings.begin(), strings.end(), valids.begin()); @@ -426,7 +426,7 @@ TEST_F(ClampStringTest, WithNonNullableColumn) TEST_F(ClampStringTest, WithNullableColumnNullLow) { std::vector strings{"A", "b", "c", "", "e", "F", "G", "H", "", "j", "B"}; - std::vector valids{1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1}; + std::vector valids{true, true, true, false, true, true, true, true, false, true, true}; cudf::test::strings_column_wrapper input(strings.begin(), strings.end(), valids.begin()); @@ -448,7 +448,7 @@ TEST_F(ClampStringTest, WithNullableColumnNullLow) TEST_F(ClampStringTest, WithNullableColumnNullHigh) { std::vector strings{"A", "b", "c", "", "e", "F", "G", "H", "", "j", "B"}; - std::vector valids{1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1}; + std::vector valids{true, true, true, false, true, true, true, true, false, true, true}; cudf::test::strings_column_wrapper input(strings.begin(), strings.end(), valids.begin()); @@ -470,7 +470,7 @@ TEST_F(ClampStringTest, WithNullableColumnNullHigh) TEST_F(ClampStringTest, WithNullableColumnBothLoAndHiNull) { std::vector strings{"A", "b", "c", "", "e", "F", "G", "H", "", "j", "B"}; - std::vector valids{1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1}; + std::vector valids{true, true, true, false, true, true, true, true, false, true, true}; cudf::test::strings_column_wrapper input(strings.begin(), strings.end(), valids.begin()); @@ -487,7 +487,7 @@ TEST_F(ClampStringTest, WithNullableColumnBothLoAndHiNull) TEST_F(ClampStringTest, WithReplaceString) { std::vector strings{"A", "b", "c", "", "e", "F", "G", "H", "", "j", "B"}; - std::vector valids{1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1}; + std::vector valids{true, true, true, false, true, true, true, true, false, true, true}; cudf::test::strings_column_wrapper input(strings.begin(), strings.end(), valids.begin()); @@ -514,15 +514,17 @@ struct ClampDictionaryTest : public cudf::test::BaseFixture {}; TEST_F(ClampDictionaryTest, WithNullableColumn) { - cudf::test::strings_column_wrapper input_s({"a", "b", "c", "d", "", "d", "c", "b", "a"}, - {1, 1, 1, 1, 0, 1, 1, 1, 1}); + cudf::test::strings_column_wrapper input_s( + {"a", "b", "c", "d", "", "d", "c", "b", "a"}, + {true, true, true, true, false, true, true, true, true}); auto input = cudf::dictionary::encode(input_s); auto results = cudf::clamp(input->view(), cudf::string_scalar("b"), cudf::string_scalar("c")); auto decoded = cudf::dictionary::decode(results->view()); - cudf::test::strings_column_wrapper expected({"b", "b", "c", "c", "", "c", "c", "b", "b"}, - {1, 1, 1, 1, 0, 1, 1, 1, 1}); + cudf::test::strings_column_wrapper expected( + {"b", "b", "c", "c", "", "c", "c", "b", "b"}, + {true, true, true, true, false, true, true, true, true}); CUDF_TEST_EXPECT_COLUMNS_EQUAL(expected, decoded->view()); } @@ -541,15 +543,17 @@ TEST_F(ClampDictionaryTest, WithNonNullableColumn) TEST_F(ClampDictionaryTest, NullLowHi) { - cudf::test::fixed_width_column_wrapper input_s({200, 100, 0, 300, 300, 400, 100, 200, 0}, - {1, 1, 0, 1, 1, 1, 1, 1, 0}); + cudf::test::fixed_width_column_wrapper input_s( + {200, 100, 0, 300, 300, 400, 100, 200, 0}, + {true, true, false, true, true, true, true, true, false}); auto input = cudf::dictionary::encode(input_s); { auto results = cudf::clamp( input->view(), cudf::numeric_scalar(0, false), cudf::numeric_scalar(300)); auto decoded = cudf::dictionary::decode(results->view()); cudf::test::fixed_width_column_wrapper expected( - {200, 100, 0, 300, 300, 300, 100, 200, 0}, {1, 1, 0, 1, 1, 1, 1, 1, 0}); + {200, 100, 0, 300, 300, 300, 100, 200, 0}, + {true, true, false, true, true, true, true, true, false}); CUDF_TEST_EXPECT_COLUMNS_EQUAL(expected, decoded->view()); } { @@ -557,7 +561,8 @@ TEST_F(ClampDictionaryTest, NullLowHi) input->view(), cudf::numeric_scalar(200), cudf::numeric_scalar(0, false)); auto decoded = cudf::dictionary::decode(results->view()); cudf::test::fixed_width_column_wrapper expected( - {200, 200, 0, 300, 300, 400, 200, 200, 0}, {1, 1, 0, 1, 1, 1, 1, 1, 0}); + {200, 200, 0, 300, 300, 400, 200, 200, 0}, + {true, true, false, true, true, true, true, true, false}); CUDF_TEST_EXPECT_COLUMNS_EQUAL(expected, decoded->view()); } { @@ -570,8 +575,8 @@ TEST_F(ClampDictionaryTest, NullLowHi) TEST_F(ClampDictionaryTest, WithReplace) { - cudf::test::fixed_width_column_wrapper input_s({1, 2, 3, 4, 0, 4, 3, 2, 1}, - {1, 1, 1, 1, 0, 1, 1, 1, 1}); + cudf::test::fixed_width_column_wrapper input_s( + {1, 2, 3, 4, 0, 4, 3, 2, 1}, {true, true, true, true, false, true, true, true, true}); auto input = cudf::dictionary::encode(input_s); auto results = cudf::clamp(input->view(), @@ -581,8 +586,9 @@ TEST_F(ClampDictionaryTest, WithReplace) cudf::numeric_scalar(3000)); auto decoded = cudf::dictionary::decode(results->view()); - cudf::test::fixed_width_column_wrapper expected({2000, 2, 3, 3000, 0, 3000, 3, 2, 2000}, - {1, 1, 1, 1, 0, 1, 1, 1, 1}); + cudf::test::fixed_width_column_wrapper expected( + {2000, 2, 3, 3000, 0, 3000, 3, 2, 2000}, + {true, true, true, true, false, true, true, true, true}); CUDF_TEST_EXPECT_COLUMNS_EQUAL(expected, decoded->view()); } diff --git a/cpp/tests/replace/replace_nulls_tests.cpp b/cpp/tests/replace/replace_nulls_tests.cpp index fcee27305f2..e79cb82baa6 100644 --- a/cpp/tests/replace/replace_nulls_tests.cpp +++ b/cpp/tests/replace/replace_nulls_tests.cpp @@ -43,8 +43,8 @@ struct ReplaceErrorTest : public cudf::test::BaseFixture {}; // Error: old-values and new-values size mismatch TEST_F(ReplaceErrorTest, SizeMismatch) { - cudf::test::fixed_width_column_wrapper input_column{{7, 5, 6, 3, 1, 2, 8, 4}, - {0, 0, 1, 1, 1, 1, 1, 1}}; + cudf::test::fixed_width_column_wrapper input_column{ + {7, 5, 6, 3, 1, 2, 8, 4}, {false, false, true, true, true, true, true, true}}; cudf::test::fixed_width_column_wrapper values_to_replace_column{{10, 11, 12, 13}}; ASSERT_THROW(cudf::replace_nulls(input_column, values_to_replace_column), cudf::logic_error); @@ -53,8 +53,8 @@ TEST_F(ReplaceErrorTest, SizeMismatch) // Error: column type mismatch TEST_F(ReplaceErrorTest, TypeMismatch) { - cudf::test::fixed_width_column_wrapper input_column{{7, 5, 6, 3, 1, 2, 8, 4}, - {0, 0, 1, 1, 1, 1, 1, 1}}; + cudf::test::fixed_width_column_wrapper input_column{ + {7, 5, 6, 3, 1, 2, 8, 4}, {false, false, true, true, true, true, true, true}}; cudf::test::fixed_width_column_wrapper values_to_replace_column{ {10, 11, 12, 13, 14, 15, 16, 17}}; @@ -64,8 +64,8 @@ TEST_F(ReplaceErrorTest, TypeMismatch) // Error: column type mismatch TEST_F(ReplaceErrorTest, TypeMismatchScalar) { - cudf::test::fixed_width_column_wrapper input_column{{7, 5, 6, 3, 1, 2, 8, 4}, - {0, 0, 1, 1, 1, 1, 1, 1}}; + cudf::test::fixed_width_column_wrapper input_column{ + {7, 5, 6, 3, 1, 2, 8, 4}, {false, false, true, true, true, true, true, true}}; cudf::numeric_scalar replacement(1); EXPECT_THROW(cudf::replace_nulls(input_column, replacement), cudf::data_type_error); @@ -187,7 +187,7 @@ struct ReplaceNullsPolicyStringTest : public cudf::test::BaseFixture {}; TEST_F(ReplaceNullsPolicyStringTest, PrecedingFill) { cudf::test::strings_column_wrapper input({"head", "", "", "mid", "mid", "", "tail"}, - {1, 0, 0, 1, 1, 0, 1}); + {true, false, false, true, true, false, true}); cudf::test::strings_column_wrapper expected({"head", "head", "head", "mid", "mid", "mid", "tail"}, no_nulls()); @@ -200,7 +200,7 @@ TEST_F(ReplaceNullsPolicyStringTest, PrecedingFill) TEST_F(ReplaceNullsPolicyStringTest, FollowingFill) { cudf::test::strings_column_wrapper input({"head", "", "", "mid", "mid", "", "tail"}, - {1, 0, 0, 1, 1, 0, 1}); + {true, false, false, true, true, false, true}); cudf::test::strings_column_wrapper expected({"head", "mid", "mid", "mid", "mid", "tail", "tail"}, no_nulls()); @@ -213,10 +213,10 @@ TEST_F(ReplaceNullsPolicyStringTest, FollowingFill) TEST_F(ReplaceNullsPolicyStringTest, PrecedingFillLeadingNulls) { cudf::test::strings_column_wrapper input({"", "", "", "mid", "mid", "", "tail"}, - {0, 0, 0, 1, 1, 0, 1}); + {false, false, false, true, true, false, true}); cudf::test::strings_column_wrapper expected({"", "", "", "mid", "mid", "mid", "tail"}, - {0, 0, 0, 1, 1, 1, 1}); + {false, false, false, true, true, true, true}); auto result = cudf::replace_nulls(input, cudf::replace_policy::PRECEDING); @@ -226,10 +226,10 @@ TEST_F(ReplaceNullsPolicyStringTest, PrecedingFillLeadingNulls) TEST_F(ReplaceNullsPolicyStringTest, FollowingFillTrailingNulls) { cudf::test::strings_column_wrapper input({"head", "", "", "mid", "mid", "", ""}, - {1, 0, 0, 1, 1, 0, 0}); + {true, false, false, true, true, false, false}); cudf::test::strings_column_wrapper expected({"head", "mid", "mid", "mid", "mid", "", ""}, - {1, 1, 1, 1, 1, 0, 0}); + {true, true, true, true, true, false, false}); auto result = cudf::replace_nulls(input, cudf::replace_policy::FOLLOWING); @@ -627,13 +627,13 @@ struct ReplaceDictionaryTest : public cudf::test::BaseFixture {}; TEST_F(ReplaceDictionaryTest, ReplaceNulls) { cudf::test::strings_column_wrapper input_w({"c", "", "", "a", "d", "d", "", ""}, - {1, 0, 0, 1, 1, 1, 0, 0}); + {true, false, false, true, true, true, false, false}); auto input = cudf::dictionary::encode(input_w); - cudf::test::strings_column_wrapper replacement_w({"c", "c", "", "a", "d", "d", "b", ""}, - {1, 1, 0, 1, 1, 1, 1, 0}); + cudf::test::strings_column_wrapper replacement_w( + {"c", "c", "", "a", "d", "d", "b", ""}, {true, true, false, true, true, true, true, false}); auto replacement = cudf::dictionary::encode(replacement_w); cudf::test::strings_column_wrapper expected_w({"c", "c", "", "a", "d", "d", "b", ""}, - {1, 1, 0, 1, 1, 1, 1, 0}); + {true, true, false, true, true, true, true, false}); auto expected = cudf::dictionary::encode(expected_w); auto result = cudf::replace_nulls(input->view(), replacement->view()); @@ -643,7 +643,7 @@ TEST_F(ReplaceDictionaryTest, ReplaceNulls) TEST_F(ReplaceDictionaryTest, ReplaceNullsWithScalar) { cudf::test::strings_column_wrapper input_w({"c", "", "", "a", "d", "d", "", ""}, - {1, 0, 0, 1, 1, 1, 0, 0}); + {true, false, false, true, true, true, false, false}); auto input = cudf::dictionary::encode(input_w); cudf::test::strings_column_wrapper expected_w({"c", "b", "b", "a", "d", "d", "b", "b"}); auto expected = cudf::dictionary::encode(expected_w); @@ -654,7 +654,7 @@ TEST_F(ReplaceDictionaryTest, ReplaceNullsWithScalar) TEST_F(ReplaceDictionaryTest, ReplaceNullsError) { - cudf::test::fixed_width_column_wrapper input_w({1, 1, 2, 2}, {1, 0, 0, 1}); + cudf::test::fixed_width_column_wrapper input_w({1, 1, 2, 2}, {true, false, false, true}); auto input = cudf::dictionary::encode(input_w); cudf::test::fixed_width_column_wrapper replacement_w({1, 2, 3, 4}); auto replacement = cudf::dictionary::encode(replacement_w); @@ -662,7 +662,7 @@ TEST_F(ReplaceDictionaryTest, ReplaceNullsError) EXPECT_THROW(cudf::replace_nulls(input->view(), replacement->view()), cudf::data_type_error); EXPECT_THROW(cudf::replace_nulls(input->view(), cudf::string_scalar("x")), cudf::data_type_error); - cudf::test::fixed_width_column_wrapper input_one_w({1}, {0}); + cudf::test::fixed_width_column_wrapper input_one_w({1}, {false}); auto input_one = cudf::dictionary::encode(input_one_w); auto dict_input = cudf::dictionary_column_view(input_one->view()); auto dict_repl = cudf::dictionary_column_view(replacement->view()); @@ -693,7 +693,7 @@ struct ReplaceNullsPolicyDictionaryTest : public cudf::test::BaseFixture {}; TEST_F(ReplaceNullsPolicyDictionaryTest, PrecedingFill) { cudf::test::strings_column_wrapper input_w({"head", "", "", "mid1", "mid2", "tail", "", ""}, - {1, 0, 0, 1, 1, 1, 0, 0}); + {true, false, false, true, true, true, false, false}); auto input = cudf::dictionary::encode(input_w); cudf::test::strings_column_wrapper expected_w( @@ -708,7 +708,7 @@ TEST_F(ReplaceNullsPolicyDictionaryTest, PrecedingFill) TEST_F(ReplaceNullsPolicyDictionaryTest, FollowingFill) { cudf::test::strings_column_wrapper input_w({"head", "", "", "mid1", "mid2", "", "", "tail"}, - {1, 0, 0, 1, 1, 0, 0, 1}); + {true, false, false, true, true, false, false, true}); auto input = cudf::dictionary::encode(input_w); cudf::test::strings_column_wrapper expected_w( @@ -723,11 +723,12 @@ TEST_F(ReplaceNullsPolicyDictionaryTest, FollowingFill) TEST_F(ReplaceNullsPolicyDictionaryTest, PrecedingFillLeadingNulls) { cudf::test::strings_column_wrapper input_w({"", "", "", "mid1", "mid2", "", "", "tail"}, - {0, 0, 0, 1, 1, 0, 0, 1}); + {false, false, false, true, true, false, false, true}); auto input = cudf::dictionary::encode(input_w); cudf::test::strings_column_wrapper expected_w( - {"", "", "", "mid1", "mid2", "mid2", "mid2", "tail"}, {0, 0, 0, 1, 1, 1, 1, 1}); + {"", "", "", "mid1", "mid2", "mid2", "mid2", "tail"}, + {false, false, false, true, true, true, true, true}); auto expected = cudf::dictionary::encode(expected_w); auto result = cudf::replace_nulls(*input, cudf::replace_policy::PRECEDING); @@ -738,11 +739,12 @@ TEST_F(ReplaceNullsPolicyDictionaryTest, PrecedingFillLeadingNulls) TEST_F(ReplaceNullsPolicyDictionaryTest, FollowingFillTrailingNulls) { cudf::test::strings_column_wrapper input_w({"head", "", "", "mid", "tail", "", "", ""}, - {1, 0, 0, 1, 1, 0, 0, 0}); + {true, false, false, true, true, false, false, false}); auto input = cudf::dictionary::encode(input_w); - cudf::test::strings_column_wrapper expected_w({"head", "mid", "mid", "mid", "tail", "", "", ""}, - {1, 1, 1, 1, 1, 0, 0, 0}); + cudf::test::strings_column_wrapper expected_w( + {"head", "mid", "mid", "mid", "tail", "", "", ""}, + {true, true, true, true, true, false, false, false}); auto expected = cudf::dictionary::encode(expected_w); auto result = cudf::replace_nulls(*input, cudf::replace_policy::FOLLOWING); diff --git a/cpp/tests/replace/replace_tests.cpp b/cpp/tests/replace/replace_tests.cpp index 1858cd7782e..6012109ac35 100644 --- a/cpp/tests/replace/replace_tests.cpp +++ b/cpp/tests/replace/replace_tests.cpp @@ -71,8 +71,8 @@ TEST_F(ReplaceErrorTest, TypeMismatch) TEST_F(ReplaceErrorTest, NullInOldValues) { cudf::test::fixed_width_column_wrapper input_column{{7, 5, 6, 3, 1, 2, 8, 4}}; - cudf::test::fixed_width_column_wrapper values_to_replace_column{{10, 11, 12, 13}, - {0, 1, 0, 1}}; + cudf::test::fixed_width_column_wrapper values_to_replace_column{ + {10, 11, 12, 13}, {false, true, false, true}}; cudf::test::fixed_width_column_wrapper replacement_values_column{{15, 16, 17, 18}}; EXPECT_THROW( @@ -591,19 +591,19 @@ TEST_F(ReplaceDictionaryTest, StringsKeys) TEST_F(ReplaceDictionaryTest, InputAndReplacementNulls) { - cudf::test::fixed_width_column_wrapper input_w({1, 2, 1, 2, 0, 3, 4, 4, 3}, - {1, 1, 1, 1, 0, 1, 1, 1, 1}); + cudf::test::fixed_width_column_wrapper input_w( + {1, 2, 1, 2, 0, 3, 4, 4, 3}, {true, true, true, true, false, true, true, true, true}); auto input = cudf::dictionary::encode(input_w); cudf::test::fixed_width_column_wrapper values_to_replace_w({2, 3}); auto values_to_replace = cudf::dictionary::encode(values_to_replace_w); - cudf::test::fixed_width_column_wrapper replacements_w({5, 0}, {1, 0}); + cudf::test::fixed_width_column_wrapper replacements_w({5, 0}, {true, false}); auto replacements = cudf::dictionary::encode(replacements_w); auto result = cudf::find_and_replace_all(input->view(), values_to_replace->view(), replacements->view()); auto decoded = cudf::dictionary::decode(result->view()); - cudf::test::fixed_width_column_wrapper expected({1, 5, 1, 5, 0, 0, 4, 4, 0}, - {1, 1, 1, 1, 0, 0, 1, 1, 0}); + cudf::test::fixed_width_column_wrapper expected( + {1, 5, 1, 5, 0, 0, 4, 4, 0}, {true, true, true, true, false, false, true, true, false}); CUDF_TEST_EXPECT_COLUMNS_EQUAL(*decoded, expected); } @@ -611,7 +611,8 @@ TEST_F(ReplaceDictionaryTest, InputAndReplacementNulls) TEST_F(ReplaceDictionaryTest, EmptyReplacement) { cudf::test::fixed_width_column_wrapper input_w( - {1.0, 2.0, 1.0, 2.0, 0.0, 3.0, 4.0, 4.0, 3.0}, {1, 1, 1, 1, 0, 1, 1, 1, 1}); + {1.0, 2.0, 1.0, 2.0, 0.0, 3.0, 4.0, 4.0, 3.0}, + {true, true, true, true, false, true, true, true, true}); auto input = cudf::dictionary::encode(input_w); cudf::test::fixed_width_column_wrapper empty_w({}); auto empty = cudf::dictionary::encode(empty_w); diff --git a/cpp/tests/reshape/interleave_columns_tests.cpp b/cpp/tests/reshape/interleave_columns_tests.cpp index de155c35a5e..098161ae006 100644 --- a/cpp/tests/reshape/interleave_columns_tests.cpp +++ b/cpp/tests/reshape/interleave_columns_tests.cpp @@ -177,7 +177,7 @@ TYPED_TEST(InterleaveColumnsTest, MismatchedDtypes) using T = TypeParam; if (not std::is_same_v and not cudf::is_fixed_point()) { - cudf::test::fixed_width_column_wrapper input_a({1, 4, 7}, {1, 0, 1}); + cudf::test::fixed_width_column_wrapper input_a({1, 4, 7}, {true, false, true}); cudf::test::fixed_width_column_wrapper input_b({2, 5, 8}, {0, 1, 0}); cudf::table_view input(std::vector{input_a, input_b}); diff --git a/cpp/tests/rolling/rolling_test.cpp b/cpp/tests/rolling/rolling_test.cpp index c2c22986975..d010717fe02 100644 --- a/cpp/tests/rolling/rolling_test.cpp +++ b/cpp/tests/rolling/rolling_test.cpp @@ -53,12 +53,12 @@ TEST_F(RollingStringTest, NoNullStringMinMaxCount) std::vector window{2}; cudf::test::strings_column_wrapper expected_min( {"This", "This", "being", "being", "being", "being", "column", "column", "column"}, - {1, 1, 1, 1, 1, 1, 1, 1, 1}); + {true, true, true, true, true, true, true, true, true}); cudf::test::strings_column_wrapper expected_max( {"rolling", "test", "test", "test", "test", "string", "string", "string", "string"}, - {1, 1, 1, 1, 1, 1, 1, 1, 1}); + {true, true, true, true, true, true, true, true, true}); cudf::test::fixed_width_column_wrapper expected_count( - {3, 4, 4, 4, 4, 4, 4, 3, 2}, {1, 1, 1, 1, 1, 1, 1, 1, 1}); + {3, 4, 4, 4, 4, 4, 4, 3, 2}, {true, true, true, true, true, true, true, true, true}); auto got_min = cudf::rolling_window( input, window[0], window[0], 1, *cudf::make_min_aggregation()); @@ -83,18 +83,18 @@ TEST_F(RollingStringTest, NullStringMinMaxCount) { cudf::test::strings_column_wrapper input( {"This", "is", "rolling", "test", "being", "operated", "on", "string", "column"}, - {1, 0, 0, 1, 0, 1, 1, 1, 0}); + {true, false, false, true, false, true, true, true, false}); std::vector window{2}; cudf::test::strings_column_wrapper expected_min( {"This", "This", "test", "operated", "on", "on", "on", "on", "string"}, - {1, 1, 1, 1, 1, 1, 1, 1, 1}); + {true, true, true, true, true, true, true, true, true}); cudf::test::strings_column_wrapper expected_max( {"This", "test", "test", "test", "test", "string", "string", "string", "string"}, - {1, 1, 1, 1, 1, 1, 1, 1, 1}); + {true, true, true, true, true, true, true, true, true}); cudf::test::fixed_width_column_wrapper expected_count_val( - {1, 2, 1, 2, 3, 3, 3, 2, 1}, {1, 1, 1, 1, 1, 1, 1, 1, 1}); + {1, 2, 1, 2, 3, 3, 3, 2, 1}, {true, true, true, true, true, true, true, true, true}); cudf::test::fixed_width_column_wrapper expected_count_all( - {3, 4, 4, 4, 4, 4, 4, 3, 2}, {1, 1, 1, 1, 1, 1, 1, 1, 1}); + {3, 4, 4, 4, 4, 4, 4, 3, 2}, {true, true, true, true, true, true, true, true, true}); auto got_min = cudf::rolling_window( input, window[0], window[0], 1, *cudf::make_min_aggregation()); @@ -119,18 +119,18 @@ TEST_F(RollingStringTest, MinPeriods) { cudf::test::strings_column_wrapper input( {"This", "is", "rolling", "test", "being", "operated", "on", "string", "column"}, - {1, 0, 0, 1, 0, 1, 1, 1, 0}); + {true, false, false, true, false, true, true, true, false}); std::vector window{2}; cudf::test::strings_column_wrapper expected_min( {"This", "This", "This", "operated", "on", "on", "on", "on", "on"}, - {0, 0, 0, 0, 1, 1, 1, 0, 0}); + {false, false, false, false, true, true, true, false, false}); cudf::test::strings_column_wrapper expected_max( {"This", "test", "test", "test", "test", "string", "string", "string", "string"}, - {0, 0, 0, 0, 1, 1, 1, 0, 0}); + {false, false, false, false, true, true, true, false, false}); cudf::test::fixed_width_column_wrapper expected_count_val( - {1, 2, 1, 2, 3, 3, 3, 2, 2}, {1, 1, 1, 1, 1, 1, 1, 1, 0}); + {1, 2, 1, 2, 3, 3, 3, 2, 2}, {true, true, true, true, true, true, true, true, false}); cudf::test::fixed_width_column_wrapper expected_count_all( - {3, 4, 4, 4, 4, 4, 4, 3, 2}, {0, 1, 1, 1, 1, 1, 1, 0, 0}); + {3, 4, 4, 4, 4, 4, 4, 3, 2}, {false, true, true, true, true, true, true, false, false}); auto got_min = cudf::rolling_window( input, window[0], window[0], 3, *cudf::make_min_aggregation()); @@ -541,7 +541,7 @@ class RollingTest : public cudf::test::BaseFixture { agg_op op; for (cudf::size_type i = 0; i < num_rows; i++) { - OutputType val = agg_op::template identity(); + auto val = agg_op::template identity(); // load sizes min_periods = std::max(min_periods, 1); // at least one observation is required @@ -645,7 +645,7 @@ class RollingErrorTest : public cudf::test::BaseFixture {}; TEST_F(RollingErrorTest, NegativeMinPeriods) { const std::vector col_data = {0, 1, 2, 0, 4}; - const std::vector col_valid = {1, 1, 1, 0, 1}; + const std::vector col_valid = {true, true, true, false, true}; cudf::test::fixed_width_column_wrapper input( col_data.begin(), col_data.end(), col_valid.begin()); @@ -658,7 +658,7 @@ TEST_F(RollingErrorTest, NegativeMinPeriods) TEST_F(RollingErrorTest, WindowArraySizeMismatch) { const std::vector col_data = {0, 1, 2, 0, 4}; - const std::vector col_valid = {1, 1, 1, 0, 1}; + const std::vector col_valid = {true, true, true, false, true}; cudf::test::fixed_width_column_wrapper input( col_data.begin(), col_data.end(), col_valid.begin()); @@ -835,7 +835,7 @@ TYPED_TEST(RollingTest, SimpleStatic) { // https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.rolling.html auto const col_data = cudf::test::make_type_param_vector({0, 1, 2, 0, 4}); - const std::vector col_mask = {1, 1, 1, 0, 1}; + const std::vector col_mask = {true, true, true, false, true}; cudf::test::fixed_width_column_wrapper input( col_data.begin(), col_data.end(), col_mask.begin()); @@ -857,7 +857,8 @@ TYPED_TEST(RollingVarStdTest, SimpleStaticVarianceStd) auto const col_data = cudf::test::make_type_param_vector({XXX, XXX, 9, 5, XXX, XXX, XXX, 0, 8, 5, 8}); - const std::vector col_mask = {0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1}; + const std::vector col_mask = { + false, false, true, true, false, false, false, true, true, true, true}; auto const expected_var = cudf::is_boolean() @@ -868,17 +869,17 @@ TYPED_TEST(RollingVarStdTest, SimpleStaticVarianceStd) return std::sqrt(x); }); - const std::vector expected_mask = {0, /* all null window */ - 1, /* 0 div 0, nan */ - 1, - 1, - 1, /* 0 div 0, nan */ - 0, /* all null window */ - 1, /* 0 div 0, nan */ - 1, - 1, - 1, - 1}; + const std::vector expected_mask = {false, /* all null window */ + true, /* 0 div 0, nan */ + true, + true, + true, /* 0 div 0, nan */ + false, /* all null window */ + true, /* 0 div 0, nan */ + true, + true, + true, + true}; cudf::test::fixed_width_column_wrapper input( col_data.begin(), col_data.end(), col_mask.begin()); @@ -920,7 +921,7 @@ TEST_F(RollingtVarStdTestUntyped, SimpleStaticVarianceStdInfNaN) auto const col_data = cudf::test::make_type_param_vector({5., 4., XXX, inf, 4., 8., 0., nan, XXX, 5.}); - const std::vector col_mask = {1, 1, 0, 1, 1, 1, 1, 1, 0, 1}; + const std::vector col_mask = {true, true, false, true, true, true, true, true, false, true}; auto const expected_var = std::vector{nan, 0.5, 0.5, nan, nan, nan, 16, nan, nan, nan}; @@ -929,7 +930,8 @@ TEST_F(RollingtVarStdTestUntyped, SimpleStaticVarianceStdInfNaN) return std::sqrt(x); }); - const std::vector expected_mask = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1}; + const std::vector expected_mask = { + true, true, true, true, true, true, true, true, true, true}; cudf::test::fixed_width_column_wrapper input( col_data.begin(), col_data.end(), col_mask.begin()); @@ -982,7 +984,7 @@ TYPED_TEST(RollingTest, SimpleDynamic) { // https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.rolling.html auto const col_data = cudf::test::make_type_param_vector({0, 1, 2, 0, 4}); - const std::vector col_mask = {1, 1, 1, 0, 1}; + const std::vector col_mask = {true, true, true, false, true}; cudf::test::fixed_width_column_wrapper input( col_data.begin(), col_data.end(), col_mask.begin()); @@ -997,7 +999,7 @@ TYPED_TEST(RollingTest, SimpleDynamic) TYPED_TEST(RollingTest, VolatileCount) { auto const col_data = cudf::test::make_type_param_vector({8, 70, 45, 20, 59, 80}); - const std::vector col_mask = {1, 1, 0, 0, 1, 0}; + const std::vector col_mask = {true, true, false, false, true, false}; cudf::test::fixed_width_column_wrapper input( col_data.begin(), col_data.end(), col_mask.begin()); @@ -1014,7 +1016,7 @@ TYPED_TEST(RollingTest, AllInvalid) cudf::size_type num_rows = 1000; std::vector col_data(num_rows); - std::vector col_mask(num_rows, 0); + std::vector col_mask(num_rows, false); cudf::test::fixed_width_column_wrapper input( col_data.begin(), col_data.end(), col_mask.begin()); @@ -1031,7 +1033,7 @@ TYPED_TEST(RollingTest, ZeroWindow) cudf::size_type num_rows = 1000; std::vector col_data(num_rows, 1); - std::vector col_mask(num_rows, 1); + std::vector col_mask(num_rows, true); cudf::test::fixed_width_column_wrapper input( col_data.begin(), col_data.end(), col_mask.begin()); @@ -1048,7 +1050,7 @@ TYPED_TEST(RollingTest, ZeroPeriods) cudf::size_type num_rows = 1000; std::vector col_data(num_rows, 1); - std::vector col_mask(num_rows, 1); + std::vector col_mask(num_rows, true); cudf::test::fixed_width_column_wrapper input( col_data.begin(), col_data.end(), col_mask.begin()); @@ -1067,7 +1069,7 @@ TYPED_TEST(RollingTest, BackwardForwardWindow) cudf::size_type num_rows = 1000; std::vector col_data(num_rows, 1); - std::vector col_mask(num_rows, 1); + std::vector col_mask(num_rows, true); cudf::test::fixed_width_column_wrapper input( col_data.begin(), col_data.end(), col_mask.begin()); @@ -1177,7 +1179,7 @@ using RollingTestStrings = RollingTest; TEST_F(RollingTestStrings, StringsUnsupportedOperators) { cudf::test::strings_column_wrapper input{{"This", "is", "not", "a", "string", "type"}, - {1, 1, 1, 0, 1, 0}}; + {true, true, true, false, true, false}}; std::vector window{1}; @@ -1400,10 +1402,12 @@ TYPED_TEST(FixedPointTests, MinMaxCountLagLead) auto const expected_max = fp_wrapper{{1729, 1729, 1729, 55, 3, 2}, {1, 1, 1, 1, 1, 1}, scale}; auto const expected_lag = fp_wrapper{{0, 42, 1729, 55, 3, 1}, {0, 1, 1, 1, 1, 1}, scale}; auto const expected_lead = fp_wrapper{{1729, 55, 3, 1, 2, 0}, {1, 1, 1, 1, 1, 0}, scale}; - auto const expected_count_val = fw_wrapper{{2, 3, 3, 3, 3, 2}, {1, 1, 1, 1, 1, 1}}; - auto const expected_count_all = fw_wrapper{{2, 3, 3, 3, 3, 2}, {1, 1, 1, 1, 1, 1}}; - auto const expected_rowno = fw_wrapper{{1, 2, 2, 2, 2, 2}, {1, 1, 1, 1, 1, 1}}; - auto const expected_rowno1 = fw_wrapper{{1, 1, 1, 1, 1, 1}, {1, 1, 1, 1, 1, 1}}; + auto const expected_count_val = + fw_wrapper{{2, 3, 3, 3, 3, 2}, {true, true, true, true, true, true}}; + auto const expected_count_all = + fw_wrapper{{2, 3, 3, 3, 3, 2}, {true, true, true, true, true, true}}; + auto const expected_rowno = fw_wrapper{{1, 2, 2, 2, 2, 2}, {true, true, true, true, true, true}}; + auto const expected_rowno1 = fw_wrapper{{1, 1, 1, 1, 1, 1}, {true, true, true, true, true, true}}; auto const min = cudf::rolling_window(input, 2, 1, 1, *cudf::make_min_aggregation()); @@ -1447,16 +1451,18 @@ TYPED_TEST(FixedPointTests, MinMaxCountLagLeadNulls) using fp_wrapper = cudf::test::fixed_point_column_wrapper; using fw_wrapper = cudf::test::fixed_width_column_wrapper; - auto const scale = numeric::scale_type{-1}; - auto const input = fp_wrapper{{42, 1729, 55, 343, 1, 2}, {1, 0, 1, 0, 1, 1}, scale}; - auto const expected_sum = fp_wrapper{{42, 97, 55, 56, 3, 3}, {1, 1, 1, 1, 1, 1}, scale}; - auto const expected_min = fp_wrapper{{42, 42, 55, 1, 1, 1}, {1, 1, 1, 1, 1, 1}, scale}; - auto const expected_max = fp_wrapper{{42, 55, 55, 55, 2, 2}, {1, 1, 1, 1, 1, 1}, scale}; - auto const expected_lag = fp_wrapper{{0, 42, 1729, 55, 343, 1}, {0, 1, 0, 1, 0, 1}, scale}; - auto const expected_lead = fp_wrapper{{1729, 55, 343, 1, 2, 0}, {0, 1, 0, 1, 1, 0}, scale}; - auto const expected_count_val = fw_wrapper{{1, 2, 1, 2, 2, 2}, {1, 1, 1, 1, 1, 1}}; - auto const expected_count_all = fw_wrapper{{2, 3, 3, 3, 3, 2}, {1, 1, 1, 1, 1, 1}}; - auto const expected_rowno = fw_wrapper{{1, 2, 2, 2, 2, 2}, {1, 1, 1, 1, 1, 1}}; + auto const scale = numeric::scale_type{-1}; + auto const input = fp_wrapper{{42, 1729, 55, 343, 1, 2}, {1, 0, 1, 0, 1, 1}, scale}; + auto const expected_sum = fp_wrapper{{42, 97, 55, 56, 3, 3}, {1, 1, 1, 1, 1, 1}, scale}; + auto const expected_min = fp_wrapper{{42, 42, 55, 1, 1, 1}, {1, 1, 1, 1, 1, 1}, scale}; + auto const expected_max = fp_wrapper{{42, 55, 55, 55, 2, 2}, {1, 1, 1, 1, 1, 1}, scale}; + auto const expected_lag = fp_wrapper{{0, 42, 1729, 55, 343, 1}, {0, 1, 0, 1, 0, 1}, scale}; + auto const expected_lead = fp_wrapper{{1729, 55, 343, 1, 2, 0}, {0, 1, 0, 1, 1, 0}, scale}; + auto const expected_count_val = + fw_wrapper{{1, 2, 1, 2, 2, 2}, {true, true, true, true, true, true}}; + auto const expected_count_all = + fw_wrapper{{2, 3, 3, 3, 3, 2}, {true, true, true, true, true, true}}; + auto const expected_rowno = fw_wrapper{{1, 2, 2, 2, 2, 2}, {true, true, true, true, true, true}}; auto const sum = cudf::rolling_window(input, 2, 1, 1, *cudf::make_sum_aggregation()); @@ -1503,7 +1509,7 @@ TYPED_TEST(FixedPointTests, VarStd) // The variance of `input` given `scale` == 0 std::vector result_base_v{ nan, inf, 1882804.66666666667, 1928018.666666666667, 1874.6666666666667, 2.0}; - std::vector result_mask_v{1, 1, 1, 1, 1, 1}; + std::vector result_mask_v{true, true, true, true, true, true}; // var tests for (int32_t s = -2; s <= 2; s++) { @@ -1558,13 +1564,13 @@ TEST_F(RollingDictionaryTest, Count) { cudf::test::dictionary_column_wrapper input( {"This", "is", "rolling", "test", "being", "operated", "on", "string", "column"}, - {1, 0, 0, 1, 0, 1, 1, 1, 0}); + {true, false, false, true, false, true, true, true, false}); cudf::test::fixed_width_column_wrapper expected_count_val( - {1, 2, 1, 2, 3, 3, 3, 2, 1}, {1, 1, 1, 1, 1, 1, 1, 1, 1}); + {1, 2, 1, 2, 3, 3, 3, 2, 1}, {true, true, true, true, true, true, true, true, true}); cudf::test::fixed_width_column_wrapper expected_count_all( - {3, 4, 4, 4, 4, 4, 4, 3, 2}, {1, 1, 1, 1, 1, 1, 1, 1, 1}); + {3, 4, 4, 4, 4, 4, 4, 3, 2}, {true, true, true, true, true, true, true, true, true}); cudf::test::fixed_width_column_wrapper expected_row_number( - {1, 2, 2, 2, 2, 2, 2, 2, 2}, {1, 1, 1, 1, 1, 1, 1, 1, 1}); + {1, 2, 2, 2, 2, 2, 2, 2, 2}, {true, true, true, true, true, true, true, true, true}); auto got_count_valid = cudf::rolling_window( input, 2, 2, 1, *cudf::make_count_aggregation()); @@ -1586,13 +1592,13 @@ TEST_F(RollingDictionaryTest, MinMax) { cudf::test::dictionary_column_wrapper input( {"This", "is", "rolling", "test", "being", "operated", "on", "string", "column"}, - {1, 0, 0, 1, 0, 1, 1, 1, 0}); + {true, false, false, true, false, true, true, true, false}); cudf::test::strings_column_wrapper expected_min( {"This", "This", "test", "operated", "on", "on", "on", "on", "string"}, - {1, 1, 1, 1, 1, 1, 1, 1, 1}); + {true, true, true, true, true, true, true, true, true}); cudf::test::strings_column_wrapper expected_max( {"This", "test", "test", "test", "test", "string", "string", "string", "string"}, - {1, 1, 1, 1, 1, 1, 1, 1, 1}); + {true, true, true, true, true, true, true, true, true}); auto got_min_dict = cudf::rolling_window(input, 2, 2, 1, *cudf::make_min_aggregation()); @@ -1610,11 +1616,13 @@ TEST_F(RollingDictionaryTest, LeadLag) { cudf::test::dictionary_column_wrapper input( {"This", "is", "rolling", "test", "being", "operated", "on", "string", "column"}, - {1, 0, 0, 1, 0, 1, 1, 1, 0}); + {true, false, false, true, false, true, true, true, false}); cudf::test::strings_column_wrapper expected_lead( - {"", "", "test", "", "operated", "on", "string", "", ""}, {0, 0, 1, 0, 1, 1, 1, 0, 0}); + {"", "", "test", "", "operated", "on", "string", "", ""}, + {false, false, true, false, true, true, true, false, false}); cudf::test::strings_column_wrapper expected_lag( - {"", "This", "", "", "test", "", "operated", "on", "string"}, {0, 1, 0, 0, 1, 0, 1, 1, 1}); + {"", "This", "", "", "test", "", "operated", "on", "string"}, + {false, true, false, false, true, false, true, true, true}); auto got_lead_dict = cudf::rolling_window( input, 2, 1, 1, *cudf::make_lead_aggregation(1)); diff --git a/cpp/tests/search/search_test.cpp b/cpp/tests/search/search_test.cpp index 7550cc27161..f11b9ccfd4e 100644 --- a/cpp/tests/search/search_test.cpp +++ b/cpp/tests/search/search_test.cpp @@ -145,9 +145,10 @@ TEST_F(SearchTest, nullable_column__find_last__nulls_as_smallest) using element_type = int64_t; fixed_width_column_wrapper column{{10, 60, 10, 20, 30, 40, 50}, - {0, 0, 1, 1, 1, 1, 1}}; - fixed_width_column_wrapper values{{8, 8, 10, 11, 30, 32, 40, 47, 50, 90}, - {0, 1, 1, 1, 1, 1, 1, 1, 1, 1}}; + {false, false, true, true, true, true, true}}; + fixed_width_column_wrapper values{ + {8, 8, 10, 11, 30, 32, 40, 47, 50, 90}, + {false, true, true, true, true, true, true, true, true, true}}; fixed_width_column_wrapper expect{2, 2, 3, 3, 5, 5, 6, 6, 7, 7}; @@ -166,9 +167,10 @@ TEST_F(SearchTest, nullable_column__find_first__nulls_as_smallest) using element_type = int64_t; fixed_width_column_wrapper column{{10, 60, 10, 20, 30, 40, 50}, - {0, 0, 1, 1, 1, 1, 1}}; - fixed_width_column_wrapper values{{8, 8, 10, 11, 30, 32, 40, 47, 50, 90}, - {0, 1, 1, 1, 1, 1, 1, 1, 1, 1}}; + {false, false, true, true, true, true, true}}; + fixed_width_column_wrapper values{ + {8, 8, 10, 11, 30, 32, 40, 47, 50, 90}, + {false, true, true, true, true, true, true, true, true, true}}; fixed_width_column_wrapper expect{0, 2, 2, 3, 4, 5, 5, 6, 6, 7}; @@ -187,9 +189,10 @@ TEST_F(SearchTest, nullable_column__find_last__nulls_as_largest) using element_type = int64_t; fixed_width_column_wrapper column{{10, 20, 30, 40, 50, 10, 60}, - {1, 1, 1, 1, 1, 0, 0}}; - fixed_width_column_wrapper values{{8, 10, 11, 30, 32, 40, 47, 50, 90, 8}, - {1, 1, 1, 1, 1, 1, 1, 1, 1, 0}}; + {true, true, true, true, true, false, false}}; + fixed_width_column_wrapper values{ + {8, 10, 11, 30, 32, 40, 47, 50, 90, 8}, + {true, true, true, true, true, true, true, true, true, false}}; fixed_width_column_wrapper expect{0, 1, 1, 3, 3, 4, 4, 5, 5, 7}; std::unique_ptr result{}; @@ -207,9 +210,10 @@ TEST_F(SearchTest, nullable_column__find_first__nulls_as_largest) using element_type = int64_t; fixed_width_column_wrapper column{{10, 20, 30, 40, 50, 10, 60}, - {1, 1, 1, 1, 1, 0, 0}}; - fixed_width_column_wrapper values{{8, 10, 11, 30, 32, 40, 47, 50, 90, 8}, - {1, 1, 1, 1, 1, 1, 1, 1, 1, 0}}; + {true, true, true, true, true, false, false}}; + fixed_width_column_wrapper values{ + {8, 10, 11, 30, 32, 40, 47, 50, 90, 8}, + {true, true, true, true, true, true, true, true, true, false}}; fixed_width_column_wrapper expect{0, 0, 1, 2, 3, 3, 4, 4, 5, 5}; std::unique_ptr result{}; @@ -396,16 +400,19 @@ TEST_F(SearchTest, table_partial_desc__find_last) TEST_F(SearchTest, table__find_first__nulls_as_smallest) { - fixed_width_column_wrapper column_0{{30, 10, 10, 20, 20, 20, 20, 20, 20, 20, 50}, - {0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}}; - fixed_width_column_wrapper column_1{{.5, 6.0, 5.0, .5, .5, .5, .5, .7, .7, .7, .7}, - {1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1}}; - fixed_width_column_wrapper column_2{{50, 95, 90, 79, 76, 77, 78, 61, 62, 63, 41}, - {1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1}}; - - fixed_width_column_wrapper values_0{{10, 40, 20}, {1, 0, 1}}; - fixed_width_column_wrapper values_1{{6., .5, .5}, {0, 1, 1}}; - fixed_width_column_wrapper values_2{{95, 50, 77}, {1, 1, 0}}; + fixed_width_column_wrapper column_0{ + {30, 10, 10, 20, 20, 20, 20, 20, 20, 20, 50}, + {false, true, true, true, true, true, true, true, true, true, true}}; + fixed_width_column_wrapper column_1{ + {.5, 6.0, 5.0, .5, .5, .5, .5, .7, .7, .7, .7}, + {true, false, true, true, true, true, true, true, true, true, true}}; + fixed_width_column_wrapper column_2{ + {50, 95, 90, 79, 76, 77, 78, 61, 62, 63, 41}, + {true, true, true, false, false, true, true, true, true, true, true}}; + + fixed_width_column_wrapper values_0{{10, 40, 20}, {true, false, true}}; + fixed_width_column_wrapper values_1{{6., .5, .5}, {false, true, true}}; + fixed_width_column_wrapper values_2{{95, 50, 77}, {true, true, false}}; fixed_width_column_wrapper expect{1, 0, 3}; @@ -437,16 +444,19 @@ TEST_F(SearchTest, table__find_first__nulls_as_smallest) TEST_F(SearchTest, table__find_last__nulls_as_smallest) { - fixed_width_column_wrapper column_0{{30, 10, 10, 20, 20, 20, 20, 20, 20, 20, 50}, - {0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}}; - fixed_width_column_wrapper column_1{{.5, 6.0, 5.0, .5, .5, .5, .5, .7, .7, .7, .7}, - {1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1}}; - fixed_width_column_wrapper column_2{{50, 90, 95, 79, 76, 77, 78, 61, 62, 63, 41}, - {1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1}}; - - fixed_width_column_wrapper values_0{{10, 40, 20}, {1, 0, 1}}; - fixed_width_column_wrapper values_1{{6., .5, .5}, {0, 1, 1}}; - fixed_width_column_wrapper values_2{{95, 50, 77}, {1, 1, 0}}; + fixed_width_column_wrapper column_0{ + {30, 10, 10, 20, 20, 20, 20, 20, 20, 20, 50}, + {false, true, true, true, true, true, true, true, true, true, true}}; + fixed_width_column_wrapper column_1{ + {.5, 6.0, 5.0, .5, .5, .5, .5, .7, .7, .7, .7}, + {true, false, true, true, true, true, true, true, true, true, true}}; + fixed_width_column_wrapper column_2{ + {50, 90, 95, 79, 76, 77, 78, 61, 62, 63, 41}, + {true, true, true, false, false, true, true, true, true, true, true}}; + + fixed_width_column_wrapper values_0{{10, 40, 20}, {true, false, true}}; + fixed_width_column_wrapper values_1{{6., .5, .5}, {false, true, true}}; + fixed_width_column_wrapper values_2{{95, 50, 77}, {true, true, false}}; fixed_width_column_wrapper expect{2, 1, 5}; @@ -478,16 +488,19 @@ TEST_F(SearchTest, table__find_last__nulls_as_smallest) TEST_F(SearchTest, table__find_first__nulls_as_largest) { - fixed_width_column_wrapper column_0{{10, 10, 20, 20, 20, 20, 20, 20, 20, 50, 30}, - {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0}}; - fixed_width_column_wrapper column_1{{5.0, 6.0, .5, .5, .5, .5, .7, .7, .7, .7, .5}, - {1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1}}; - fixed_width_column_wrapper column_2{{90, 95, 77, 78, 79, 76, 61, 62, 63, 41, 50}, - {1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1}}; - - fixed_width_column_wrapper values_0{{10, 40, 20}, {1, 0, 1}}; - fixed_width_column_wrapper values_1{{6., .5, .5}, {0, 1, 1}}; - fixed_width_column_wrapper values_2{{95, 50, 77}, {1, 1, 0}}; + fixed_width_column_wrapper column_0{ + {10, 10, 20, 20, 20, 20, 20, 20, 20, 50, 30}, + {true, true, true, true, true, true, true, true, true, true, false}}; + fixed_width_column_wrapper column_1{ + {5.0, 6.0, .5, .5, .5, .5, .7, .7, .7, .7, .5}, + {true, false, true, true, true, true, true, true, true, true, true}}; + fixed_width_column_wrapper column_2{ + {90, 95, 77, 78, 79, 76, 61, 62, 63, 41, 50}, + {true, true, true, true, false, false, true, true, true, true, true}}; + + fixed_width_column_wrapper values_0{{10, 40, 20}, {true, false, true}}; + fixed_width_column_wrapper values_1{{6., .5, .5}, {false, true, true}}; + fixed_width_column_wrapper values_2{{95, 50, 77}, {true, true, false}}; fixed_width_column_wrapper expect{1, 10, 4}; @@ -519,16 +532,19 @@ TEST_F(SearchTest, table__find_first__nulls_as_largest) TEST_F(SearchTest, table__find_last__nulls_as_largest) { - fixed_width_column_wrapper column_0{{10, 10, 20, 20, 20, 20, 20, 20, 20, 50, 30}, - {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0}}; - fixed_width_column_wrapper column_1{{5.0, 6.0, .5, .5, .5, .5, .7, .7, .7, .7, .5}, - {1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1}}; - fixed_width_column_wrapper column_2{{90, 95, 77, 78, 79, 76, 61, 62, 63, 41, 50}, - {1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1}}; - - fixed_width_column_wrapper values_0{{10, 40, 20}, {1, 0, 1}}; - fixed_width_column_wrapper values_1{{6., .5, .5}, {0, 1, 1}}; - fixed_width_column_wrapper values_2{{95, 50, 77}, {1, 1, 0}}; + fixed_width_column_wrapper column_0{ + {10, 10, 20, 20, 20, 20, 20, 20, 20, 50, 30}, + {true, true, true, true, true, true, true, true, true, true, false}}; + fixed_width_column_wrapper column_1{ + {5.0, 6.0, .5, .5, .5, .5, .7, .7, .7, .7, .5}, + {true, false, true, true, true, true, true, true, true, true, true}}; + fixed_width_column_wrapper column_2{ + {90, 95, 77, 78, 79, 76, 61, 62, 63, 41, 50}, + {true, true, true, true, false, false, true, true, true, true, true}}; + + fixed_width_column_wrapper values_0{{10, 40, 20}, {true, false, true}}; + fixed_width_column_wrapper values_1{{6., .5, .5}, {false, true, true}}; + fixed_width_column_wrapper values_2{{95, 50, 77}, {true, true, false}}; fixed_width_column_wrapper expect{2, 11, 6}; @@ -621,7 +637,7 @@ TEST_F(SearchTest, contains_nullable_column_true) bool expect = true; fixed_width_column_wrapper column{{0, 1, 17, 19, 23, 29, 71}, - {0, 0, 1, 1, 1, 1, 1}}; + {false, false, true, true, true, true, true}}; numeric_scalar scalar{23}; result = cudf::contains(column, scalar); @@ -636,7 +652,7 @@ TEST_F(SearchTest, contains_nullable_column_false) bool expect = false; fixed_width_column_wrapper column{{0, 1, 17, 19, 23, 29, 71}, - {0, 0, 1, 1, 0, 1, 1}}; + {false, false, true, true, false, true, true}}; numeric_scalar scalar{23}; result = cudf::contains(column, scalar); @@ -915,9 +931,9 @@ TEST_F(SearchTest, nullable_column__find_last__nulls_as_largest_string) TEST_F(SearchTest, non_null_column__nullable_values__find_last__nulls_as_largest_string) { cudf::test::strings_column_wrapper column({"N", "N", "N", "N", "Y", "Y", "Y", "Y"}, - {1, 1, 1, 1, 1, 1, 1, 1}); + {true, true, true, true, true, true, true, true}); - cudf::test::strings_column_wrapper values({"Y", "Z", "N"}, {1, 0, 1}); + cudf::test::strings_column_wrapper values({"Y", "Z", "N"}, {true, false, true}); fixed_width_column_wrapper expect{8, 8, 4}; @@ -1248,10 +1264,11 @@ TEST_F(SearchTest, table__find_first__nulls_as_smallest_string) std::vector h_val_0_strings{"10", nullptr, "20"}; std::vector h_val_2_strings{"95", "50", nullptr}; - fixed_width_column_wrapper column_1{{.5, 6.0, 5.0, .5, .5, .5, .5, .7, .7, .7, .7}, - {1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1}}; + fixed_width_column_wrapper column_1{ + {.5, 6.0, 5.0, .5, .5, .5, .5, .7, .7, .7, .7}, + {true, false, true, true, true, true, true, true, true, true, true}}; - fixed_width_column_wrapper values_1{{6., .5, .5}, {0, 1, 1}}; + fixed_width_column_wrapper values_1{{6., .5, .5}, {false, true, true}}; fixed_width_column_wrapper expect{1, 0, 3}; @@ -1315,10 +1332,11 @@ TEST_F(SearchTest, table__find_last__nulls_as_smallest_string) std::vector h_val_0_strings{"10", nullptr, "20"}; std::vector h_val_2_strings{"95", "50", nullptr}; - fixed_width_column_wrapper column_1{{.5, 6.0, 5.0, .5, .5, .5, .5, .7, .7, .7, .7}, - {1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1}}; + fixed_width_column_wrapper column_1{ + {.5, 6.0, 5.0, .5, .5, .5, .5, .7, .7, .7, .7}, + {true, false, true, true, true, true, true, true, true, true, true}}; - fixed_width_column_wrapper values_1{{6., .5, .5}, {0, 1, 1}}; + fixed_width_column_wrapper values_1{{6., .5, .5}, {false, true, true}}; fixed_width_column_wrapper expect{2, 1, 5}; @@ -1382,10 +1400,11 @@ TEST_F(SearchTest, table__find_first__nulls_as_largest_string) std::vector h_val_0_strings{"10", nullptr, "20"}; std::vector h_val_2_strings{"95", "50", nullptr}; - fixed_width_column_wrapper column_1{{5.0, 6.0, .5, .5, .5, .5, .7, .7, .7, .7, .5}, - {1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1}}; + fixed_width_column_wrapper column_1{ + {5.0, 6.0, .5, .5, .5, .5, .7, .7, .7, .7, .5}, + {true, false, true, true, true, true, true, true, true, true, true}}; - fixed_width_column_wrapper values_1{{6., .5, .5}, {0, 1, 1}}; + fixed_width_column_wrapper values_1{{6., .5, .5}, {false, true, true}}; fixed_width_column_wrapper expect{1, 10, 4}; @@ -1449,10 +1468,11 @@ TEST_F(SearchTest, table__find_last__nulls_as_largest_string) std::vector h_val_0_strings{"10", nullptr, "20"}; std::vector h_val_2_strings{"95", "50", nullptr}; - fixed_width_column_wrapper column_1{{5.0, 6.0, .5, .5, .5, .5, .7, .7, .7, .7, .5}, - {1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1}}; + fixed_width_column_wrapper column_1{ + {5.0, 6.0, .5, .5, .5, .5, .7, .7, .7, .7, .5}, + {true, false, true, true, true, true, true, true, true, true, true}}; - fixed_width_column_wrapper values_1{{6., .5, .5}, {0, 1, 1}}; + fixed_width_column_wrapper values_1{{6., .5, .5}, {false, true, true}}; fixed_width_column_wrapper expect{2, 11, 6}; @@ -1685,10 +1705,10 @@ TEST_F(SearchTest, multi_contains_some_with_nulls) using element_type = int64_t; fixed_width_column_wrapper haystack{{0, 1, 17, 19, 23, 29, 71}, - {1, 1, 0, 1, 1, 1, 1}}; - fixed_width_column_wrapper needles{{17, 19, 23, 72}, {1, 0, 1, 1}}; + {true, true, false, true, true, true, true}}; + fixed_width_column_wrapper needles{{17, 19, 23, 72}, {true, false, true, true}}; - fixed_width_column_wrapper expect{{0, 0, 1, 0}, {1, 0, 1, 1}}; + fixed_width_column_wrapper expect{{0, 0, 1, 0}, {true, false, true, true}}; auto result = cudf::contains(haystack, needles); @@ -1700,10 +1720,10 @@ TEST_F(SearchTest, multi_contains_none_with_nulls) using element_type = int64_t; fixed_width_column_wrapper haystack{{0, 1, 17, 19, 23, 29, 71}, - {1, 1, 0, 1, 1, 1, 1}}; - fixed_width_column_wrapper needles{{17, 19, 24, 72}, {1, 0, 1, 1}}; + {true, true, false, true, true, true, true}}; + fixed_width_column_wrapper needles{{17, 19, 24, 72}, {true, false, true, true}}; - fixed_width_column_wrapper expect{{0, 0, 0, 0}, {1, 0, 1, 1}}; + fixed_width_column_wrapper expect{{0, 0, 0, 0}, {true, false, true, true}}; auto result = cudf::contains(haystack, needles); @@ -1715,7 +1735,7 @@ TEST_F(SearchTest, multi_contains_some_string_with_nulls) std::vector h_haystack_strings{"0", "1", nullptr, "19", "23", "29", "71"}; std::vector h_needles_strings{"17", "23", nullptr, "72"}; - fixed_width_column_wrapper expect{{0, 1, 0, 0}, {1, 1, 0, 1}}; + fixed_width_column_wrapper expect{{0, 1, 0, 0}, {true, true, false, true}}; cudf::test::strings_column_wrapper haystack( h_haystack_strings.begin(), @@ -1739,7 +1759,7 @@ TEST_F(SearchTest, multi_contains_none_string_with_nulls) std::vector h_haystack_strings{"0", "1", nullptr, "19", "23", "29", "71"}; std::vector h_needles_strings{"2", nullptr}; - fixed_width_column_wrapper expect{{0, 0}, {1, 0}}; + fixed_width_column_wrapper expect{{0, 0}, {true, false}}; cudf::test::strings_column_wrapper haystack( h_haystack_strings.begin(), diff --git a/cpp/tests/sort/sort_test.cpp b/cpp/tests/sort/sort_test.cpp index e84275f41ef..e12f2a392fb 100644 --- a/cpp/tests/sort/sort_test.cpp +++ b/cpp/tests/sort/sort_test.cpp @@ -64,7 +64,8 @@ TYPED_TEST(Sort, WithNullMax) using T = TypeParam; cudf::test::fixed_width_column_wrapper col1{{5, 4, 3, 5, 8, 5}, {1, 1, 0, 1, 1, 1}}; - cudf::test::strings_column_wrapper col2({"d", "e", "a", "d", "k", "d"}, {1, 1, 0, 1, 1, 1}); + cudf::test::strings_column_wrapper col2({"d", "e", "a", "d", "k", "d"}, + {true, true, false, true, true, true}); cudf::test::fixed_width_column_wrapper col3{{10, 40, 70, 5, 2, 10}, {1, 1, 0, 1, 1, 1}}; cudf::table_view input{{col1, col2, col3}}; @@ -106,7 +107,8 @@ TYPED_TEST(Sort, WithNullMin) using T = TypeParam; cudf::test::fixed_width_column_wrapper col1{{5, 4, 3, 5, 8}, {1, 1, 0, 1, 1}}; - cudf::test::strings_column_wrapper col2({"d", "e", "a", "d", "k"}, {1, 1, 0, 1, 1}); + cudf::test::strings_column_wrapper col2({"d", "e", "a", "d", "k"}, + {true, true, false, true, true}); cudf::test::fixed_width_column_wrapper col3{{10, 40, 70, 5, 2}, {1, 1, 0, 1, 1}}; cudf::table_view input{{col1, col2, col3}}; @@ -145,7 +147,8 @@ TYPED_TEST(Sort, WithMixedNullOrder) using T = TypeParam; cudf::test::fixed_width_column_wrapper col1{{5, 4, 3, 5, 8}, {0, 0, 1, 1, 0}}; - cudf::test::strings_column_wrapper col2({"d", "e", "a", "d", "k"}, {0, 1, 0, 0, 1}); + cudf::test::strings_column_wrapper col2({"d", "e", "a", "d", "k"}, + {false, true, false, false, true}); cudf::test::fixed_width_column_wrapper col3{{10, 40, 70, 5, 2}, {1, 0, 1, 0, 1}}; cudf::table_view input{{col1, col2, col3}}; @@ -221,7 +224,7 @@ TYPED_TEST(Sort, WithStructColumn) auto ages_col = cudf::test::fixed_width_column_wrapper{{48, 27, 25, 31, 351, 351}}; auto is_human_col = cudf::test::fixed_width_column_wrapper{ - {true, true, false, false, false, false}, {1, 1, 0, 1, 1, 0}}; + {true, true, false, false, false, false}, {true, true, false, true, true, false}}; auto struct_col = cudf::test::structs_column_wrapper{{names_col, ages_col, is_human_col}}.release(); @@ -265,11 +268,11 @@ TYPED_TEST(Sort, WithNestedStructColumn) "Cheery Littlebottom", "Detritus", "Mr Slant"}; - std::vector v{1, 1, 0, 1, 1, 0}; + std::vector v{true, true, false, true, true, false}; auto names_col = cudf::test::strings_column_wrapper{names.begin(), names.end()}; auto ages_col = cudf::test::fixed_width_column_wrapper{{48, 27, 25, 31, 351, 351}}; auto is_human_col = cudf::test::fixed_width_column_wrapper{ - {true, true, false, false, false, false}, {1, 1, 0, 1, 1, 0}}; + {true, true, false, false, false, false}, {true, true, false, true, true, false}}; auto struct_col1 = cudf::test::structs_column_wrapper{{names_col, ages_col, is_human_col}, v}; auto ages_col2 = cudf::test::fixed_width_column_wrapper{{48, 27, 25, 31, 351, 351}}; @@ -339,9 +342,9 @@ TYPED_TEST(Sort, WithNullableStructColumn) auto col_a = fwcw{1, 1, 2, 2, 2, 1, 1, 1, 2}; auto col_b = fwcw{1, 2, 1, 2, 2, 1, 2, 1, 1}; - auto s2_mask = mask{1, 1, 0, 0, 1, 1, 1, 0, 1}; + auto s2_mask = mask{true, true, false, false, true, true, true, false, true}; auto col_c = fwcw{5, 4, 6, 5, 3, 3, 3, 4, 5}; - auto s1_mask = mask{1, 1, 1, 1, 0, 0, 1, 1, 1}; + auto s1_mask = mask{true, true, true, true, false, false, true, true, true}; std::vector> s2_children; s2_children.push_back(col_a.release()); @@ -375,9 +378,9 @@ TYPED_TEST(Sort, WithNullableStructColumn) s1{a}, s2{b}, c */ - auto s1_mask = mask{1, 1, 1, 1, 0, 0, 1, 1, 1}; + auto s1_mask = mask{true, true, true, true, false, false, true, true, true}; auto col_a = fwcw{1, 1, 2, 2, 2, 1, 1, 1, 2}; - auto s2_mask = mask{1, 1, 0, 0, 1, 1, 1, 0, 1}; + auto s2_mask = mask{true, true, false, false, true, true, true, false, true}; auto col_b = fwcw{1, 2, 1, 2, 2, 1, 2, 1, 1}; auto col_c = fwcw{5, 4, 6, 5, 3, 3, 3, 4, 5}; @@ -406,11 +409,11 @@ TYPED_TEST(Sort, WithSingleStructColumn) "Cheery Littlebottom", "Detritus", "Mr Slant"}; - std::vector v{1, 1, 0, 1, 1, 0}; + std::vector v{true, true, false, true, true, false}; auto names_col = cudf::test::strings_column_wrapper{names.begin(), names.end()}; auto ages_col = cudf::test::fixed_width_column_wrapper{{48, 27, 25, 31, 351, 351}}; auto is_human_col = cudf::test::fixed_width_column_wrapper{ - {true, true, false, false, false, false}, {1, 1, 0, 1, 1, 0}}; + {true, true, false, false, false, false}, {true, true, false, true, true, false}}; auto struct_col = cudf::test::structs_column_wrapper{{names_col, ages_col, is_human_col}, v}.release(); auto struct_col_view{struct_col->view()}; @@ -446,7 +449,7 @@ TYPED_TEST(Sort, WithSlicedStructColumn) */ // clang-format off using FWCW = cudf::test::fixed_width_column_wrapper; - std::vector string_valids{ 1, 1, 1, 1, 1, 1, 1, 0}; + std::vector string_valids{ true, true, true, true, true, true, true, false}; std::initializer_list names = {"bbe", "bbe", "aaa", "abc", "ab", "za", "b", "x"}; auto col2 = FWCW{{ 1, 1, 0, 0, 0, 2, 1, 3}}; auto col3 = FWCW{{ 7, 8, 1, 1, 9, 5, 7, 3}}; @@ -510,7 +513,7 @@ TYPED_TEST(Sort, SlicedColumns) using FWCW = cudf::test::fixed_width_column_wrapper; // clang-format off - std::vector string_valids{ 1, 1, 1, 1, 1, 1, 1, 0}; + std::vector string_valids{ true, true, true, true, true, true, true, false}; std::initializer_list names = {"bbe", "bbe", "aaa", "abc", "ab", "za", "b", "x"}; auto col2 = FWCW{{ 7, 8, 1, 1, 9, 5, 7, 3}}; auto col1 = cudf::test::strings_column_wrapper{names.begin(), names.end(), string_valids.begin()}; @@ -559,7 +562,7 @@ TYPED_TEST(Sort, WithStructColumnCombinations) 7 | {null, 0}| +------------+ */ - std::vector struct_valids{1, 1, 0, 1, 0, 1, 1, 1}; + std::vector struct_valids{true, true, false, true, false, true, true, true}; auto col1 = FWCW{{ 0, 1, 9, -1, 9, -1, -1, -1}, {1, 1, 1, 0, 1, 0, 0, 0}}; auto col2 = FWCW{{-1, -1, 9, -1, 9, -1, 1, 0}, {0, 0, 1, 0, 1, 0, 1, 1}}; auto struct_col = cudf::test::structs_column_wrapper{{col1, col2}, struct_valids}.release(); @@ -1050,7 +1053,7 @@ TEST_F(SortCornerTest, WithEmptyStructColumn) using int_col = cudf::test::fixed_width_column_wrapper; // struct{}, int, int - int_col col_for_mask{{0, 0, 0, 0, 0, 0}, {1, 0, 1, 1, 1, 1}}; + int_col col_for_mask{{0, 0, 0, 0, 0, 0}, {true, false, true, true, true, true}}; auto null_mask = cudf::copy_bitmask(col_for_mask); auto struct_col = cudf::make_structs_column( 6, {}, cudf::column_view(col_for_mask).null_count(), std::move(null_mask)); @@ -1079,7 +1082,7 @@ TEST_F(SortCornerTest, WithEmptyStructColumn) CUDF_TEST_EXPECT_COLUMNS_EQUAL(expected2, got2->view()); // struct{struct{}, struct{int}} - int_col col_for_mask2{{0, 0, 0, 0, 0, 0}, {1, 0, 1, 1, 0, 1}}; + int_col col_for_mask2{{0, 0, 0, 0, 0, 0}, {true, false, true, true, false, true}}; auto null_mask2 = cudf::copy_bitmask(col_for_mask2); std::vector> child_columns2; auto child_col_1 = cudf::make_structs_column( diff --git a/cpp/tests/stream_compaction/apply_boolean_mask_tests.cpp b/cpp/tests/stream_compaction/apply_boolean_mask_tests.cpp index 6c0582fb846..5a78468db15 100644 --- a/cpp/tests/stream_compaction/apply_boolean_mask_tests.cpp +++ b/cpp/tests/stream_compaction/apply_boolean_mask_tests.cpp @@ -40,15 +40,18 @@ struct ApplyBooleanMask : public cudf::test::BaseFixture {}; TEST_F(ApplyBooleanMask, NonNullBooleanMask) { cudf::test::fixed_width_column_wrapper col1{{true, false, true, false, true, false}, - {1, 1, 0, 1, 1, 0}}; - cudf::test::fixed_width_column_wrapper col2{{10, 40, 70, 5, 2, 10}, {1, 1, 0, 1, 1, 0}}; - cudf::test::fixed_width_column_wrapper col3{{10, 40, 70, 5, 2, 10}, {1, 1, 0, 1, 1, 0}}; + {true, true, false, true, true, false}}; + cudf::test::fixed_width_column_wrapper col2{{10, 40, 70, 5, 2, 10}, + {true, true, false, true, true, false}}; + cudf::test::fixed_width_column_wrapper col3{{10, 40, 70, 5, 2, 10}, + {true, true, false, true, true, false}}; cudf::table_view input{{col1, col2, col3}}; cudf::test::fixed_width_column_wrapper boolean_mask{ {true, false, true, false, true, false}}; - cudf::test::fixed_width_column_wrapper col1_expected{{true, true, true}, {1, 0, 1}}; - cudf::test::fixed_width_column_wrapper col2_expected{{10, 70, 2}, {1, 0, 1}}; - cudf::test::fixed_width_column_wrapper col3_expected{{10, 70, 2}, {1, 0, 1}}; + cudf::test::fixed_width_column_wrapper col1_expected{{true, true, true}, + {true, false, true}}; + cudf::test::fixed_width_column_wrapper col2_expected{{10, 70, 2}, {true, false, true}}; + cudf::test::fixed_width_column_wrapper col3_expected{{10, 70, 2}, {true, false, true}}; cudf::table_view expected{{col1_expected, col2_expected, col3_expected}}; auto got = cudf::apply_boolean_mask(input, boolean_mask); @@ -59,15 +62,17 @@ TEST_F(ApplyBooleanMask, NonNullBooleanMask) TEST_F(ApplyBooleanMask, NullBooleanMask) { cudf::test::fixed_width_column_wrapper col1{{true, false, true, false, true, false}, - {1, 1, 0, 1, 1, 0}}; - cudf::test::fixed_width_column_wrapper col2{{10, 40, 70, 5, 2, 10}, {1, 1, 0, 1, 1, 0}}; - cudf::test::fixed_width_column_wrapper col3{{10, 40, 70, 5, 2, 10}, {1, 1, 0, 1, 1, 0}}; + {true, true, false, true, true, false}}; + cudf::test::fixed_width_column_wrapper col2{{10, 40, 70, 5, 2, 10}, + {true, true, false, true, true, false}}; + cudf::test::fixed_width_column_wrapper col3{{10, 40, 70, 5, 2, 10}, + {true, true, false, true, true, false}}; cudf::table_view input{{col1, col2, col3}}; cudf::test::fixed_width_column_wrapper boolean_mask{{true, false, true, false, true, false}, - {0, 1, 1, 1, 1, 1}}; - cudf::test::fixed_width_column_wrapper col1_expected{{true, true}, {0, 1}}; - cudf::test::fixed_width_column_wrapper col2_expected{{70, 2}, {0, 1}}; - cudf::test::fixed_width_column_wrapper col3_expected{{70, 2}, {0, 1}}; + {false, true, true, true, true, true}}; + cudf::test::fixed_width_column_wrapper col1_expected{{true, true}, {false, true}}; + cudf::test::fixed_width_column_wrapper col2_expected{{70, 2}, {false, true}}; + cudf::test::fixed_width_column_wrapper col3_expected{{70, 2}, {false, true}}; cudf::table_view expected{{col1_expected, col2_expected, col3_expected}}; auto got = cudf::apply_boolean_mask(input, boolean_mask); @@ -78,9 +83,11 @@ TEST_F(ApplyBooleanMask, NullBooleanMask) TEST_F(ApplyBooleanMask, EmptyMask) { cudf::test::fixed_width_column_wrapper col1{{true, false, true, false, true, false}, - {1, 1, 0, 1, 1, 0}}; - cudf::test::fixed_width_column_wrapper col2{{10, 40, 70, 5, 2, 10}, {1, 1, 0, 1, 1, 0}}; - cudf::test::fixed_width_column_wrapper col3{{10, 40, 70, 5, 2, 10}, {1, 1, 0, 1, 1, 0}}; + {true, true, false, true, true, false}}; + cudf::test::fixed_width_column_wrapper col2{{10, 40, 70, 5, 2, 10}, + {true, true, false, true, true, false}}; + cudf::test::fixed_width_column_wrapper col3{{10, 40, 70, 5, 2, 10}, + {true, true, false, true, true, false}}; cudf::table_view input{{col1, col2, col3}}; cudf::test::fixed_width_column_wrapper boolean_mask{}; cudf::test::fixed_width_column_wrapper col1_expected{}; @@ -96,9 +103,11 @@ TEST_F(ApplyBooleanMask, EmptyMask) TEST_F(ApplyBooleanMask, WrongMaskType) { cudf::test::fixed_width_column_wrapper col1{{true, false, true, false, true, false}, - {1, 1, 0, 1, 1, 0}}; - cudf::test::fixed_width_column_wrapper col2{{10, 40, 70, 5, 2, 10}, {1, 1, 0, 1, 1, 0}}; - cudf::test::fixed_width_column_wrapper col3{{10, 40, 70, 5, 2, 10}, {1, 1, 0, 1, 1, 0}}; + {true, true, false, true, true, false}}; + cudf::test::fixed_width_column_wrapper col2{{10, 40, 70, 5, 2, 10}, + {true, true, false, true, true, false}}; + cudf::test::fixed_width_column_wrapper col3{{10, 40, 70, 5, 2, 10}, + {true, true, false, true, true, false}}; cudf::table_view input{{col1, col2, col3}}; cudf::test::fixed_width_column_wrapper boolean_mask{ {true, false, true, false, true, false}}; @@ -109,9 +118,11 @@ TEST_F(ApplyBooleanMask, WrongMaskType) TEST_F(ApplyBooleanMask, MaskAndInputSizeMismatch) { cudf::test::fixed_width_column_wrapper col1{{true, false, true, false, true, false}, - {1, 1, 0, 1, 1, 0}}; - cudf::test::fixed_width_column_wrapper col2{{10, 40, 70, 5, 2, 10}, {1, 1, 0, 1, 1, 0}}; - cudf::test::fixed_width_column_wrapper col3{{10, 40, 70, 5, 2, 10}, {1, 1, 0, 1, 1, 0}}; + {true, true, false, true, true, false}}; + cudf::test::fixed_width_column_wrapper col2{{10, 40, 70, 5, 2, 10}, + {true, true, false, true, true, false}}; + cudf::test::fixed_width_column_wrapper col3{{10, 40, 70, 5, 2, 10}, + {true, true, false, true, true, false}}; cudf::table_view input{{col1, col2, col3}}; cudf::test::fixed_width_column_wrapper boolean_mask{{true, false, true, false, true}}; @@ -121,12 +132,14 @@ TEST_F(ApplyBooleanMask, MaskAndInputSizeMismatch) TEST_F(ApplyBooleanMask, StringColumnTest) { cudf::test::strings_column_wrapper col1{ - {"This", "is", "the", "a", "k12", "string", "table", "column"}, {1, 1, 1, 1, 1, 0, 1, 1}}; + {"This", "is", "the", "a", "k12", "string", "table", "column"}, + {true, true, true, true, true, false, true, true}}; cudf::table_view input{{col1}}; cudf::test::fixed_width_column_wrapper boolean_mask{ - {true, true, true, true, false, true, false, true}, {1, 1, 0, 1, 1, 1, 1, 1}}; + {true, true, true, true, false, true, false, true}, + {true, true, false, true, true, true, true, true}}; cudf::test::strings_column_wrapper col1_expected{{"This", "is", "a", "string", "column"}, - {1, 1, 1, 0, 1}}; + {true, true, true, false, true}}; cudf::table_view expected{{col1_expected}}; auto got = cudf::apply_boolean_mask(input, boolean_mask); @@ -284,10 +297,11 @@ TEST_F(ApplyBooleanMask, StructFiltering) { using namespace cudf::test; - auto int_member = fixed_width_column_wrapper{{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, - {1, 1, 1, 1, 0, 1, 1, 1, 1, 0}}; + auto int_member = fixed_width_column_wrapper{ + {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, {true, true, true, true, false, true, true, true, true, false}}; - auto struct_column = structs_column_wrapper{{int_member}, {0, 1, 1, 1, 1, 0, 1, 1, 1, 1}}; + auto struct_column = structs_column_wrapper{ + {int_member}, {false, true, true, true, true, false, true, true, true, true}}; auto filter_mask = fixed_width_column_wrapper{{1, 1, 1, 1, 1, 0, 0, 0, 0, 0}}; @@ -296,9 +310,10 @@ TEST_F(ApplyBooleanMask, StructFiltering) // Compare against expected results. auto expected_int_member = - fixed_width_column_wrapper{{-1, 1, 2, 3, -1}, {0, 1, 1, 1, 0}}; + fixed_width_column_wrapper{{-1, 1, 2, 3, -1}, {false, true, true, true, false}}; - auto expected_struct_column = structs_column_wrapper{{expected_int_member}, {1, 1, 1, 1, 0}}; + auto expected_struct_column = + structs_column_wrapper{{expected_int_member}, {true, true, true, true, false}}; CUDF_TEST_EXPECT_COLUMNS_EQUIVALENT(filtered_struct_column, expected_struct_column); } @@ -307,14 +322,15 @@ TEST_F(ApplyBooleanMask, ListOfStructsFiltering) { using namespace cudf::test; - auto key_member = fixed_width_column_wrapper{{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, - {1, 1, 1, 1, 0, 1, 1, 1, 1, 0}}; + auto key_member = fixed_width_column_wrapper{ + {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, {true, true, true, true, false, true, true, true, true, false}}; - auto value_member = fixed_width_column_wrapper{{0, 10, 20, 30, 40, 50, 60, 70, 80, 90}, - {1, 1, 1, 1, 0, 1, 1, 1, 1, 0}}; + auto value_member = fixed_width_column_wrapper{ + {0, 10, 20, 30, 40, 50, 60, 70, 80, 90}, + {true, true, true, true, false, true, true, true, true, false}}; - auto struct_column = - structs_column_wrapper{{key_member, value_member}, {0, 1, 1, 1, 1, 0, 1, 1, 1, 1}}; + auto struct_column = structs_column_wrapper{ + {key_member, value_member}, {false, true, true, true, true, false, true, true, true, true}}; auto list_of_structs_column = cudf::make_lists_column(5, @@ -330,13 +346,13 @@ TEST_F(ApplyBooleanMask, ListOfStructsFiltering) auto filtered_list_column = filtered_table->get_column(0); // Compare against expected values. - auto expected_key_column = - fixed_width_column_wrapper{{0, 1, 4, 5, 8, 9}, {0, 1, 0, 0, 1, 0}}; - auto expected_value_column = - fixed_width_column_wrapper{{0, 10, 40, 50, 80, 90}, {0, 1, 0, 0, 1, 0}}; + auto expected_key_column = fixed_width_column_wrapper{ + {0, 1, 4, 5, 8, 9}, {false, true, false, false, true, false}}; + auto expected_value_column = fixed_width_column_wrapper{ + {0, 10, 40, 50, 80, 90}, {false, true, false, false, true, false}}; - auto expected_struct_column = - structs_column_wrapper{{expected_key_column, expected_value_column}, {0, 1, 1, 0, 1, 1}}; + auto expected_struct_column = structs_column_wrapper{{expected_key_column, expected_value_column}, + {false, true, true, false, true, true}}; auto expected_list_of_structs_column = cudf::make_lists_column(3, diff --git a/cpp/tests/streams/rolling_test.cpp b/cpp/tests/streams/rolling_test.cpp index b352ad2c0d2..b392b311bcd 100644 --- a/cpp/tests/streams/rolling_test.cpp +++ b/cpp/tests/streams/rolling_test.cpp @@ -163,10 +163,11 @@ TEST_F(GroupedTimeRollingTest, FixedSize) auto const grp_col = cudf::test::fixed_width_column_wrapper{0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; auto const agg_col = cudf::test::fixed_width_column_wrapper{ - {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, {1, 1, 1, 1, 1, 0, 1, 1, 1, 1}}; + {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, {true, true, true, true, true, false, true, true, true, true}}; auto const time_col = cudf::test::fixed_width_column_wrapper{ - {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, {0, 0, 0, 0, 1, 1, 1, 1, 1, 1}}; + {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, + {false, false, false, false, true, true, true, true, true, true}}; auto const grouping_keys = cudf::table_view{std::vector{grp_col}}; auto const preceding = 1L; @@ -189,10 +190,11 @@ TEST_F(GroupedTimeRollingTest, WindowBounds) auto const grp_col = cudf::test::fixed_width_column_wrapper{0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; auto const agg_col = cudf::test::fixed_width_column_wrapper{ - {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, {1, 1, 1, 1, 1, 0, 1, 1, 1, 1}}; + {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, {true, true, true, true, true, false, true, true, true, true}}; auto const time_col = cudf::test::fixed_width_column_wrapper{ - {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, {0, 0, 0, 0, 1, 1, 1, 1, 1, 1}}; + {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, + {false, false, false, false, true, true, true, true, true, true}}; auto const grouping_keys = cudf::table_view{std::vector{grp_col}}; auto const unbounded_preceding = cudf::window_bounds::unbounded(); @@ -216,11 +218,12 @@ class GroupedRangeRollingTest : public cudf::test::BaseFixture {}; TEST_F(GroupedRangeRollingTest, RangeWindowBounds) { auto const grp_col = cudf::test::fixed_width_column_wrapper{0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - auto const agg_col = cudf::test::fixed_width_column_wrapper{{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, - {1, 1, 1, 1, 1, 0, 1, 1, 1, 1}}; + auto const agg_col = cudf::test::fixed_width_column_wrapper{ + {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, {true, true, true, true, true, false, true, true, true, true}}; - auto const order_by = cudf::test::fixed_width_column_wrapper{{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, - {0, 0, 0, 0, 1, 1, 1, 1, 1, 1}}; + auto const order_by = cudf::test::fixed_width_column_wrapper{ + {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, + {false, false, false, false, true, true, true, true, true, true}}; cudf::range_window_bounds preceding = cudf::range_window_bounds::get( cudf::numeric_scalar{int{1}, true, cudf::test::get_default_stream()}, diff --git a/cpp/tests/streams/transform_test.cpp b/cpp/tests/streams/transform_test.cpp index cf81dc6fb42..f4fa8991c7c 100644 --- a/cpp/tests/streams/transform_test.cpp +++ b/cpp/tests/streams/transform_test.cpp @@ -112,7 +112,7 @@ TEST_F(TransformTest, ComputeColumn) TEST_F(TransformTest, BoolsToMask) { - std::vector input({1, 0, 1, 0, 1, 0, 1, 0}); + std::vector input({true, false, true, false, true, false, true, false}); cudf::test::fixed_width_column_wrapper input_column(input.begin(), input.end()); cudf::bools_to_mask(input_column, cudf::test::get_default_stream()); } @@ -155,7 +155,7 @@ TEST_F(TransformTest, SegmentedRowBitCount) { // clang-format off std::vector const strings { "daïs", "def", "", "z", "bananas", "warp", "", "zing" }; - std::vector const valids { 1, 0, 0, 1, 0, 1, 1, 1 }; + std::vector const valids { true, false, false, true, false, true, true, true }; // clang-format on cudf::test::strings_column_wrapper const col(strings.begin(), strings.end(), valids.begin()); auto const input = cudf::table_view({col}); diff --git a/cpp/tests/strings/array_tests.cpp b/cpp/tests/strings/array_tests.cpp index 9c0ecaa52c0..2d680fce3bf 100644 --- a/cpp/tests/strings/array_tests.cpp +++ b/cpp/tests/strings/array_tests.cpp @@ -39,9 +39,9 @@ TEST_F(StringsColumnTest, Sort) { // cannot initialize std::string with a nullptr so use "" as a place-holder cudf::test::strings_column_wrapper h_strings({"eee", "bb", "", "", "aa", "bbb", "ééé"}, - {1, 1, 0, 1, 1, 1, 1}); + {true, true, false, true, true, true, true}); cudf::test::strings_column_wrapper h_expected({"", "", "aa", "bb", "bbb", "eee", "ééé"}, - {0, 1, 1, 1, 1, 1, 1}); + {false, true, true, true, true, true, true}); auto results = cudf::sort(cudf::table_view({h_strings}), {cudf::order::ASCENDING}, {cudf::null_order::BEFORE}); @@ -173,7 +173,7 @@ TEST_F(StringsColumnTest, GatherTooBig) TEST_F(StringsColumnTest, Scatter) { cudf::test::strings_column_wrapper target({"eee", "bb", "", "", "aa", "bbb", "ééé"}, - {1, 1, 0, 1, 1, 1, 1}); + {true, true, false, true, true, true, true}); cudf::test::strings_column_wrapper source({"1", "22"}); cudf::test::fixed_width_column_wrapper scatter_map({4, 1}); @@ -181,14 +181,14 @@ TEST_F(StringsColumnTest, Scatter) auto results = cudf::scatter(cudf::table_view({source}), scatter_map, cudf::table_view({target})); cudf::test::strings_column_wrapper expected({"eee", "22", "", "", "1", "bbb", "ééé"}, - {1, 1, 0, 1, 1, 1, 1}); + {true, true, false, true, true, true, true}); CUDF_TEST_EXPECT_COLUMNS_EQUAL(results->view().column(0), expected); } TEST_F(StringsColumnTest, ScatterScalar) { cudf::test::strings_column_wrapper target({"eee", "bb", "", "", "aa", "bbb", "ééé"}, - {1, 1, 0, 1, 1, 1, 1}); + {true, true, false, true, true, true, true}); cudf::test::fixed_width_column_wrapper scatter_map({0, 5}); @@ -197,7 +197,7 @@ TEST_F(StringsColumnTest, ScatterScalar) auto results = cudf::scatter(source, scatter_map, cudf::table_view({target})); cudf::test::strings_column_wrapper expected({"__", "bb", "", "", "aa", "__", "ééé"}, - {1, 1, 0, 1, 1, 1, 1}); + {true, true, false, true, true, true, true}); CUDF_TEST_EXPECT_COLUMNS_EQUAL(results->view().column(0), expected); } diff --git a/cpp/tests/strings/extract_tests.cpp b/cpp/tests/strings/extract_tests.cpp index 61246fb098d..5daa8938f3e 100644 --- a/cpp/tests/strings/extract_tests.cpp +++ b/cpp/tests/strings/extract_tests.cpp @@ -215,27 +215,28 @@ TEST_F(StringsExtractTests, SpecialNewLines) auto prog = cudf::strings::regex_program::create("(^zzé$)", cudf::strings::regex_flags::EXT_NEWLINE); - auto results = cudf::strings::extract(view, *prog); - auto expected = - cudf::test::strings_column_wrapper({"", "", "zzé", "", "zzé", ""}, {0, 0, 1, 0, 1, 0}); + auto results = cudf::strings::extract(view, *prog); + auto expected = cudf::test::strings_column_wrapper({"", "", "zzé", "", "zzé", ""}, + {false, false, true, false, true, false}); CUDF_TEST_EXPECT_COLUMNS_EQUAL(results->view().column(0), expected); auto both_flags = static_cast( cudf::strings::regex_flags::EXT_NEWLINE | cudf::strings::regex_flags::MULTILINE); auto prog_ml = cudf::strings::regex_program::create("^(zzé)$", both_flags); results = cudf::strings::extract(view, *prog_ml); - expected = - cudf::test::strings_column_wrapper({"zzé", "zzé", "zzé", "", "zzé", "zzé"}, {1, 1, 1, 0, 1, 1}); + expected = cudf::test::strings_column_wrapper({"zzé", "zzé", "zzé", "", "zzé", "zzé"}, + {true, true, true, false, true, true}); CUDF_TEST_EXPECT_COLUMNS_EQUAL(results->view().column(0), expected); prog = cudf::strings::regex_program::create("q(q.*l)l"); expected = cudf::test::strings_column_wrapper({"", "qq" LINE_SEPARATOR "zzé\rll", "", "", "", ""}, - {0, 1, 0, 0, 0, 0}); + {false, true, false, false, false, false}); results = cudf::strings::extract(view, *prog); CUDF_TEST_EXPECT_COLUMNS_EQUAL(results->view().column(0), expected); // expect no matches here since the newline(s) interrupts the pattern prog = cudf::strings::regex_program::create("q(q.*l)l", cudf::strings::regex_flags::EXT_NEWLINE); - expected = cudf::test::strings_column_wrapper({"", "", "", "", "", ""}, {0, 0, 0, 0, 0, 0}); + expected = cudf::test::strings_column_wrapper({"", "", "", "", "", ""}, + {false, false, false, false, false, false}); results = cudf::strings::extract(view, *prog); CUDF_TEST_EXPECT_COLUMNS_EQUAL(results->view().column(0), expected); } diff --git a/cpp/tests/strings/replace_tests.cpp b/cpp/tests/strings/replace_tests.cpp index 6c4afbb435a..dd4e5950a9b 100644 --- a/cpp/tests/strings/replace_tests.cpp +++ b/cpp/tests/strings/replace_tests.cpp @@ -282,11 +282,11 @@ TEST_F(StringsReplaceTest, ReplaceErrors) auto const ev = cudf::strings_column_view(empty); auto const targets = cudf::test::strings_column_wrapper({"x"}); auto const tv = cudf::strings_column_view(targets); - auto const target_null = cudf::test::strings_column_wrapper({""}, {0}); + auto const target_null = cudf::test::strings_column_wrapper({""}, {false}); auto const tv_null = cudf::strings_column_view(target_null); auto const repls = cudf::test::strings_column_wrapper({"y", "z"}); auto const rv = cudf::strings_column_view(repls); - auto const repl_null = cudf::test::strings_column_wrapper({""}, {0}); + auto const repl_null = cudf::test::strings_column_wrapper({""}, {false}); auto const rv_null = cudf::strings_column_view(repl_null); EXPECT_THROW(cudf::strings::replace_multiple(sv, ev, rv), cudf::logic_error); diff --git a/cpp/tests/strings/split_tests.cpp b/cpp/tests/strings/split_tests.cpp index 7ece08b19f2..5d499751f59 100644 --- a/cpp/tests/strings/split_tests.cpp +++ b/cpp/tests/strings/split_tests.cpp @@ -320,8 +320,9 @@ TEST_F(StringsSplitTest, SplitAllEmpty) CUDF_TEST_EXPECT_COLUMNS_EQUAL(result->view().column(0), input); // whitespace hits a special case where nothing matches returns an all-null column - auto expected = cudf::test::strings_column_wrapper({"", "", "", ""}, {0, 0, 0, 0}); - result = cudf::strings::split(sv, empty); + auto expected = + cudf::test::strings_column_wrapper({"", "", "", ""}, {false, false, false, false}); + result = cudf::strings::split(sv, empty); CUDF_TEST_EXPECT_COLUMNS_EQUIVALENT(result->view().column(0), expected); result = cudf::strings::rsplit(sv, empty); CUDF_TEST_EXPECT_COLUMNS_EQUIVALENT(result->view().column(0), expected); diff --git a/cpp/tests/structs/structs_column_tests.cpp b/cpp/tests/structs/structs_column_tests.cpp index f0010fc1ed9..570bf79b277 100644 --- a/cpp/tests/structs/structs_column_tests.cpp +++ b/cpp/tests/structs/structs_column_tests.cpp @@ -128,7 +128,7 @@ TYPED_TEST(TypedStructColumnWrapperTest, TestColumnWrapperConstruction) {48, 27, 25, 31, 351, 351}, {1, 1, 1, 1, 1, 0}}; auto is_human_col = cudf::test::fixed_width_column_wrapper{ - {true, true, false, false, false, false}, {1, 1, 0, 1, 1, 0}}; + {true, true, false, false, false, false}, {true, true, false, true, true, false}}; auto struct_col = cudf::test::structs_column_wrapper{{names_col, ages_col, is_human_col}, {1, 1, 1, 0, 1, 1}} @@ -149,8 +149,8 @@ TYPED_TEST(TypedStructColumnWrapperTest, TestColumnWrapperConstruction) {48, 27, 25, 31, 351, 351}, {1, 1, 1, 0, 1, 0}}.release()); expected_children.emplace_back(cudf::test::fixed_width_column_wrapper{ - {true, true, false, false, false, false}, - {1, 1, 0, 0, 1, 0}}.release()); + {true, true, false, false, false, false}, {true, true, false, false, true, false}} + .release()); std::for_each(thrust::make_counting_iterator(0), thrust::make_counting_iterator(0) + expected_children.size(), @@ -160,7 +160,9 @@ TYPED_TEST(TypedStructColumnWrapperTest, TestColumnWrapperConstruction) }); auto expected_struct_col = - cudf::test::structs_column_wrapper{std::move(expected_children), {1, 1, 1, 0, 1, 1}}.release(); + cudf::test::structs_column_wrapper{std::move(expected_children), + {true, true, true, false, true, true}} + .release(); CUDF_TEST_EXPECT_COLUMNS_EQUIVALENT(struct_col_view, expected_struct_col->view()); } @@ -238,16 +240,18 @@ TYPED_TEST(TypedStructColumnWrapperTest, StructOfStructs) // `Name` column has all valid values. auto names_col = cudf::test::strings_column_wrapper{names.begin(), names.end()}; - auto ages_col = - cudf::test::fixed_width_column_wrapper{{48, 27, 25, 31, 351, 351}, {1, 1, 1, 1, 1, 0}}; + auto ages_col = cudf::test::fixed_width_column_wrapper{ + {48, 27, 25, 31, 351, 351}, {true, true, true, true, true, false}}; - auto struct_1 = cudf::test::structs_column_wrapper{{names_col, ages_col}, {1, 1, 1, 1, 0, 1}}; + auto struct_1 = cudf::test::structs_column_wrapper{{names_col, ages_col}, + {true, true, true, true, false, true}}; auto is_human_col = cudf::test::fixed_width_column_wrapper{ - {true, true, false, false, false, false}, {1, 1, 0, 1, 1, 0}}; + {true, true, false, false, false, false}, {true, true, false, true, true, false}}; - auto struct_2 = - cudf::test::structs_column_wrapper{{is_human_col, struct_1}, {0, 1, 1, 1, 1, 1}}.release(); + auto struct_2 = cudf::test::structs_column_wrapper{{is_human_col, struct_1}, + {false, true, true, true, true, true}} + .release(); EXPECT_EQ(struct_2->size(), num_rows); EXPECT_EQ(struct_2->view().child(0).size(), num_rows); @@ -263,14 +267,16 @@ TYPED_TEST(TypedStructColumnWrapperTest, StructOfStructs) CUDF_TEST_EXPECT_COLUMNS_EQUIVALENT(*expected_names_col, struct_2->child(1).child(0)); - auto expected_ages_col = cudf::test::fixed_width_column_wrapper{ - {48, 27, 25, 31, 351, 351}, - {0, 1, 1, 1, 0, 0}}.release(); + auto expected_ages_col = + cudf::test::fixed_width_column_wrapper{{48, 27, 25, 31, 351, 351}, + {false, true, true, true, false, false}} + .release(); CUDF_TEST_EXPECT_COLUMNS_EQUIVALENT(*expected_ages_col, struct_2->child(1).child(1)); - auto expected_bool_col = cudf::test::fixed_width_column_wrapper{ - {true, true, false, false, false, false}, - {0, 1, 0, 1, 1, 0}}.release(); + auto expected_bool_col = + cudf::test::fixed_width_column_wrapper{{true, true, false, false, false, false}, + {false, true, false, true, true, false}} + .release(); CUDF_TEST_EXPECT_COLUMNS_EQUIVALENT(*expected_bool_col, struct_2->child(0)); @@ -280,14 +286,16 @@ TYPED_TEST(TypedStructColumnWrapperTest, StructOfStructs) vector_of_columns expected_cols_1; expected_cols_1.emplace_back(std::move(expected_names_col)); expected_cols_1.emplace_back(std::move(expected_ages_col)); - auto expected_struct_1 = - cudf::test::structs_column_wrapper(std::move(expected_cols_1), {1, 1, 1, 1, 0, 1}).release(); + auto expected_struct_1 = cudf::test::structs_column_wrapper(std::move(expected_cols_1), + {true, true, true, true, false, true}) + .release(); vector_of_columns expected_cols_2; expected_cols_2.emplace_back(std::move(expected_bool_col)); expected_cols_2.emplace_back(std::move(expected_struct_1)); - auto expected_struct_2 = - cudf::test::structs_column_wrapper(std::move(expected_cols_2), {0, 1, 1, 1, 1, 1}).release(); + auto expected_struct_2 = cudf::test::structs_column_wrapper(std::move(expected_cols_2), + {false, true, true, true, true, true}) + .release(); CUDF_TEST_EXPECT_COLUMNS_EQUIVALENT(*expected_struct_2, *struct_2); } @@ -309,19 +317,22 @@ TYPED_TEST(TypedStructColumnWrapperTest, TestNullMaskPropagationForNonNullStruct auto names_col = cudf::test::strings_column_wrapper{names.begin(), names.end()}; auto ages_col = cudf::test::fixed_width_column_wrapper{ - {48, 27, 25, 31, 351, 351}, {1, 1, 1, 1, 1, 1} // <-- No nulls in ages_col either. + {48, 27, 25, 31, 351, 351}, + {true, true, true, true, true, true} // <-- No nulls in ages_col either. }; auto struct_1 = cudf::test::structs_column_wrapper{ - {names_col, ages_col}, {1, 1, 1, 1, 1, 1} // <-- Non-null, bottom level struct. + {names_col, ages_col}, + {true, true, true, true, true, true} // <-- Non-null, bottom level struct. }; auto is_human_col = cudf::test::fixed_width_column_wrapper{ - {true, true, false, false, false, false}, {1, 1, 0, 1, 1, 0}}; + {true, true, false, false, false, false}, {true, true, false, true, true, false}}; auto struct_2 = cudf::test::structs_column_wrapper{ - {is_human_col, struct_1}, {0, 1, 1, 1, 1, 1} // <-- First row is null, for top-level struct. + {is_human_col, struct_1}, + {false, true, true, true, true, true} // <-- First row is null, for top-level struct. } .release(); @@ -342,14 +353,16 @@ TYPED_TEST(TypedStructColumnWrapperTest, TestNullMaskPropagationForNonNullStruct CUDF_TEST_EXPECT_COLUMNS_EQUIVALENT(*expected_names_col, struct_2->child(1).child(0)); - auto expected_ages_col = cudf::test::fixed_width_column_wrapper{ - {48, 27, 25, 31, 351, 351}, - {0, 1, 1, 1, 1, 1}}.release(); + auto expected_ages_col = + cudf::test::fixed_width_column_wrapper{{48, 27, 25, 31, 351, 351}, + {false, true, true, true, true, true}} + .release(); CUDF_TEST_EXPECT_COLUMNS_EQUIVALENT(*expected_ages_col, struct_2->child(1).child(1)); - auto expected_bool_col = cudf::test::fixed_width_column_wrapper{ - {true, true, false, false, false, false}, - {0, 1, 0, 1, 1, 0}}.release(); + auto expected_bool_col = + cudf::test::fixed_width_column_wrapper{{true, true, false, false, false, false}, + {false, true, false, true, true, false}} + .release(); CUDF_TEST_EXPECT_COLUMNS_EQUIVALENT(*expected_bool_col, struct_2->child(0)); @@ -359,14 +372,16 @@ TYPED_TEST(TypedStructColumnWrapperTest, TestNullMaskPropagationForNonNullStruct vector_of_columns expected_cols_1; expected_cols_1.emplace_back(std::move(expected_names_col)); expected_cols_1.emplace_back(std::move(expected_ages_col)); - auto expected_struct_1 = - cudf::test::structs_column_wrapper(std::move(expected_cols_1), {1, 1, 1, 1, 1, 1}).release(); + auto expected_struct_1 = cudf::test::structs_column_wrapper(std::move(expected_cols_1), + {true, true, true, true, true, true}) + .release(); vector_of_columns expected_cols_2; expected_cols_2.emplace_back(std::move(expected_bool_col)); expected_cols_2.emplace_back(std::move(expected_struct_1)); - auto expected_struct_2 = - cudf::test::structs_column_wrapper(std::move(expected_cols_2), {0, 1, 1, 1, 1, 1}).release(); + auto expected_struct_2 = cudf::test::structs_column_wrapper(std::move(expected_cols_2), + {false, true, true, true, true, true}) + .release(); CUDF_TEST_EXPECT_COLUMNS_EQUIVALENT(*expected_struct_2, *struct_2); } diff --git a/cpp/tests/text/ngrams_tests.cpp b/cpp/tests/text/ngrams_tests.cpp index 1acb4fc4265..2b870933129 100644 --- a/cpp/tests/text/ngrams_tests.cpp +++ b/cpp/tests/text/ngrams_tests.cpp @@ -134,7 +134,8 @@ TEST_F(TextGenerateNgramsTest, Errors) EXPECT_THROW(nvtext::generate_character_ngrams(cudf::strings_column_view(strings), 3), cudf::logic_error); - cudf::test::strings_column_wrapper strings_no_tokens({"", "", "", ""}, {1, 0, 1, 0}); + cudf::test::strings_column_wrapper strings_no_tokens({"", "", "", ""}, + {true, false, true, false}); EXPECT_THROW(nvtext::generate_ngrams(cudf::strings_column_view(strings_no_tokens), 2, separator), cudf::logic_error); EXPECT_THROW(nvtext::generate_character_ngrams(cudf::strings_column_view(strings_no_tokens)), diff --git a/cpp/tests/transform/bools_to_mask_test.cpp b/cpp/tests/transform/bools_to_mask_test.cpp index 215ca158f37..763c8dd511c 100644 --- a/cpp/tests/transform/bools_to_mask_test.cpp +++ b/cpp/tests/transform/bools_to_mask_test.cpp @@ -64,15 +64,15 @@ struct MaskToNullTest : public cudf::test::BaseFixture { TEST_F(MaskToNullTest, WithNoNull) { - std::vector input({1, 0, 1, 0, 1, 0, 1, 0}); + std::vector input({true, false, true, false, true, false, true, false}); run_test(input); } TEST_F(MaskToNullTest, WithNull) { - std::vector input({1, 0, 1, 0, 1, 0, 1, 0}); - std::vector val({1, 1, 1, 1, 1, 1, 0, 1}); + std::vector input({true, false, true, false, true, false, true, false}); + std::vector val({true, true, true, true, true, true, false, true}); run_test(input, val); } diff --git a/cpp/tests/unary/unary_ops_test.cpp b/cpp/tests/unary/unary_ops_test.cpp index e7477c34642..253d3105e93 100644 --- a/cpp/tests/unary/unary_ops_test.cpp +++ b/cpp/tests/unary/unary_ops_test.cpp @@ -205,7 +205,8 @@ TYPED_TEST(IsNAN, EmptyColumn) TYPED_TEST(IsNAN, NonFloatingColumn) { - cudf::test::fixed_width_column_wrapper col{{1, 2, 5, 3, 5, 6, 7}, {1, 0, 1, 1, 0, 1, 1}}; + cudf::test::fixed_width_column_wrapper col{{1, 2, 5, 3, 5, 6, 7}, + {true, false, true, true, false, true, true}}; EXPECT_THROW(std::unique_ptr got = cudf::is_nan(col), cudf::logic_error); } @@ -257,7 +258,8 @@ TYPED_TEST(IsNotNAN, EmptyColumn) TYPED_TEST(IsNotNAN, NonFloatingColumn) { - cudf::test::fixed_width_column_wrapper col{{1, 2, 5, 3, 5, 6, 7}, {1, 0, 1, 1, 0, 1, 1}}; + cudf::test::fixed_width_column_wrapper col{{1, 2, 5, 3, 5, 6, 7}, + {true, false, true, true, false, true, true}}; EXPECT_THROW(std::unique_ptr got = cudf::is_not_nan(col), cudf::logic_error); } diff --git a/cpp/tests/utilities_tests/column_utilities_tests.cpp b/cpp/tests/utilities_tests/column_utilities_tests.cpp index 9d6d5ccb9b5..2422cadd95b 100644 --- a/cpp/tests/utilities_tests/column_utilities_tests.cpp +++ b/cpp/tests/utilities_tests/column_utilities_tests.cpp @@ -287,7 +287,7 @@ TEST_F(ColumnUtilitiesListsTest, DifferentPhysicalStructureBeforeConstruction) { // list { - std::vector valids = {0, 0, 1, 0, 1, 0, 0}; + std::vector valids = {false, false, true, false, true, false, false}; cudf::test::fixed_width_column_wrapper c0_offsets{0, 3, 6, 8, 11, 14, 16, 19}; cudf::test::fixed_width_column_wrapper c0_data{ @@ -316,7 +316,7 @@ TEST_F(ColumnUtilitiesListsTest, DifferentPhysicalStructureBeforeConstruction) // list>> { - std::vector level1_valids = {0, 0, 1, 0, 1, 0, 0}; + std::vector level1_valids = {false, false, true, false, true, false, false}; cudf::test::fixed_width_column_wrapper c0_l1_offsets{0, 1, 2, 4, 4, 7, 7, 7}; cudf::test::fixed_width_column_wrapper c0_l2_offsets{0, 1, 2, 5, 6, 7, 10, 14}; @@ -325,7 +325,7 @@ TEST_F(ColumnUtilitiesListsTest, DifferentPhysicalStructureBeforeConstruction) cudf::test::fixed_width_column_wrapper c0_l3_floats{ 1, 1, 10, 20, 30, 1, 1, 40, 50, 60, 70, 80, 90, 100}; cudf::test::structs_column_wrapper c0_l2_data({c0_l3_ints, c0_l3_floats}); - std::vector c0_l2_valids = {1, 1, 1, 0, 0, 1, 1}; + std::vector c0_l2_valids = {true, true, true, false, false, true, true}; auto [null_mask, null_count] = cudf::test::detail::make_null_mask(c0_l2_valids.begin(), c0_l2_valids.end()); @@ -343,7 +343,7 @@ TEST_F(ColumnUtilitiesListsTest, DifferentPhysicalStructureBeforeConstruction) cudf::test::fixed_width_column_wrapper c1_l3_floats{ 10, 20, 30, 40, 50, 60, 70, 80, 90, 100}; cudf::test::structs_column_wrapper c1_l2_data({c1_l3_ints, c1_l3_floats}); - std::vector c1_l2_valids = {1, 0, 0, 1, 1}; + std::vector c1_l2_valids = {true, false, false, true, true}; std::tie(null_mask, null_count) = cudf::test::detail::make_null_mask(c1_l2_valids.begin(), c1_l2_valids.end());