From e5265d8f1c5f0b890d74ec9491fd9f979695ffa9 Mon Sep 17 00:00:00 2001 From: Vyas Ramasubramani Date: Mon, 8 May 2023 17:14:29 -0700 Subject: [PATCH] Simplify null count checking in column equality comparator --- cpp/tests/utilities/column_utilities.cu | 24 +----------------------- 1 file changed, 1 insertion(+), 23 deletions(-) diff --git a/cpp/tests/utilities/column_utilities.cu b/cpp/tests/utilities/column_utilities.cu index cef9c143c9d..2c7af9403d3 100644 --- a/cpp/tests/utilities/column_utilities.cu +++ b/cpp/tests/utilities/column_utilities.cu @@ -243,23 +243,6 @@ struct column_property_comparator { return is_fixed_point(lhs) ? lhs.id() == rhs.id() : lhs == rhs; } - size_type count_nulls(cudf::column_view const& c, cudf::column_view const& row_indices) - { - auto validity_iter = cudf::detail::make_counting_transform_iterator( - 0, - [row_indices = row_indices.begin(), - validity = c.null_mask(), - offset = c.offset()] __device__(int index) { - // both null mask and offsets data are not pre-sliced. so we need to add the column offset - // to every incoming index. - auto const true_index = row_indices[index] + offset; - return !validity || cudf::bit_is_set(validity, true_index) ? 0 : 1; - }); - return thrust::reduce(rmm::exec_policy(cudf::get_default_stream()), - validity_iter, - validity_iter + row_indices.size()); - } - bool compare_common(cudf::column_view const& lhs, cudf::column_view const& rhs, cudf::column_view const& lhs_row_indices, @@ -280,12 +263,7 @@ struct column_property_comparator { if (lhs_size > 0 && check_exact_equality) { PROP_EXPECT_EQ(lhs.nullable(), rhs.nullable()); } - // DISCUSSION: does this make sense, semantically? - auto const lhs_null_count = - check_exact_equality ? lhs.null_count() : count_nulls(lhs, lhs_row_indices); - auto const rhs_null_count = - check_exact_equality ? rhs.null_count() : count_nulls(rhs, rhs_row_indices); - PROP_EXPECT_EQ(lhs_null_count, rhs_null_count); + PROP_EXPECT_EQ(lhs.null_count(), rhs.null_count()); // equivalent, but not exactly equal columns can have a different number of children if their // sizes are both 0. Specifically, empty string columns may or may not have children.