diff --git a/cpp/tests/CMakeLists.txt b/cpp/tests/CMakeLists.txt index caa92d60151..8b0e625fecf 100644 --- a/cpp/tests/CMakeLists.txt +++ b/cpp/tests/CMakeLists.txt @@ -439,8 +439,13 @@ ConfigureTest( # ################################################################################################## # * table tests ----------------------------------------------------------------------------------- ConfigureTest( - TABLE_TEST table/table_tests.cpp table/table_view_tests.cu table/row_operators_tests.cpp - table/experimental_row_operator_tests.cu table/row_operator_tests_utilities.cu + TABLE_TEST + table/table_tests.cpp + table/table_view_tests.cu + table/row_operators_tests.cpp + table/experimental_row_operator_tests.cu + table/row_operator_tests_utilities.cu + table/row_operator_tests_utilities2.cu ) # ################################################################################################## diff --git a/cpp/tests/table/row_operator_tests_utilities.cu b/cpp/tests/table/row_operator_tests_utilities.cu index d1f918cc7af..cfffa1cdd54 100644 --- a/cpp/tests/table/row_operator_tests_utilities.cu +++ b/cpp/tests/table/row_operator_tests_utilities.cu @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022-2023, NVIDIA CORPORATION. + * Copyright (c) 2022-2024, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,60 +18,14 @@ #include #include -#include #include #include -#include #include #include #include -template -std::unique_ptr self_comparison(cudf::table_view input, - std::vector const& column_order, - PhysicalElementComparator comparator) -{ - rmm::cuda_stream_view stream{cudf::get_default_stream()}; - - auto const table_comparator = - cudf::experimental::row::lexicographic::self_comparator{input, column_order, {}, stream}; - - auto output = cudf::make_numeric_column( - cudf::data_type(cudf::type_id::BOOL8), input.num_rows(), cudf::mask_state::UNALLOCATED); - - if (cudf::detail::has_nested_columns(input)) { - thrust::transform(rmm::exec_policy(stream), - thrust::make_counting_iterator(0), - thrust::make_counting_iterator(input.num_rows()), - thrust::make_counting_iterator(0), - output->mutable_view().data(), - table_comparator.less(cudf::nullate::NO{}, comparator)); - } else { - thrust::transform(rmm::exec_policy(stream), - thrust::make_counting_iterator(0), - thrust::make_counting_iterator(input.num_rows()), - thrust::make_counting_iterator(0), - output->mutable_view().data(), - table_comparator.less(cudf::nullate::NO{}, comparator)); - } - return output; -} - -using physical_comparator_t = cudf::experimental::row::lexicographic::physical_element_comparator; -using sorting_comparator_t = - cudf::experimental::row::lexicographic::sorting_physical_element_comparator; - -template std::unique_ptr self_comparison( - cudf::table_view input, - std::vector const& column_order, - physical_comparator_t comparator); -template std::unique_ptr self_comparison( - cudf::table_view input, - std::vector const& column_order, - sorting_comparator_t comparator); - template std::unique_ptr two_table_comparison(cudf::table_view lhs, cudf::table_view rhs, @@ -199,9 +153,6 @@ std::unique_ptr two_table_equality(cudf::table_view lhs, return output; } -using physical_equality_t = cudf::experimental::row::equality::physical_equality_comparator; -using nan_equality_t = cudf::experimental::row::equality::nan_equal_physical_equality_comparator; - template std::unique_ptr two_table_equality( cudf::table_view lhs, cudf::table_view rhs, diff --git a/cpp/tests/table/row_operator_tests_utilities.hpp b/cpp/tests/table/row_operator_tests_utilities.hpp index b34bf65d176..023a54669b4 100644 --- a/cpp/tests/table/row_operator_tests_utilities.hpp +++ b/cpp/tests/table/row_operator_tests_utilities.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, NVIDIA CORPORATION. + * Copyright (c) 2023-2024, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,6 +22,12 @@ #include +using physical_comparator_t = cudf::experimental::row::lexicographic::physical_element_comparator; +using sorting_comparator_t = + cudf::experimental::row::lexicographic::sorting_physical_element_comparator; +using physical_equality_t = cudf::experimental::row::equality::physical_equality_comparator; +using nan_equality_t = cudf::experimental::row::equality::nan_equal_physical_equality_comparator; + template std::unique_ptr self_comparison(cudf::table_view input, std::vector const& column_order, diff --git a/cpp/tests/table/row_operator_tests_utilities2.cu b/cpp/tests/table/row_operator_tests_utilities2.cu new file mode 100644 index 00000000000..057d9ee1004 --- /dev/null +++ b/cpp/tests/table/row_operator_tests_utilities2.cu @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2024, NVIDIA CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "row_operator_tests_utilities.hpp" + +#include +#include + +#include +#include + +#include +#include + +// Including this declaration/defintion in row_operator_tests_utilities.cu causes +// the nvcc compiler to segfault when built with the debug (-g) flag. + +template +std::unique_ptr self_comparison(cudf::table_view input, + std::vector const& column_order, + PhysicalElementComparator comparator) +{ + rmm::cuda_stream_view stream{cudf::get_default_stream()}; + + auto const table_comparator = + cudf::experimental::row::lexicographic::self_comparator{input, column_order, {}, stream}; + + auto output = cudf::make_numeric_column( + cudf::data_type(cudf::type_id::BOOL8), input.num_rows(), cudf::mask_state::UNALLOCATED); + + if (cudf::detail::has_nested_columns(input)) { + thrust::transform(rmm::exec_policy(stream), + thrust::make_counting_iterator(0), + thrust::make_counting_iterator(input.num_rows()), + thrust::make_counting_iterator(0), + output->mutable_view().data(), + table_comparator.less(cudf::nullate::NO{}, comparator)); + } else { + thrust::transform(rmm::exec_policy(stream), + thrust::make_counting_iterator(0), + thrust::make_counting_iterator(input.num_rows()), + thrust::make_counting_iterator(0), + output->mutable_view().data(), + table_comparator.less(cudf::nullate::NO{}, comparator)); + } + return output; +} + +template std::unique_ptr self_comparison( + cudf::table_view input, + std::vector const& column_order, + physical_comparator_t comparator); +template std::unique_ptr self_comparison( + cudf::table_view input, + std::vector const& column_order, + sorting_comparator_t comparator);