From 60b1c11fbd4b54a908969d570cd5a8ec03567a73 Mon Sep 17 00:00:00 2001 From: Lawrence Mitchell Date: Tue, 28 Apr 2026 16:35:06 +0100 Subject: [PATCH 1/7] Implement equality of two table_views At various times, it is useful to check whether two tables are equal. For example, in cudf-polars we use this to check if two tables are "compatibly" partitioned. Previously there have been no such utilities in libcudf proper. The best one can do is to loop over the columns, call cudf::binary_operation with NULL_EQUALS and then cudf::reduce on the result. This launches many more kernels than necessary. Instead, use the existing row_equality operators to perform a single transform_reduce over the table checking for equality. --- cpp/CMakeLists.txt | 1 + cpp/include/cudf/table/equality.hpp | 35 ++++++++++ cpp/src/table/table_equal.cu | 75 ++++++++++++++++++++ cpp/tests/table/table_tests.cpp | 104 +++++++++++++++++++++++++++- 4 files changed, 213 insertions(+), 2 deletions(-) create mode 100644 cpp/include/cudf/table/equality.hpp create mode 100644 cpp/src/table/table_equal.cu diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index 5a0b2f95e830..91e8e86683c9 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -813,6 +813,7 @@ add_library( src/structs/utilities.cu src/table/table.cpp src/table/table_device_view.cu + src/table/table_equal.cu src/table/table_view.cpp src/text/deduplicate.cu src/text/detokenize.cu diff --git a/cpp/include/cudf/table/equality.hpp b/cpp/include/cudf/table/equality.hpp new file mode 100644 index 000000000000..83b442eca3ee --- /dev/null +++ b/cpp/include/cudf/table/equality.hpp @@ -0,0 +1,35 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION. + * SPDX-License-Identifier: Apache-2.0 + */ +#pragma once + +#include +#include +#include +#include + +#include +namespace CUDF_EXPORT cudf { + +/** + * @brief Check if two tables are equal. + * + * Returns true if the input tables have the same number of rows, the same number of columns, + * matching column types, and every row in `left` compares equal to the row at the same index in + * `right`. Null equality is controlled by `nulls_equal`. Floating point NaN values compare equal. + * + * @throws cudf::logic_error if the tables contain non-equality-comparable column types. + * + * @param left The first table to compare + * @param right The second table to compare + * @param nulls_equal Flag to denote if null elements should be considered equal + * @param stream CUDA stream used for device memory operations and kernel launches + * @return true if the tables are equal, false otherwise + */ +bool tables_equal(table_view const& left, + table_view const& right, + null_equality nulls_equal = null_equality::EQUAL, + rmm::cuda_stream_view stream = cudf::get_default_stream()); + +} // namespace CUDF_EXPORT cudf diff --git a/cpp/src/table/table_equal.cu b/cpp/src/table/table_equal.cu new file mode 100644 index 000000000000..0e340d202fe0 --- /dev/null +++ b/cpp/src/table/table_equal.cu @@ -0,0 +1,75 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION. + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include + +namespace cudf { +namespace detail { +namespace { + +template +bool tables_equal(table_view const& left, + table_view const& right, + null_equality nulls_equal, + rmm::cuda_stream_view stream) +{ + auto const comparator = detail::row::equality::two_table_comparator{left, right, stream}; + auto const rows_equal = comparator.equal_to( + nullate::DYNAMIC{has_nested_nulls(left) or has_nested_nulls(right)}, nulls_equal); + + return thrust::transform_reduce( + rmm::exec_policy_nosync(stream), + cuda::counting_iterator{0}, + cuda::counting_iterator{left.num_rows()}, + [rows_equal] __device__(size_type i) -> bool { + return rows_equal(detail::row::lhs_index_type{i}, detail::row::rhs_index_type{i}); + }, + true, + cuda::std::logical_and{}); +} + +} // namespace + +bool tables_equal(table_view const& left, + table_view const& right, + null_equality nulls_equal, + rmm::cuda_stream_view stream) +{ + if (left.num_rows() != right.num_rows() || left.num_columns() != right.num_columns() || + !have_same_types(left, right)) { + return false; + } else if (left.num_rows() == 0) { + return true; + } + + return cudf::has_nested_columns(left) || cudf::has_nested_columns(right) + ? tables_equal(left, right, nulls_equal, stream) + : tables_equal(left, right, nulls_equal, stream); +} +} // namespace detail + +bool tables_equal(table_view const& left, + table_view const& right, + null_equality nulls_equal, + rmm::cuda_stream_view stream) +{ + CUDF_FUNC_RANGE(); + return detail::tables_equal(left, right, nulls_equal, stream); +} + +} // namespace cudf diff --git a/cpp/tests/table/table_tests.cpp b/cpp/tests/table/table_tests.cpp index b909d9c9392f..725f90af1623 100644 --- a/cpp/tests/table/table_tests.cpp +++ b/cpp/tests/table/table_tests.cpp @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2019-2025, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2019-2026, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ @@ -10,15 +10,20 @@ #include #include +#include #include #include +#include + +#include #include template using column_wrapper = cudf::test::fixed_width_column_wrapper; -using s_col_wrapper = cudf::test::strings_column_wrapper; +using s_col_wrapper = cudf::test::strings_column_wrapper; +using structs_col_wrapper = cudf::test::structs_column_wrapper; using CVector = std::vector>; using column = cudf::column; @@ -163,4 +168,99 @@ TEST_F(TableTest, AllocSizeWithNulls) EXPECT_EQ(t.alloc_size(), 152); // bitmask has padding } +TEST_F(TableTest, TablesEqual) +{ + column_wrapper left_col0{{1, 2, 3}}; + column_wrapper left_col1{{4.0, 5.0, 6.0}}; + column_wrapper right_col0{{1, 2, 3}}; + column_wrapper right_col1{{4.0, 5.0, 6.0}}; + + EXPECT_TRUE(cudf::tables_equal(cudf::table_view{{left_col0, left_col1}}, + cudf::table_view{{right_col0, right_col1}})); +} + +TEST_F(TableTest, TablesEqualValueMismatch) +{ + column_wrapper left{{1, 2, 3}}; + column_wrapper right{{1, 4, 3}}; + + EXPECT_FALSE(cudf::tables_equal(cudf::table_view{{left}}, cudf::table_view{{right}})); +} + +TEST_F(TableTest, TablesEqualShapeAndTypeMismatch) +{ + column_wrapper left{{1, 2, 3}}; + column_wrapper shorter{{1, 2}}; + column_wrapper extra{{1, 2, 3}}; + column_wrapper different_type{{1, 2, 3}}; + + EXPECT_FALSE(cudf::tables_equal(cudf::table_view{{left}}, cudf::table_view{{shorter}})); + EXPECT_FALSE(cudf::tables_equal(cudf::table_view{{left}}, cudf::table_view{{left, extra}})); + EXPECT_FALSE(cudf::tables_equal(cudf::table_view{{left}}, cudf::table_view{{different_type}})); +} + +TEST_F(TableTest, TablesEqualNullEquality) +{ + column_wrapper left{{1, 2, 3}, {1, 0, 1}}; + column_wrapper right{{1, 4, 3}, {1, 0, 1}}; + + EXPECT_TRUE(cudf::tables_equal( + cudf::table_view{{left}}, cudf::table_view{{right}}, cudf::null_equality::EQUAL)); + EXPECT_FALSE(cudf::tables_equal( + cudf::table_view{{left}}, cudf::table_view{{right}}, cudf::null_equality::UNEQUAL)); +} + +TEST_F(TableTest, TablesEqualNaNsCompareEqual) +{ + column_wrapper left{{std::numeric_limits::quiet_NaN(), 1.0}}; + column_wrapper right{{std::numeric_limits::quiet_NaN(), 1.0}}; + + EXPECT_TRUE(cudf::tables_equal(cudf::table_view{{left}}, cudf::table_view{{right}})); +} + +TEST_F(TableTest, TablesEqualStructColumns) +{ + column_wrapper left_id{{1, 2, 3}}; + column_wrapper left_inner_value{{10, 20, 30}}; + column_wrapper left_deep_leaf{{1.25, 2.5, 3.75}}; + structs_col_wrapper left_inner{{left_inner_value, left_deep_leaf}}; + structs_col_wrapper left_outer{{left_id, left_inner}}; + + column_wrapper right_id{{1, 2, 3}}; + column_wrapper right_inner_value{{10, 20, 30}}; + column_wrapper right_deep_leaf{{1.25, 2.5, 3.75}}; + structs_col_wrapper right_inner{{right_inner_value, right_deep_leaf}}; + structs_col_wrapper right_outer{{right_id, right_inner}}; + + EXPECT_TRUE(cudf::tables_equal(cudf::table_view{{left_outer}}, cudf::table_view{{right_outer}})); +} + +TEST_F(TableTest, TablesEqualStructColumnsDeepLeafMismatch) +{ + column_wrapper left_id{{1, 2, 3}}; + column_wrapper left_inner_value{{10, 20, 30}}; + column_wrapper left_deep_leaf{{1.25, 2.5, 3.75}}; + structs_col_wrapper left_inner{{left_inner_value, left_deep_leaf}}; + structs_col_wrapper left_outer{{left_id, left_inner}}; + + column_wrapper right_id{{1, 2, 3}}; + column_wrapper right_inner_value{{10, 20, 30}}; + column_wrapper right_deep_leaf{{1.25, 2.5, 99.0}}; + structs_col_wrapper right_inner{{right_inner_value, right_deep_leaf}}; + structs_col_wrapper right_outer{{right_id, right_inner}}; + + EXPECT_FALSE(cudf::tables_equal(cudf::table_view{{left_outer}}, cudf::table_view{{right_outer}})); +} + +TEST_F(TableTest, TablesEqualThrowsForNonEqualityComparableTypes) +{ + auto left = + column{cudf::data_type{cudf::type_id::EMPTY}, 3, rmm::device_buffer{}, rmm::device_buffer{}, 0}; + auto right = + column{cudf::data_type{cudf::type_id::EMPTY}, 3, rmm::device_buffer{}, rmm::device_buffer{}, 0}; + + EXPECT_THROW(cudf::tables_equal(cudf::table_view{{left}}, cudf::table_view{{right}}), + cudf::logic_error); +} + CUDF_TEST_PROGRAM_MAIN() From e23ea20156317b5381f48815534da59c94c2bd2f Mon Sep 17 00:00:00 2001 From: Lawrence Mitchell Date: Wed, 29 Apr 2026 10:09:39 +0100 Subject: [PATCH 2/7] Use transform then reduce The row_operator function is too complex for transform-reduce, resulting in very long compile times in general, and a bug in cicc 13.1. --- cpp/src/table/table_equal.cu | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/cpp/src/table/table_equal.cu b/cpp/src/table/table_equal.cu index 0e340d202fe0..91b181a15f56 100644 --- a/cpp/src/table/table_equal.cu +++ b/cpp/src/table/table_equal.cu @@ -3,20 +3,23 @@ * SPDX-License-Identifier: Apache-2.0 */ +#include #include #include #include #include #include #include +#include #include #include +#include #include +#include #include #include -#include namespace cudf { namespace detail { @@ -31,16 +34,18 @@ bool tables_equal(table_view const& left, auto const comparator = detail::row::equality::two_table_comparator{left, right, stream}; auto const rows_equal = comparator.equal_to( nullate::DYNAMIC{has_nested_nulls(left) or has_nested_nulls(right)}, nulls_equal); - - return thrust::transform_reduce( - rmm::exec_policy_nosync(stream), + rmm::device_uvector eq_rows{ + static_cast(left.num_rows()), stream, cudf::get_current_device_resource_ref()}; + CUDF_CUDA_TRY(cub::DeviceTransform::Transform( cuda::counting_iterator{0}, - cuda::counting_iterator{left.num_rows()}, + eq_rows.begin(), + eq_rows.size(), [rows_equal] __device__(size_type i) -> bool { return rows_equal(detail::row::lhs_index_type{i}, detail::row::rhs_index_type{i}); }, - true, - cuda::std::logical_and{}); + stream.value())); + return cudf::detail::reduce( + eq_rows.begin(), eq_rows.end(), true, cuda::std::logical_and{}, stream); } } // namespace From 8141248e304c81e86b8f76b32428e9feb6995ee2 Mon Sep 17 00:00:00 2001 From: Lawrence Mitchell Date: Wed, 29 Apr 2026 10:14:32 +0100 Subject: [PATCH 3/7] Throw documented exception in two_table_comparator Previously if two tables had column types that were not equality-comparable, cudf::logic_error was thrown, while the documented exception was std::invalid_argument. Fix this by throwing the correct exception. --- cpp/include/cudf/table/equality.hpp | 2 +- cpp/src/row_operator/row_operators.cu | 10 ++++++---- cpp/tests/table/table_tests.cpp | 3 ++- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/cpp/include/cudf/table/equality.hpp b/cpp/include/cudf/table/equality.hpp index 83b442eca3ee..f1e806d82029 100644 --- a/cpp/include/cudf/table/equality.hpp +++ b/cpp/include/cudf/table/equality.hpp @@ -19,7 +19,7 @@ namespace CUDF_EXPORT cudf { * matching column types, and every row in `left` compares equal to the row at the same index in * `right`. Null equality is controlled by `nulls_equal`. Floating point NaN values compare equal. * - * @throws cudf::logic_error if the tables contain non-equality-comparable column types. + * @throws cudf::logic_error if the tables contain `EMPTY` types. * * @param left The first table to compare * @param right The second table to compare diff --git a/cpp/src/row_operator/row_operators.cu b/cpp/src/row_operator/row_operators.cu index 9ab21e9cfcbf..4b21d9c980cb 100644 --- a/cpp/src/row_operator/row_operators.cu +++ b/cpp/src/row_operator/row_operators.cu @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2022-2025, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2022-2026, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ @@ -25,6 +25,7 @@ #include #include +#include namespace cudf { namespace detail { @@ -356,9 +357,10 @@ void check_eq_compatibility(table_view const& input) { column_checker_fn_t check_column = [&](column_view const& c) { if (not is_nested(c.type())) { - CUDF_EXPECTS(is_equality_comparable(c.type()), - "Cannot compare equality for a table with a column of type " + - cudf::type_to_name(c.type())); + CUDF_EXPECTS( + is_equality_comparable(c.type()), + "Cannot compare equality for a table with a column of type " + cudf::type_to_name(c.type()), + std::invalid_argument); } for (auto child = c.child_begin(); child < c.child_end(); ++child) { check_column(*child); diff --git a/cpp/tests/table/table_tests.cpp b/cpp/tests/table/table_tests.cpp index 725f90af1623..2bed02e45555 100644 --- a/cpp/tests/table/table_tests.cpp +++ b/cpp/tests/table/table_tests.cpp @@ -18,6 +18,7 @@ #include #include +#include template using column_wrapper = cudf::test::fixed_width_column_wrapper; @@ -260,7 +261,7 @@ TEST_F(TableTest, TablesEqualThrowsForNonEqualityComparableTypes) column{cudf::data_type{cudf::type_id::EMPTY}, 3, rmm::device_buffer{}, rmm::device_buffer{}, 0}; EXPECT_THROW(cudf::tables_equal(cudf::table_view{{left}}, cudf::table_view{{right}}), - cudf::logic_error); + std::invalid_argument); } CUDF_TEST_PROGRAM_MAIN() From 4c875d0b5ed215d060bda5b2f8432f06ed166f8a Mon Sep 17 00:00:00 2001 From: Lawrence Mitchell Date: Wed, 29 Apr 2026 11:02:09 +0100 Subject: [PATCH 4/7] More tests --- cpp/tests/table/table_tests.cpp | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/cpp/tests/table/table_tests.cpp b/cpp/tests/table/table_tests.cpp index 2bed02e45555..40cf43ecce01 100644 --- a/cpp/tests/table/table_tests.cpp +++ b/cpp/tests/table/table_tests.cpp @@ -24,6 +24,7 @@ template using column_wrapper = cudf::test::fixed_width_column_wrapper; using s_col_wrapper = cudf::test::strings_column_wrapper; +using lists_col_wrapper = cudf::test::lists_column_wrapper; using structs_col_wrapper = cudf::test::structs_column_wrapper; using CVector = std::vector>; @@ -261,7 +262,37 @@ TEST_F(TableTest, TablesEqualThrowsForNonEqualityComparableTypes) column{cudf::data_type{cudf::type_id::EMPTY}, 3, rmm::device_buffer{}, rmm::device_buffer{}, 0}; EXPECT_THROW(cudf::tables_equal(cudf::table_view{{left}}, cudf::table_view{{right}}), - std::invalid_argument); + cudf::logic_error); +} + +TEST_F(TableTest, TablesEqualListColumns) +{ + lists_col_wrapper left{{1, 2}, {3}, {}}; + lists_col_wrapper right{{1, 2}, {3}, {}}; + lists_col_wrapper different_values{{1, 2}, {4}, {}}; + lists_col_wrapper different_offsets{{1}, {2, 3}, {}}; + + EXPECT_TRUE(cudf::tables_equal(cudf::table_view{{left}}, cudf::table_view{{right}})); + EXPECT_FALSE(cudf::tables_equal(cudf::table_view{{left}}, cudf::table_view{{different_values}})); + EXPECT_FALSE(cudf::tables_equal(cudf::table_view{{left}}, cudf::table_view{{different_offsets}})); +} + +TEST_F(TableTest, TablesEqualStructColumnsWithLists) +{ + column_wrapper left_id{{1, 2, 3}}; + lists_col_wrapper left_list{{1, 2}, {3}, {}}; + structs_col_wrapper left{{left_id, left_list}}; + + column_wrapper right_id{{1, 2, 3}}; + lists_col_wrapper right_list{{1, 2}, {3}, {}}; + structs_col_wrapper right{{right_id, right_list}}; + + column_wrapper different_id{{1, 2, 3}}; + lists_col_wrapper different_list{{1, 2}, {4}, {}}; + structs_col_wrapper different{{different_id, different_list}}; + + EXPECT_TRUE(cudf::tables_equal(cudf::table_view{{left}}, cudf::table_view{{right}})); + EXPECT_FALSE(cudf::tables_equal(cudf::table_view{{left}}, cudf::table_view{{different}})); } CUDF_TEST_PROGRAM_MAIN() From a25682e0374bb415dd12d730e28738d6456df884 Mon Sep 17 00:00:00 2001 From: Lawrence Mitchell Date: Wed, 29 Apr 2026 11:02:28 +0100 Subject: [PATCH 5/7] Fix traits test --- cpp/tests/types/traits_test.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cpp/tests/types/traits_test.cpp b/cpp/tests/types/traits_test.cpp index 6dbaadf56227..6ddbe7a53692 100644 --- a/cpp/tests/types/traits_test.cpp +++ b/cpp/tests/types/traits_test.cpp @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2019-2024, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2019-2026, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ @@ -115,7 +115,7 @@ TYPED_TEST(TypedTraitsTest, NotEqualityComparableWithList) bool comparable = cudf::is_equality_comparable(); EXPECT_FALSE(comparable); - cudf::is_equality_comparable(); + comparable = cudf::is_equality_comparable(); EXPECT_FALSE(comparable); } From 2d83e62797658442bf412a7e2e4a69963dd5eb82 Mon Sep 17 00:00:00 2001 From: Lawrence Mitchell Date: Wed, 29 Apr 2026 14:34:33 +0100 Subject: [PATCH 6/7] Add streams test --- cpp/tests/CMakeLists.txt | 1 + cpp/tests/streams/table_equality_test.cpp | 28 +++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 cpp/tests/streams/table_equality_test.cpp diff --git a/cpp/tests/CMakeLists.txt b/cpp/tests/CMakeLists.txt index b75b72b1aee3..3fc6dbf96739 100644 --- a/cpp/tests/CMakeLists.txt +++ b/cpp/tests/CMakeLists.txt @@ -790,6 +790,7 @@ ConfigureTest( STREAM_MODE testing ) +ConfigureTest(STREAM_TABLE_EQUALITY_TEST streams/table_equality_test.cpp STREAM_MODE testing) ConfigureTest( STREAM_TEXT_TEST streams/text/edit_distance_test.cpp diff --git a/cpp/tests/streams/table_equality_test.cpp b/cpp/tests/streams/table_equality_test.cpp new file mode 100644 index 000000000000..8c7879c4ec7e --- /dev/null +++ b/cpp/tests/streams/table_equality_test.cpp @@ -0,0 +1,28 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION. + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include + +#include +#include +#include + +class TableEqualTest : public cudf::test::BaseFixture {}; + +TEST_F(TableEqualTest, NotEqual) +{ + cudf::test::fixed_width_column_wrapper left( + {{0, 0, 0, 0, 0}, {false, false, true, true, true}}); + cudf::test::fixed_width_column_wrapper right({1, 1, 1, 1, 1}); + cudf::tables_equal(cudf::table_view{{left}}, + cudf::table_view{{right}}, + cudf::null_equality::EQUAL, + cudf::test::get_default_stream()); +} + +CUDF_TEST_PROGRAM_MAIN() From d6126658e818cc88abff81351b3fef6c3d192bb3 Mon Sep 17 00:00:00 2001 From: Lawrence Mitchell Date: Fri, 8 May 2026 10:52:28 +0100 Subject: [PATCH 7/7] Nodiscard --- cpp/include/cudf/table/equality.hpp | 8 ++++---- cpp/src/table/table_equal.cu | 16 ++++++++-------- cpp/tests/streams/table_equality_test.cpp | 8 ++++---- cpp/tests/table/table_tests.cpp | 5 +++-- 4 files changed, 19 insertions(+), 18 deletions(-) diff --git a/cpp/include/cudf/table/equality.hpp b/cpp/include/cudf/table/equality.hpp index f1e806d82029..22af77300f77 100644 --- a/cpp/include/cudf/table/equality.hpp +++ b/cpp/include/cudf/table/equality.hpp @@ -27,9 +27,9 @@ namespace CUDF_EXPORT cudf { * @param stream CUDA stream used for device memory operations and kernel launches * @return true if the tables are equal, false otherwise */ -bool tables_equal(table_view const& left, - table_view const& right, - null_equality nulls_equal = null_equality::EQUAL, - rmm::cuda_stream_view stream = cudf::get_default_stream()); +[[nodiscard]] bool tables_equal(table_view const& left, + table_view const& right, + null_equality nulls_equal = null_equality::EQUAL, + rmm::cuda_stream_view stream = cudf::get_default_stream()); } // namespace CUDF_EXPORT cudf diff --git a/cpp/src/table/table_equal.cu b/cpp/src/table/table_equal.cu index 91b181a15f56..0cc97e0da260 100644 --- a/cpp/src/table/table_equal.cu +++ b/cpp/src/table/table_equal.cu @@ -26,10 +26,10 @@ namespace detail { namespace { template -bool tables_equal(table_view const& left, - table_view const& right, - null_equality nulls_equal, - rmm::cuda_stream_view stream) +[[nodiscard]] bool tables_equal(table_view const& left, + table_view const& right, + null_equality nulls_equal, + rmm::cuda_stream_view stream) { auto const comparator = detail::row::equality::two_table_comparator{left, right, stream}; auto const rows_equal = comparator.equal_to( @@ -50,10 +50,10 @@ bool tables_equal(table_view const& left, } // namespace -bool tables_equal(table_view const& left, - table_view const& right, - null_equality nulls_equal, - rmm::cuda_stream_view stream) +[[nodiscard]] bool tables_equal(table_view const& left, + table_view const& right, + null_equality nulls_equal, + rmm::cuda_stream_view stream) { if (left.num_rows() != right.num_rows() || left.num_columns() != right.num_columns() || !have_same_types(left, right)) { diff --git a/cpp/tests/streams/table_equality_test.cpp b/cpp/tests/streams/table_equality_test.cpp index 8c7879c4ec7e..fdd85eb1b1b5 100644 --- a/cpp/tests/streams/table_equality_test.cpp +++ b/cpp/tests/streams/table_equality_test.cpp @@ -19,10 +19,10 @@ TEST_F(TableEqualTest, NotEqual) cudf::test::fixed_width_column_wrapper left( {{0, 0, 0, 0, 0}, {false, false, true, true, true}}); cudf::test::fixed_width_column_wrapper right({1, 1, 1, 1, 1}); - cudf::tables_equal(cudf::table_view{{left}}, - cudf::table_view{{right}}, - cudf::null_equality::EQUAL, - cudf::test::get_default_stream()); + std::ignore = cudf::tables_equal(cudf::table_view{{left}}, + cudf::table_view{{right}}, + cudf::null_equality::EQUAL, + cudf::test::get_default_stream()); } CUDF_TEST_PROGRAM_MAIN() diff --git a/cpp/tests/table/table_tests.cpp b/cpp/tests/table/table_tests.cpp index 40cf43ecce01..c7d37b943b65 100644 --- a/cpp/tests/table/table_tests.cpp +++ b/cpp/tests/table/table_tests.cpp @@ -261,8 +261,9 @@ TEST_F(TableTest, TablesEqualThrowsForNonEqualityComparableTypes) auto right = column{cudf::data_type{cudf::type_id::EMPTY}, 3, rmm::device_buffer{}, rmm::device_buffer{}, 0}; - EXPECT_THROW(cudf::tables_equal(cudf::table_view{{left}}, cudf::table_view{{right}}), - cudf::logic_error); + EXPECT_THROW( + std::ignore = cudf::tables_equal(cudf::table_view{{left}}, cudf::table_view{{right}}), + cudf::logic_error); } TEST_F(TableTest, TablesEqualListColumns)