From 8215b5b1e44c8861a1e0e4506a3f6d21f87afdd4 Mon Sep 17 00:00:00 2001 From: Conor Hoekstra <36027403+codereport@users.noreply.github.com> Date: Fri, 5 Feb 2021 02:11:17 -0500 Subject: [PATCH] Move `cudf::test::make_counting_transform_iterator` to `cudf/detail/iterator.cuh` (#7306) :sob: :sob: :sob: Oh how fragile cuDF is. Ran into so many issues. This was split out of https://github.com/rapidsai/cudf/pull/6546 because of how complicated it was. #### 95% was just: * find & replace * adding headers #### The other 5% was: * issues with `column_device_view.cuh` * missing dependent headers Authors: - Conor Hoekstra (@codereport) Approvers: - Paul Taylor (@trxcllnt) - Karthikeyan (@karthikeyann) URL: https://github.com/rapidsai/cudf/pull/7306 --- .../copying/contiguous_split_benchmark.cu | 6 +- cpp/benchmarks/copying/gather_benchmark.cu | 2 +- cpp/benchmarks/copying/scatter_benchmark.cu | 2 +- cpp/benchmarks/groupby/group_nth_benchmark.cu | 2 +- cpp/benchmarks/groupby/group_sum_benchmark.cu | 4 +- cpp/benchmarks/merge/merge_benchmark.cpp | 2 +- cpp/benchmarks/reduction/anyall_benchmark.cpp | 2 +- cpp/benchmarks/reduction/minmax_benchmark.cpp | 2 +- cpp/benchmarks/reduction/reduce_benchmark.cpp | 2 +- cpp/benchmarks/search/search_benchmark.cu | 14 +-- cpp/benchmarks/sort/sort_benchmark.cpp | 4 +- .../drop_duplicates_benchmark.cpp | 4 +- .../string/convert_durations_benchmark.cpp | 4 +- .../type_dispatcher_benchmark.cu | 2 +- cpp/docs/TESTING.md | 2 +- .../cudf/column/column_device_view.cuh | 12 +- cpp/include/cudf/detail/iterator.cuh | 30 +++++ cpp/include/cudf_test/column_wrapper.hpp | 34 +----- cpp/include/cudf_test/timestamp_utilities.cuh | 9 +- cpp/tests/binaryop/binop-fixture.hpp | 7 +- cpp/tests/binaryop/binop-integration-test.cpp | 23 ++-- cpp/tests/binaryop/binop-null-test.cpp | 7 +- cpp/tests/bitmask/valid_if_tests.cu | 11 +- cpp/tests/collect_list/collect_list_test.cpp | 27 +++-- cpp/tests/column/column_test.cu | 7 +- cpp/tests/copying/concatenate_tests.cu | 16 ++- cpp/tests/copying/copy_range_tests.cpp | 103 +++++++++--------- cpp/tests/copying/copy_tests.cu | 13 ++- cpp/tests/copying/detail_gather_tests.cu | 15 ++- cpp/tests/copying/gather_list_tests.cu | 14 ++- cpp/tests/copying/gather_struct_tests.cu | 19 ++-- cpp/tests/copying/gather_tests.cu | 50 +++++---- cpp/tests/copying/pack_tests.cu | 4 +- cpp/tests/copying/sample_tests.cpp | 14 +-- cpp/tests/copying/scatter_list_tests.cu | 103 +++++++++--------- cpp/tests/copying/scatter_tests.cpp | 13 ++- .../copying/segmented_gather_list_tests.cpp | 15 ++- cpp/tests/copying/slice_tests.cpp | 33 +++--- cpp/tests/copying/slice_tests.cuh | 20 ++-- cpp/tests/copying/split_tests.cpp | 52 ++++----- cpp/tests/filling/fill_tests.cpp | 17 +-- cpp/tests/filling/repeat_tests.cpp | 5 +- cpp/tests/groupby/groupby_test_util.hpp | 7 +- cpp/tests/hashing/hash_test.cpp | 11 +- cpp/tests/interop/from_arrow_test.cpp | 10 +- cpp/tests/interop/to_arrow_test.cpp | 10 +- cpp/tests/io/csv_test.cpp | 23 ++-- cpp/tests/io/json_test.cpp | 37 +++---- cpp/tests/io/orc_test.cpp | 58 +++++----- cpp/tests/io/parquet_test.cpp | 91 +++++++++------- cpp/tests/iterator/value_iterator_test.cu | 2 +- cpp/tests/join/semi_join_tests.cpp | 4 +- cpp/tests/lead_lag/lead_lag_test.cpp | 22 ++-- cpp/tests/lists/contains_tests.cpp | 74 +++++++------ cpp/tests/merge/merge_string_test.cpp | 23 ++-- cpp/tests/merge/merge_test.cpp | 78 ++++++------- cpp/tests/partitioning/round_robin_test.cpp | 19 ++-- cpp/tests/reductions/reduction_tests.cpp | 7 +- cpp/tests/replace/clamp_test.cpp | 5 +- cpp/tests/replace/replace_tests.cpp | 6 +- cpp/tests/reshape/byte_cast_tests.cpp | 31 ++++-- cpp/tests/reshape/explode_tests.cpp | 23 ++-- cpp/tests/rolling/rolling_test.cpp | 13 ++- cpp/tests/round/round_tests.cpp | 14 ++- .../apply_boolean_mask_tests.cpp | 15 ++- cpp/tests/strings/attrs_tests.cpp | 2 + cpp/tests/strings/booleans_tests.cpp | 4 +- cpp/tests/strings/case_tests.cpp | 4 +- cpp/tests/strings/chars_types_tests.cpp | 4 +- cpp/tests/strings/combine_tests.cpp | 4 +- cpp/tests/structs/structs_column_tests.cu | 58 +++++----- cpp/tests/transform/bools_to_mask_test.cpp | 6 +- .../integration/unary-transform-test.cpp | 9 +- cpp/tests/unary/cast_tests.cpp | 21 ++-- cpp/tests/unary/unary_ops_test.cpp | 20 ++-- .../column_utilities_tests.cpp | 27 +++-- .../utilities_tests/column_wrapper_tests.cpp | 28 ++--- .../lists_column_wrapper_tests.cpp | 39 ++++--- 78 files changed, 852 insertions(+), 684 deletions(-) diff --git a/cpp/benchmarks/copying/contiguous_split_benchmark.cu b/cpp/benchmarks/copying/contiguous_split_benchmark.cu index 3ae81e2630b..506d676d196 100644 --- a/cpp/benchmarks/copying/contiguous_split_benchmark.cu +++ b/cpp/benchmarks/copying/contiguous_split_benchmark.cu @@ -71,11 +71,11 @@ void BM_contiguous_split(benchmark::State& state) // generate input table srand(31337); - auto valids = cudf::test::make_counting_transform_iterator(0, [](auto i) { return true; }); + auto valids = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return true; }); std::vector> src_cols(num_cols); for (int idx = 0; idx < num_cols; idx++) { auto rand_elements = - cudf::test::make_counting_transform_iterator(0, [](int i) { return rand(); }); + cudf::detail::make_counting_transform_iterator(0, [](int i) { return rand(); }); if (include_validity) { src_cols[idx] = cudf::test::fixed_width_column_wrapper( rand_elements, rand_elements + num_rows, valids); @@ -116,7 +116,7 @@ void BM_contiguous_split_strings(benchmark::State& state) // generate input table srand(31337); - auto valids = cudf::test::make_counting_transform_iterator( + auto valids = cudf::detail::make_counting_transform_iterator( 0, [](auto i) { return i % 2 == 0 ? true : false; }); std::vector src_cols; std::vector one_col(num_rows); diff --git a/cpp/benchmarks/copying/gather_benchmark.cu b/cpp/benchmarks/copying/gather_benchmark.cu index 84f43158a18..f075e9c486e 100644 --- a/cpp/benchmarks/copying/gather_benchmark.cu +++ b/cpp/benchmarks/copying/gather_benchmark.cu @@ -42,7 +42,7 @@ void BM_gather(benchmark::State& state) const cudf::size_type n_cols = (cudf::size_type)state.range(1); // Every element is valid - auto data = cudf::test::make_counting_transform_iterator(0, [](auto i) { return i; }); + auto data = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i; }); // Gather indices std::vector host_map_data(source_size); diff --git a/cpp/benchmarks/copying/scatter_benchmark.cu b/cpp/benchmarks/copying/scatter_benchmark.cu index 1370b5a3926..0c24dd50a13 100644 --- a/cpp/benchmarks/copying/scatter_benchmark.cu +++ b/cpp/benchmarks/copying/scatter_benchmark.cu @@ -43,7 +43,7 @@ void BM_scatter(benchmark::State& state) const cudf::size_type n_cols = (cudf::size_type)state.range(1); // Every element is valid - auto data = cudf::test::make_counting_transform_iterator(0, [](auto i) { return i; }); + auto data = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i; }); // Gather indices std::vector host_map_data(source_size); diff --git a/cpp/benchmarks/groupby/group_nth_benchmark.cu b/cpp/benchmarks/groupby/group_nth_benchmark.cu index dda3a98e530..9765a4a265c 100644 --- a/cpp/benchmarks/groupby/group_nth_benchmark.cu +++ b/cpp/benchmarks/groupby/group_nth_benchmark.cu @@ -47,7 +47,7 @@ void BM_pre_sorted_nth(benchmark::State& state) // const cudf::size_type num_columns{(cudf::size_type)state.range(0)}; const cudf::size_type column_size{(cudf::size_type)state.range(0)}; - auto data_it = cudf::test::make_counting_transform_iterator( + auto data_it = cudf::detail::make_counting_transform_iterator( 0, [=](cudf::size_type row) { return random_int(0, 100); }); wrapper keys(data_it, data_it + column_size); diff --git a/cpp/benchmarks/groupby/group_sum_benchmark.cu b/cpp/benchmarks/groupby/group_sum_benchmark.cu index 94382e03141..1455f1cecdc 100644 --- a/cpp/benchmarks/groupby/group_sum_benchmark.cu +++ b/cpp/benchmarks/groupby/group_sum_benchmark.cu @@ -47,7 +47,7 @@ void BM_basic_sum(benchmark::State& state) // const cudf::size_type num_columns{(cudf::size_type)state.range(0)}; const cudf::size_type column_size{(cudf::size_type)state.range(0)}; - auto data_it = cudf::test::make_counting_transform_iterator( + auto data_it = cudf::detail::make_counting_transform_iterator( 0, [=](cudf::size_type row) { return random_int(0, 100); }); wrapper keys(data_it, data_it + column_size); @@ -81,7 +81,7 @@ void BM_pre_sorted_sum(benchmark::State& state) const cudf::size_type column_size{(cudf::size_type)state.range(0)}; - auto data_it = cudf::test::make_counting_transform_iterator( + auto data_it = cudf::detail::make_counting_transform_iterator( 0, [=](cudf::size_type row) { return random_int(0, 100); }); wrapper keys(data_it, data_it + column_size); diff --git a/cpp/benchmarks/merge/merge_benchmark.cpp b/cpp/benchmarks/merge/merge_benchmark.cpp index 3cce619125e..13eb284a903 100644 --- a/cpp/benchmarks/merge/merge_benchmark.cpp +++ b/cpp/benchmarks/merge/merge_benchmark.cpp @@ -62,7 +62,7 @@ void BM_merge(benchmark::State& state) auto const clamped_rows = std::max(std::min(rows, avg_rows * 2), 0); int32_t prev_key = 0; - auto key_sequence = cudf::test::make_counting_transform_iterator(0, [&](auto row) { + auto key_sequence = cudf::detail::make_counting_transform_iterator(0, [&](auto row) { prev_key += key_dist(rand_gen); return prev_key; }); diff --git a/cpp/benchmarks/reduction/anyall_benchmark.cpp b/cpp/benchmarks/reduction/anyall_benchmark.cpp index 1bd2b53e86f..72379725abf 100644 --- a/cpp/benchmarks/reduction/anyall_benchmark.cpp +++ b/cpp/benchmarks/reduction/anyall_benchmark.cpp @@ -34,7 +34,7 @@ void BM_reduction_anyall(benchmark::State& state, std::unique_ptr(state.range(0))}; cudf::test::UniformRandomGenerator rand_gen(0, 100); - auto data_it = cudf::test::make_counting_transform_iterator( + auto data_it = cudf::detail::make_counting_transform_iterator( 0, [&rand_gen](cudf::size_type row) { return rand_gen.generate(); }); cudf::test::fixed_width_column_wrapper values( data_it, data_it + column_size); diff --git a/cpp/benchmarks/reduction/minmax_benchmark.cpp b/cpp/benchmarks/reduction/minmax_benchmark.cpp index e462a7b8987..45d041a7f8a 100644 --- a/cpp/benchmarks/reduction/minmax_benchmark.cpp +++ b/cpp/benchmarks/reduction/minmax_benchmark.cpp @@ -34,7 +34,7 @@ void BM_reduction(benchmark::State& state) const cudf::size_type column_size{(cudf::size_type)state.range(0)}; cudf::test::UniformRandomGenerator rand_gen(0, 100); - auto data_it = cudf::test::make_counting_transform_iterator( + auto data_it = cudf::detail::make_counting_transform_iterator( 0, [&rand_gen](cudf::size_type row) { return rand_gen.generate(); }); cudf::test::fixed_width_column_wrapper values( data_it, data_it + column_size); diff --git a/cpp/benchmarks/reduction/reduce_benchmark.cpp b/cpp/benchmarks/reduction/reduce_benchmark.cpp index 1cb2d2bcc8b..9368eaffbcc 100644 --- a/cpp/benchmarks/reduction/reduce_benchmark.cpp +++ b/cpp/benchmarks/reduction/reduce_benchmark.cpp @@ -35,7 +35,7 @@ void BM_reduction(benchmark::State& state, std::unique_ptr co const cudf::size_type column_size{(cudf::size_type)state.range(0)}; cudf::test::UniformRandomGenerator rand_gen(0, 100); - auto data_it = cudf::test::make_counting_transform_iterator( + auto data_it = cudf::detail::make_counting_transform_iterator( 0, [&rand_gen](cudf::size_type row) { return rand_gen.generate(); }); cudf::test::fixed_width_column_wrapper values( data_it, data_it + column_size); diff --git a/cpp/benchmarks/search/search_benchmark.cu b/cpp/benchmarks/search/search_benchmark.cu index d2a5f588df3..7b4b8060514 100644 --- a/cpp/benchmarks/search/search_benchmark.cu +++ b/cpp/benchmarks/search/search_benchmark.cu @@ -36,9 +36,9 @@ void BM_non_null_column(benchmark::State& state) const cudf::size_type column_size{(cudf::size_type)state.range(0)}; const cudf::size_type values_size = column_size; - auto col_data_it = cudf::test::make_counting_transform_iterator( + auto col_data_it = cudf::detail::make_counting_transform_iterator( 0, [=](cudf::size_type row) { return static_cast(row); }); - auto val_data_it = cudf::test::make_counting_transform_iterator( + auto val_data_it = cudf::detail::make_counting_transform_iterator( 0, [=](cudf::size_type row) { return static_cast(values_size - row); }); cudf::test::fixed_width_column_wrapper column(col_data_it, col_data_it + column_size); @@ -67,7 +67,7 @@ auto make_validity_iter() cudf::test::UniformRandomGenerator rand_gen(r_min, r_max); uint8_t mod_base = rand_gen.generate(); - return cudf::test::make_counting_transform_iterator( + return cudf::detail::make_counting_transform_iterator( 0, [mod_base](auto row) { return (row % mod_base) > 0; }); } @@ -76,9 +76,9 @@ void BM_nullable_column(benchmark::State& state) const cudf::size_type column_size{(cudf::size_type)state.range(0)}; const cudf::size_type values_size = column_size; - auto col_data_it = cudf::test::make_counting_transform_iterator( + auto col_data_it = cudf::detail::make_counting_transform_iterator( 0, [=](cudf::size_type row) { return static_cast(row); }); - auto val_data_it = cudf::test::make_counting_transform_iterator( + auto val_data_it = cudf::detail::make_counting_transform_iterator( 0, [=](cudf::size_type row) { return static_cast(values_size - row); }); cudf::test::fixed_width_column_wrapper column( @@ -114,9 +114,9 @@ void BM_table(benchmark::State& state) auto make_table = [&](cudf::size_type col_size) { cudf::test::UniformRandomGenerator random_gen(0, 100); - auto data_it = cudf::test::make_counting_transform_iterator( + auto data_it = cudf::detail::make_counting_transform_iterator( 0, [&](cudf::size_type row) { return random_gen.generate(); }); - auto valid_it = cudf::test::make_counting_transform_iterator( + auto valid_it = cudf::detail::make_counting_transform_iterator( 0, [&](cudf::size_type row) { return random_gen.generate() < 90; }); std::vector> cols; diff --git a/cpp/benchmarks/sort/sort_benchmark.cpp b/cpp/benchmarks/sort/sort_benchmark.cpp index 89eea0f0ce9..fb74469e7c0 100644 --- a/cpp/benchmarks/sort/sort_benchmark.cpp +++ b/cpp/benchmarks/sort/sort_benchmark.cpp @@ -46,10 +46,10 @@ static void BM_sort(benchmark::State& state, bool nulls) std::vector columns; columns.reserve(n_cols); std::generate_n(std::back_inserter(columns), n_cols, [&, n_rows]() { - auto elements = cudf::test::make_counting_transform_iterator( + auto elements = cudf::detail::make_counting_transform_iterator( 0, [&](auto row) { return distribution(generator); }); if (!nulls) return column_wrapper(elements, elements + n_rows); - auto valids = cudf::test::make_counting_transform_iterator( + auto valids = cudf::detail::make_counting_transform_iterator( 0, [](auto i) { return i % 100 == 0 ? false : true; }); return column_wrapper(elements, elements + n_rows, valids); }); diff --git a/cpp/benchmarks/stream_compaction/drop_duplicates_benchmark.cpp b/cpp/benchmarks/stream_compaction/drop_duplicates_benchmark.cpp index c432405850c..16bae725621 100644 --- a/cpp/benchmarks/stream_compaction/drop_duplicates_benchmark.cpp +++ b/cpp/benchmarks/stream_compaction/drop_duplicates_benchmark.cpp @@ -34,9 +34,9 @@ void BM_compaction(benchmark::State& state, cudf::duplicate_keep_option keep) auto const n_rows = static_cast(state.range(0)); cudf::test::UniformRandomGenerator rand_gen(0, 100); - auto elements = cudf::test::make_counting_transform_iterator( + auto elements = cudf::detail::make_counting_transform_iterator( 0, [&rand_gen](auto row) { return rand_gen.generate(); }); - auto valids = cudf::test::make_counting_transform_iterator( + auto valids = cudf::detail::make_counting_transform_iterator( 0, [](auto i) { return i % 100 == 0 ? false : true; }); cudf::test::fixed_width_column_wrapper values(elements, elements + n_rows, valids); diff --git a/cpp/benchmarks/string/convert_durations_benchmark.cpp b/cpp/benchmarks/string/convert_durations_benchmark.cpp index 3498191c4f3..5259ac29f99 100644 --- a/cpp/benchmarks/string/convert_durations_benchmark.cpp +++ b/cpp/benchmarks/string/convert_durations_benchmark.cpp @@ -40,7 +40,7 @@ void BM_convert_from_durations(benchmark::State& state) const cudf::size_type source_size = state.range(0); // Every element is valid - auto data = cudf::test::make_counting_transform_iterator( + auto data = cudf::detail::make_counting_transform_iterator( 0, [source_size](auto i) { return TypeParam{i - source_size / 2}; }); cudf::test::fixed_width_column_wrapper source_durations(data, data + source_size); @@ -61,7 +61,7 @@ void BM_convert_to_durations(benchmark::State& state) const cudf::size_type source_size = state.range(0); // Every element is valid - auto data = cudf::test::make_counting_transform_iterator( + auto data = cudf::detail::make_counting_transform_iterator( 0, [source_size](auto i) { return TypeParam{i - source_size / 2}; }); cudf::test::fixed_width_column_wrapper source_durations(data, data + source_size); diff --git a/cpp/benchmarks/type_dispatcher/type_dispatcher_benchmark.cu b/cpp/benchmarks/type_dispatcher/type_dispatcher_benchmark.cu index e8520667ef8..df3a373c576 100644 --- a/cpp/benchmarks/type_dispatcher/type_dispatcher_benchmark.cu +++ b/cpp/benchmarks/type_dispatcher/type_dispatcher_benchmark.cu @@ -165,7 +165,7 @@ void type_dispatcher_benchmark(::benchmark::State& state) const cudf::size_type work_per_thread = static_cast(state.range(2)); - auto data = cudf::test::make_counting_transform_iterator(0, [](auto i) { return i; }); + auto data = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i; }); std::vector> source_column_wrappers; std::vector source_columns; diff --git a/cpp/docs/TESTING.md b/cpp/docs/TESTING.md index 6b11a3d1f1c..638f7224ab8 100644 --- a/cpp/docs/TESTING.md +++ b/cpp/docs/TESTING.md @@ -400,7 +400,7 @@ string_column_wrapper child_string_col_wrapper {"All", "the", "leaves", "are", " struct_column_wrapper struct_column_wrapper{ {child_int_col_wrapper, child_string_col_wrapper} - cudf::test::make_counting_transform_iterator(0, [](auto i){ return i%2; }) // Validity + cudf::detail::make_counting_transform_iterator(0, [](auto i){ return i%2; }) // Validity }; auto struct_col {struct_column_wrapper.release()}; diff --git a/cpp/include/cudf/column/column_device_view.cuh b/cpp/include/cudf/column/column_device_view.cuh index 1672f0d69aa..9f5c2f33aa6 100644 --- a/cpp/include/cudf/column/column_device_view.cuh +++ b/cpp/include/cudf/column/column_device_view.cuh @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2020, NVIDIA CORPORATION. + * Copyright (c) 2019-2021, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +15,6 @@ */ #pragma once -#include #include #include #include @@ -33,6 +32,8 @@ #include #include +#include + /** * @file column_device_view.cuh * @brief Column device view class definitons @@ -592,6 +593,7 @@ class alignas(16) mutable_column_device_view : public detail::column_device_view return d_children[child_index]; } +#ifdef __CUDACC__ // because set_bit in bit.hpp is wrapped with __CUDACC__ /** * @brief Updates the null mask to indicate that the specified element is * valid @@ -629,6 +631,8 @@ class alignas(16) mutable_column_device_view : public detail::column_device_view return clear_bit(null_mask(), element_index); } +#endif + /** * @brief Updates the specified bitmask word in the `null_mask()` with a * new word. @@ -795,6 +799,8 @@ __device__ inline numeric::decimal64 const column_device_view::element #include +#include +#include +#include + namespace cudf { namespace detail { /** @@ -316,5 +320,31 @@ auto inline make_pair_iterator(scalar const& scalar_value) scalar_pair_accessor{scalar_value}); } +/** + * @brief Convenience wrapper for creating a `thrust::transform_iterator` over a + * `thrust::counting_iterator`. + * + * Example: + * @code{.cpp} + * // Returns square of the value of the counting iterator + * auto iter = make_counting_transform_iterator(0, [](auto i){ return (i * i);}); + * iter[0] == 0 + * iter[1] == 1 + * iter[2] == 4 + * ... + * iter[n] == n * n + * @endcode + * + * @param start The starting value of the counting iterator + * @param f The unary function to apply to the counting iterator. + * This should be a host function and not a device function. + * @return auto A transform iterator that applies `f` to a counting iterator + */ +template +inline auto make_counting_transform_iterator(cudf::size_type start, UnaryFunction f) +{ + return thrust::make_transform_iterator(thrust::make_counting_iterator(start), f); +} + } // namespace detail } // namespace cudf diff --git a/cpp/include/cudf_test/column_wrapper.hpp b/cpp/include/cudf_test/column_wrapper.hpp index ac32801264a..55b7096f96f 100644 --- a/cpp/include/cudf_test/column_wrapper.hpp +++ b/cpp/include/cudf_test/column_wrapper.hpp @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -35,6 +36,7 @@ #include #include +#include #include #include @@ -45,32 +47,6 @@ namespace cudf { namespace test { -/** - * @brief Convenience wrapper for creating a `thrust::transform_iterator` over a - * `thrust::counting_iterator`. - * - * Example: - * @code{.cpp} - * // Returns square of the value of the counting iterator - * auto iter = make_counting_transform_iterator(0, [](auto i){ return (i * i);}); - * iter[0] == 0 - * iter[1] == 1 - * iter[2] == 4 - * ... - * iter[n] == n * n - * @endcode - * - * @param start The starting value of the counting iterator - * @param f The unary function to apply to the counting iterator. - * This should be a host function and not a device function. - * @return auto A transform iterator that applies `f` to a counting iterator - */ -template -auto make_counting_transform_iterator(cudf::size_type start, UnaryFunction f) -{ - return thrust::make_transform_iterator(thrust::make_counting_iterator(start), f); -} - namespace detail { /** * @brief Base class for a wrapper around a `cudf::column`. @@ -723,7 +699,7 @@ class strings_column_wrapper : public detail::column_wrapper { { std::vector chars; std::vector offsets; - auto all_valid = make_counting_transform_iterator(0, [](auto i) { return true; }); + auto all_valid = thrust::make_constant_iterator(true); std::tie(chars, offsets) = detail::make_chars_and_offsets(begin, end, all_valid); wrapped = cudf::make_strings_column(chars, offsets); } @@ -1476,7 +1452,7 @@ class lists_column_wrapper : public detail::column_wrapper { void build_from_nested(std::initializer_list> elements, std::vector const& v) { - auto valids = cudf::test::make_counting_transform_iterator( + auto valids = cudf::detail::make_counting_transform_iterator( 0, [&v](auto i) { return v.empty() ? true : v[i]; }); // compute the expected hierarchy and depth @@ -1753,7 +1729,7 @@ class structs_column_wrapper : public detail::column_wrapper { * * struct_column_wrapper struct_column_wrapper{ * {child_int_col_wrapper, child_string_col_wrapper} - * cudf::test::make_counting_transform_iterator(0, [](auto i){ return i%2; }) // Validity. + * cudf::detail::make_counting_transform_iterator(0, [](auto i){ return i%2; }) // Validity. * }; * * auto struct_col {struct_column_wrapper.release()}; diff --git a/cpp/include/cudf_test/timestamp_utilities.cuh b/cpp/include/cudf_test/timestamp_utilities.cuh index b1c94916f70..201b837e936 100644 --- a/cpp/include/cudf_test/timestamp_utilities.cuh +++ b/cpp/include/cudf_test/timestamp_utilities.cuh @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2020, NVIDIA CORPORATION. + * Copyright (c) 2019-2021, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,7 +16,9 @@ #pragma once +#include #include + #include #include @@ -57,14 +59,15 @@ inline cudf::test::fixed_width_column_wrapper generate_timestamps(in auto min = std::min(lhs, rhs); auto max = std::max(lhs, rhs); auto range = max - min; - auto iter = cudf::test::make_counting_transform_iterator(0, [=](auto i) { + auto iter = cudf::detail::make_counting_transform_iterator(0, [=](auto i) { return cuda::std::chrono::floor( cuda::std::chrono::milliseconds(min + (range / count) * i)) .count(); }); if (nullable) { - auto mask = cudf::test::make_counting_transform_iterator(0, [](auto i) { return i % 2 == 0; }); + auto mask = + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i % 2 == 0; }); return cudf::test::fixed_width_column_wrapper(iter, iter + count, mask); } else { // This needs to be in an else to quash `statement_not_reachable` warnings diff --git a/cpp/tests/binaryop/binop-fixture.hpp b/cpp/tests/binaryop/binop-fixture.hpp index d6d25ea33e2..c5ef3727e4e 100644 --- a/cpp/tests/binaryop/binop-fixture.hpp +++ b/cpp/tests/binaryop/binop-fixture.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2020, NVIDIA CORPORATION. + * Copyright (c) 2019-2021, NVIDIA CORPORATION. * * Copyright 2018-2019 BlazingDB, Inc. * Copyright 2018 Christian Noboa Mardini @@ -19,6 +19,7 @@ #pragma once +#include #include #include #include @@ -36,7 +37,7 @@ struct BinaryOperationTest : public cudf::test::BaseFixture { template auto make_data_iter(cudf::test::UniformRandomGenerator& rand_gen) { - return cudf::test::make_counting_transform_iterator( + return cudf::detail::make_counting_transform_iterator( 0, [&](auto row) { return rand_gen.generate(); }); } @@ -44,7 +45,7 @@ struct BinaryOperationTest : public cudf::test::BaseFixture { { cudf::test::UniformRandomGenerator rand_gen(r_min, r_max); uint8_t mod_base = rand_gen.generate(); - return cudf::test::make_counting_transform_iterator( + return cudf::detail::make_counting_transform_iterator( 0, [mod_base](auto row) { return (row % mod_base) > 0; }); } diff --git a/cpp/tests/binaryop/binop-integration-test.cpp b/cpp/tests/binaryop/binop-integration-test.cpp index 07342f0413c..2d17853a72b 100644 --- a/cpp/tests/binaryop/binop-integration-test.cpp +++ b/cpp/tests/binaryop/binop-integration-test.cpp @@ -18,6 +18,7 @@ */ #include +#include #include #include #include @@ -655,7 +656,7 @@ TEST_F(BinaryOperationIntegrationTest, Greater_Vector_Vector_B8_TSMS_TSS) using GREATER = cudf::library::operation::Greater; cudf::test::UniformRandomGenerator rand_gen(1, 10); - auto itr = cudf::test::make_counting_transform_iterator( + auto itr = cudf::detail::make_counting_transform_iterator( 0, [&rand_gen](auto row) { return rand_gen.generate() * 1000; }); cudf::test::fixed_width_column_wrapper lhs( @@ -1018,7 +1019,7 @@ TEST_F(BinaryOperationIntegrationTest, LogBase_Vector_Scalar_SI32_SI32_float) using LOG_BASE = cudf::library::operation::LogBase; // Make sure there are no zeros. The log value is purposefully cast to int for easy comparison - auto elements = make_counting_transform_iterator(1, [](auto i) { return i + 10; }); + auto elements = cudf::detail::make_counting_transform_iterator(1, [](auto i) { return i + 10; }); fixed_width_column_wrapper lhs(elements, elements + 100); // Find log to the base 10 auto rhs = numeric_scalar(10); @@ -1037,7 +1038,7 @@ TEST_F(BinaryOperationIntegrationTest, LogBase_Scalar_Vector_float_SI32) using LOG_BASE = cudf::library::operation::LogBase; // Make sure there are no zeros - auto elements = make_counting_transform_iterator(1, [](auto i) { return i + 30; }); + auto elements = cudf::detail::make_counting_transform_iterator(1, [](auto i) { return i + 30; }); fixed_width_column_wrapper rhs(elements, elements + 100); // Find log to the base 2 auto lhs = numeric_scalar(2); @@ -1056,11 +1057,12 @@ TEST_F(BinaryOperationIntegrationTest, LogBase_Vector_Vector_double_SI64_SI32) using LOG_BASE = cudf::library::operation::LogBase; // Make sure there are no zeros - auto elements = make_counting_transform_iterator(1, [](auto i) { return std::pow(2, i); }); + auto elements = + cudf::detail::make_counting_transform_iterator(1, [](auto i) { return std::pow(2, i); }); fixed_width_column_wrapper lhs(elements, elements + 50); // Find log to the base 7 - auto rhs_elements = make_counting_transform_iterator(0, [](auto) { return 7; }); + auto rhs_elements = cudf::detail::make_counting_transform_iterator(0, [](auto) { return 7; }); fixed_width_column_wrapper rhs(rhs_elements, rhs_elements + 50); auto out = cudf::binary_operation( lhs, rhs, cudf::binary_operator::LOG_BASE, data_type(type_to_id())); @@ -2024,7 +2026,7 @@ TYPED_TEST(FixedPointTestBothReps, FixedPointBinaryOpAdd) auto const sz = std::size_t{1000}; - auto begin = make_counting_transform_iterator(1, [](auto i) { + auto begin = cudf::detail::make_counting_transform_iterator(1, [](auto i) { return decimalXX{i, scale_type{0}}; }); auto const vec1 = std::vector(begin, begin + sz); @@ -2053,7 +2055,7 @@ TYPED_TEST(FixedPointTestBothReps, FixedPointBinaryOpMultiply) auto const sz = std::size_t{1000}; - auto begin = make_counting_transform_iterator(1, [](auto i) { + auto begin = cudf::detail::make_counting_transform_iterator(1, [](auto i) { return decimalXX{i, scale_type{0}}; }); auto const vec1 = std::vector(begin, begin + sz); @@ -2144,8 +2146,9 @@ TYPED_TEST(FixedPointTestBothReps, FixedPointBinaryOpDiv4) using decimalXX = TypeParam; using RepType = device_storage_type_t; - auto begin = make_counting_transform_iterator(0, [](auto i) { return i * 11; }); - auto result_begin = make_counting_transform_iterator(0, [](auto i) { return (i * 11) / 12; }); + auto begin = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i * 11; }); + auto result_begin = + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return (i * 11) / 12; }); auto const lhs = fp_wrapper(begin, begin + 1000, scale_type{-1}); auto const rhs = make_fixed_point_scalar(12, scale_type{-1}); auto const expected = fp_wrapper(result_begin, result_begin + 1000, scale_type{0}); @@ -2241,7 +2244,7 @@ TYPED_TEST(FixedPointTestBothReps, FixedPointBinaryOpEqualLessGreater) // TESTING binary op ADD - auto begin = make_counting_transform_iterator(1, [](auto e) { return e * 1000; }); + auto begin = cudf::detail::make_counting_transform_iterator(1, [](auto e) { return e * 1000; }); auto const vec1 = std::vector(begin, begin + sz); auto const vec2 = std::vector(sz, 0); diff --git a/cpp/tests/binaryop/binop-null-test.cpp b/cpp/tests/binaryop/binop-null-test.cpp index 3277e991b94..184bafc8c57 100644 --- a/cpp/tests/binaryop/binop-null-test.cpp +++ b/cpp/tests/binaryop/binop-null-test.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2020, NVIDIA CORPORATION. + * Copyright (c) 2019-2021, NVIDIA CORPORATION. * * Copyright 2018-2019 BlazingDB, Inc. * Copyright 2018 Christian Noboa Mardini @@ -18,6 +18,7 @@ */ #include +#include #include #include @@ -35,13 +36,13 @@ struct BinaryOperationNullTest : public BinaryOperationTest { switch (state) { case mask_state::ALL_NULL: { auto validity_iter = - cudf::test::make_counting_transform_iterator(0, [](auto row) { return false; }); + cudf::detail::make_counting_transform_iterator(0, [](auto row) { return false; }); return cudf::test::fixed_width_column_wrapper( data_iter, data_iter + size, validity_iter); } case mask_state::ALL_VALID: { auto validity_iter = - cudf::test::make_counting_transform_iterator(0, [](auto row) { return true; }); + cudf::detail::make_counting_transform_iterator(0, [](auto row) { return true; }); return cudf::test::fixed_width_column_wrapper( data_iter, data_iter + size, validity_iter); } diff --git a/cpp/tests/bitmask/valid_if_tests.cu b/cpp/tests/bitmask/valid_if_tests.cu index 62300b73054..fc60011d39d 100644 --- a/cpp/tests/bitmask/valid_if_tests.cu +++ b/cpp/tests/bitmask/valid_if_tests.cu @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, NVIDIA CORPORATION. + * Copyright (c) 2019-2021, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,8 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + +#include #include #include + #include #include #include @@ -53,7 +56,7 @@ TEST_F(ValidIfTest, InvalidRange) TEST_F(ValidIfTest, OddsValid) { - auto iter = cudf::test::make_counting_transform_iterator(0, odds_valid{}); + auto iter = cudf::detail::make_counting_transform_iterator(0, odds_valid{}); auto expected = cudf::test::detail::make_null_mask(iter, iter + 10000); auto actual = cudf::detail::valid_if( thrust::make_counting_iterator(0), thrust::make_counting_iterator(10000), odds_valid{}); @@ -63,7 +66,7 @@ TEST_F(ValidIfTest, OddsValid) TEST_F(ValidIfTest, AllValid) { - auto iter = cudf::test::make_counting_transform_iterator(0, all_valid{}); + auto iter = cudf::detail::make_counting_transform_iterator(0, all_valid{}); auto expected = cudf::test::detail::make_null_mask(iter, iter + 10000); auto actual = cudf::detail::valid_if( thrust::make_counting_iterator(0), thrust::make_counting_iterator(10000), all_valid{}); @@ -73,7 +76,7 @@ TEST_F(ValidIfTest, AllValid) TEST_F(ValidIfTest, AllNull) { - auto iter = cudf::test::make_counting_transform_iterator(0, all_null{}); + auto iter = cudf::detail::make_counting_transform_iterator(0, all_null{}); auto expected = cudf::test::detail::make_null_mask(iter, iter + 10000); auto actual = cudf::detail::valid_if( thrust::make_counting_iterator(0), thrust::make_counting_iterator(10000), all_null{}); diff --git a/cpp/tests/collect_list/collect_list_test.cpp b/cpp/tests/collect_list/collect_list_test.cpp index 8021d7171b3..dada82c3dc1 100644 --- a/cpp/tests/collect_list/collect_list_test.cpp +++ b/cpp/tests/collect_list/collect_list_test.cpp @@ -22,6 +22,7 @@ #include #include +#include #include #include #include @@ -153,7 +154,7 @@ TYPED_TEST(TypedCollectListTest, RollingWindowHonoursMinPeriods) auto const expected_result = lists_column_wrapper{ {{}, {0, 1, 2}, {1, 2, 3}, {2, 3, 4}, {3, 4, 5}, {}}, - make_counting_transform_iterator(0, [num_elements](auto i) { + cudf::detail::make_counting_transform_iterator(0, [num_elements](auto i) { return i != 0 && i != (num_elements - 1); })}.release(); @@ -167,7 +168,7 @@ TYPED_TEST(TypedCollectListTest, RollingWindowHonoursMinPeriods) rolling_window(input_column, preceding, following, min_periods, make_collect_aggregation()); auto expected_result_2 = lists_column_wrapper{ {{}, {0, 1, 2, 3}, {1, 2, 3, 4}, {2, 3, 4, 5}, {}, {}}, - make_counting_transform_iterator(0, [num_elements](auto i) { + cudf::detail::make_counting_transform_iterator(0, [num_elements](auto i) { return i != 0 && i < 4; })}.release(); @@ -205,7 +206,7 @@ TYPED_TEST(TypedCollectListTest, RollingWindowWithNullInputsHonoursMinPeriods) expected_result_child_validity.begin()); auto expected_offsets = fixed_width_column_wrapper{0, 0, 3, 6, 9, 12, 12}.release(); auto expected_num_rows = expected_offsets->size() - 1; - auto null_mask_iter = make_counting_transform_iterator( + auto null_mask_iter = cudf::detail::make_counting_transform_iterator( size_type{0}, [expected_num_rows](auto i) { return i != 0 && i != (expected_num_rows - 1); }); auto expected_result = make_lists_column( @@ -235,7 +236,7 @@ TYPED_TEST(TypedCollectListTest, RollingWindowWithNullInputsHonoursMinPeriods) auto expected_offsets = fixed_width_column_wrapper{0, 0, 4, 8, 12, 12, 12}.release(); auto expected_num_rows = expected_offsets->size() - 1; - auto null_mask_iter = make_counting_transform_iterator( + auto null_mask_iter = cudf::detail::make_counting_transform_iterator( size_type{0}, [expected_num_rows](auto i) { return i > 0 && i < 4; }); auto expected_result = make_lists_column( @@ -268,7 +269,7 @@ TEST_F(CollectListTest, RollingWindowHonoursMinPeriodsOnStrings) auto const expected_result = lists_column_wrapper{ {{}, {"0", "1", "2"}, {"1", "2", "3"}, {"2", "3", "4"}, {"3", "4", "5"}, {}}, - make_counting_transform_iterator(0, [num_elements](auto i) { + cudf::detail::make_counting_transform_iterator(0, [num_elements](auto i) { return i != 0 && i != (num_elements - 1); })}.release(); @@ -282,7 +283,7 @@ TEST_F(CollectListTest, RollingWindowHonoursMinPeriodsOnStrings) rolling_window(input_column, preceding, following, min_periods, make_collect_aggregation()); auto expected_result_2 = lists_column_wrapper{ {{}, {"0", "1", "2", "3"}, {"1", "2", "3", "4"}, {"2", "3", "4", "5"}, {}, {}}, - make_counting_transform_iterator(0, [num_elements](auto i) { + cudf::detail::make_counting_transform_iterator(0, [num_elements](auto i) { return i != 0 && i < 4; })}.release(); @@ -297,7 +298,8 @@ TEST_F(CollectListTest, RollingWindowHonoursMinPeriodsWithDecimal) using namespace cudf; using namespace cudf::test; - auto const input_iter = make_counting_transform_iterator(0, thrust::identity{}); + auto const input_iter = + cudf::detail::make_counting_transform_iterator(0, thrust::identity{}); auto const input_column = fixed_point_column_wrapper{input_iter, input_iter + 6, numeric::scale_type{0}}; @@ -316,7 +318,7 @@ TEST_F(CollectListTest, RollingWindowHonoursMinPeriodsWithDecimal) numeric::scale_type{0}}; auto expected_offsets = fixed_width_column_wrapper{0, 0, 3, 6, 9, 12, 12}.release(); auto expected_num_rows = expected_offsets->size() - 1; - auto null_mask_iter = make_counting_transform_iterator( + auto null_mask_iter = cudf::detail::make_counting_transform_iterator( size_type{0}, [expected_num_rows](auto i) { return i != 0 && i != (expected_num_rows - 1); }); auto expected_result = make_lists_column( @@ -344,7 +346,7 @@ TEST_F(CollectListTest, RollingWindowHonoursMinPeriodsWithDecimal) numeric::scale_type{0}}; auto expected_offsets = fixed_width_column_wrapper{0, 0, 4, 8, 12, 12, 12}.release(); auto expected_num_rows = expected_offsets->size() - 1; - auto null_mask_iter = make_counting_transform_iterator( + auto null_mask_iter = cudf::detail::make_counting_transform_iterator( size_type{0}, [expected_num_rows](auto i) { return i > 0 && i < 4; }); auto expected_result = make_lists_column( @@ -594,7 +596,7 @@ TYPED_TEST(TypedCollectListTest, GroupedTimeRangeRollingWindowWithMinPeriods) {}, {}, {}}, - make_counting_transform_iterator(0, [](auto i) { + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i < 5; })}.release(); @@ -636,7 +638,7 @@ TEST_F(CollectListTest, GroupedTimeRangeRollingWindowOnStringsWithMinPeriods) {}, {}, {}}, - make_counting_transform_iterator(0, [](auto i) { + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i < 5; })}.release(); @@ -690,7 +692,8 @@ TYPED_TEST(TypedCollectListTest, GroupedTimeRangeRollingWindowOnStructsWithMinPe auto expected_structs_column = make_structs_column(23, std::move(expected_struct_members), 0, {}); auto expected_offsets_column = fixed_width_column_wrapper{0, 4, 8, 13, 18, 23, 23, 23, 23, 23}.release(); - auto expected_validity_iter = make_counting_transform_iterator(0, [](auto i) { return i < 5; }); + auto expected_validity_iter = + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i < 5; }); auto expected_null_mask = cudf::test::detail::make_null_mask(expected_validity_iter, expected_validity_iter + 9); auto expected_result = make_lists_column(9, diff --git a/cpp/tests/column/column_test.cu b/cpp/tests/column/column_test.cu index 88b8d656686..d23c0d74aad 100644 --- a/cpp/tests/column/column_test.cu +++ b/cpp/tests/column/column_test.cu @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2020, NVIDIA CORPORATION. + * Copyright (c) 2019-2021, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -435,10 +436,10 @@ TYPED_TEST(ListsColumnTest, ListsSlicedColumnViewConstructor) TYPED_TEST(ListsColumnTest, ListsSlicedColumnViewConstructorWithNulls) { - auto valids = cudf::test::make_counting_transform_iterator( + auto valids = cudf::detail::make_counting_transform_iterator( 0, [](auto i) { return i % 2 == 0 ? true : false; }); - auto expect_valids = cudf::test::make_counting_transform_iterator( + auto expect_valids = cudf::detail::make_counting_transform_iterator( 0, [](auto i) { return i % 2 == 0 ? false : true; }); using LCW = cudf::test::lists_column_wrapper; diff --git a/cpp/tests/copying/concatenate_tests.cu b/cpp/tests/copying/concatenate_tests.cu index e6cd6543d15..e63cbac1e72 100644 --- a/cpp/tests/copying/concatenate_tests.cu +++ b/cpp/tests/copying/concatenate_tests.cu @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, NVIDIA CORPORATION. + * Copyright (c) 2020-2021, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,17 +23,19 @@ #include #include #include +#include #include #include #include #include -#include #include #include #include +#include + template using column_wrapper = cudf::test::fixed_width_column_wrapper; @@ -721,7 +723,7 @@ TEST_F(ListsColumnTest, ConcatenateEmptyLists) TEST_F(ListsColumnTest, ConcatenateListsWithNulls) { - auto valids = cudf::test::make_counting_transform_iterator( + auto valids = cudf::detail::make_counting_transform_iterator( 0, [](auto i) { return i % 2 == 0 ? true : false; }); // nulls in the leaves @@ -821,7 +823,7 @@ TEST_F(ListsColumnTest, ConcatenateNestedEmptyLists) TEST_F(ListsColumnTest, ConcatenateNestedListsWithNulls) { - auto valids = cudf::test::make_counting_transform_iterator( + auto valids = cudf::detail::make_counting_transform_iterator( 0, [](auto i) { return i % 2 == 0 ? true : false; }); // nulls in the lists @@ -991,7 +993,8 @@ TEST_F(ListsColumnTest, SlicedColumnsWithNulls) { using LCW = cudf::test::lists_column_wrapper; - auto valids = cudf::test::make_counting_transform_iterator(0, [](auto i) { return i % 2 == 0; }); + auto valids = + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i % 2 == 0; }); { cudf::test::lists_column_wrapper a{{{{1, 1, 1}, valids}, {2, 2}, {{3, 3}, valids}}, @@ -1178,7 +1181,8 @@ TYPED_TEST(FixedPointTestBothReps, FixedPointConcatentate) using decimalXX = TypeParam; using fw_wrapper = cudf::test::fixed_width_column_wrapper; - auto begin = cudf::test::make_counting_transform_iterator(0, [](auto i) { return decimalXX{i}; }); + auto begin = + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return decimalXX{i}; }); auto const vec = std::vector(begin, begin + 1000); auto const a = fw_wrapper(vec.begin(), /***/ vec.begin() + 300); diff --git a/cpp/tests/copying/copy_range_tests.cpp b/cpp/tests/copying/copy_range_tests.cpp index e0103730564..1ab320cb8dc 100644 --- a/cpp/tests/copying/copy_range_tests.cpp +++ b/cpp/tests/copying/copy_range_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, NVIDIA CORPORATION. + * Copyright (c) 2019-2021, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,6 +23,7 @@ #include #include #include +#include #include #include @@ -75,26 +76,27 @@ TYPED_TEST(CopyRangeTypedTestFixture, CopyWithNulls) cudf::test::fixed_width_column_wrapper target( thrust::make_counting_iterator(0), thrust::make_counting_iterator(0) + size, - cudf::test::make_counting_transform_iterator(0, all_valid)); + cudf::detail::make_counting_transform_iterator(0, all_valid)); auto source_elements = - cudf::test::make_counting_transform_iterator(0, [](auto i) { return i * 2; }); + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i * 2; }); cudf::test::fixed_width_column_wrapper source( source_elements, source_elements + size, - cudf::test::make_counting_transform_iterator(0, even_valid)); + cudf::detail::make_counting_transform_iterator(0, even_valid)); auto expected_elements = - cudf::test::make_counting_transform_iterator(0, [target_begin, target_end, row_diff](auto i) { + cudf::detail::make_counting_transform_iterator(0, [target_begin, target_end, row_diff](auto i) { return ((i >= target_begin) && (i < target_end)) ? (i + row_diff) * 2 : i; }); cudf::test::fixed_width_column_wrapper - expected( - expected_elements, - expected_elements + size, - cudf::test::make_counting_transform_iterator(0, [target_begin, target_end, row_diff](auto i) { - return ((i >= target_begin) && (i < target_end)) ? even_valid(i + row_diff) : all_valid(i); - })); + expected(expected_elements, + expected_elements + size, + cudf::detail::make_counting_transform_iterator( + 0, [target_begin, target_end, row_diff](auto i) { + return ((i >= target_begin) && (i < target_end)) ? even_valid(i + row_diff) + : all_valid(i); + })); cudf::mutable_column_view target_view{target}; this->test(source, expected, target_view, source_begin, source_end, target_begin); @@ -115,12 +117,12 @@ TYPED_TEST(CopyRangeTypedTestFixture, CopyNoNulls) thrust::make_counting_iterator(0), thrust::make_counting_iterator(0) + size); auto source_elements = - cudf::test::make_counting_transform_iterator(0, [](auto i) { return i * 2; }); + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i * 2; }); cudf::test::fixed_width_column_wrapper source( source_elements, source_elements + size); auto expected_elements = - cudf::test::make_counting_transform_iterator(0, [target_begin, target_end, row_diff](auto i) { + cudf::detail::make_counting_transform_iterator(0, [target_begin, target_end, row_diff](auto i) { return ((i >= target_begin) && (i < target_end)) ? (i + row_diff) * 2 : i; }); cudf::test::fixed_width_column_wrapper @@ -146,7 +148,7 @@ TYPED_TEST(CopyRangeTypedTestFixture, CopyWithNullsNonzeroOffset) cudf::test::fixed_width_column_wrapper target( thrust::make_counting_iterator(0), thrust::make_counting_iterator(0) + size, - cudf::test::make_counting_transform_iterator(0, all_valid)); + cudf::detail::make_counting_transform_iterator(0, all_valid)); cudf::mutable_column_view tmp = target; cudf::mutable_column_view target_slice(tmp.type(), @@ -157,15 +159,15 @@ TYPED_TEST(CopyRangeTypedTestFixture, CopyWithNullsNonzeroOffset) target_offset); auto source_elements = - cudf::test::make_counting_transform_iterator(0, [](auto i) { return i * 2; }); + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i * 2; }); cudf::test::fixed_width_column_wrapper source( source_elements, source_elements + size, - cudf::test::make_counting_transform_iterator(0, even_valid)); + cudf::detail::make_counting_transform_iterator(0, even_valid)); auto source_slice = cudf::slice(source, std::vector{source_offset, size})[0]; - auto expected_elements = cudf::test::make_counting_transform_iterator( + auto expected_elements = cudf::detail::make_counting_transform_iterator( 0, [target_offset, target_begin, target_end, row_diff](auto i) { return ((i >= target_offset + target_begin) && (i < target_offset + target_end)) ? (i + row_diff) * 2 @@ -174,7 +176,7 @@ TYPED_TEST(CopyRangeTypedTestFixture, CopyWithNullsNonzeroOffset) cudf::test::fixed_width_column_wrapper expected(expected_elements, expected_elements + size, - cudf::test::make_counting_transform_iterator( + cudf::detail::make_counting_transform_iterator( 0, [target_offset, target_begin, target_end, row_diff](auto i) { return ((i >= target_offset + target_begin) && (i < target_offset + target_end)) ? even_valid(i + row_diff) @@ -198,29 +200,29 @@ TEST_F(CopyRangeTestFixture, CopyWithNullsString) auto target_end = target_begin + (source_end - source_begin); auto row_diff = source_begin - target_begin; - auto target_elements = - cudf::test::make_counting_transform_iterator(0, [](auto i) { return "#" + std::to_string(i); }); - auto target = - cudf::test::strings_column_wrapper(target_elements, - target_elements + size, - cudf::test::make_counting_transform_iterator(0, all_valid)); + auto target_elements = cudf::detail::make_counting_transform_iterator( + 0, [](auto i) { return "#" + std::to_string(i); }); + auto target = cudf::test::strings_column_wrapper( + target_elements, + target_elements + size, + cudf::detail::make_counting_transform_iterator(0, all_valid)); - auto source_elements = cudf::test::make_counting_transform_iterator( + auto source_elements = cudf::detail::make_counting_transform_iterator( 0, [](auto i) { return "#" + std::to_string(i * 2); }); - auto source = - cudf::test::strings_column_wrapper(source_elements, - source_elements + size, - cudf::test::make_counting_transform_iterator(0, even_valid)); + auto source = cudf::test::strings_column_wrapper( + source_elements, + source_elements + size, + cudf::detail::make_counting_transform_iterator(0, even_valid)); auto expected_elements = - cudf::test::make_counting_transform_iterator(0, [target_begin, target_end, row_diff](auto i) { + cudf::detail::make_counting_transform_iterator(0, [target_begin, target_end, row_diff](auto i) { auto num = std::to_string(((i >= target_begin) && (i < target_end)) ? (i + row_diff) * 2 : i); return "#" + num; }); auto expected = cudf::test::strings_column_wrapper( expected_elements, expected_elements + size, - cudf::test::make_counting_transform_iterator(0, [target_begin, target_end, row_diff](auto i) { + cudf::detail::make_counting_transform_iterator(0, [target_begin, target_end, row_diff](auto i) { return ((i >= target_begin) && (i < target_end)) ? even_valid(i + row_diff) : all_valid(i); })); @@ -237,16 +239,16 @@ TEST_F(CopyRangeTestFixture, CopyNoNullsString) auto target_end = target_begin + (source_end - source_begin); auto row_diff = source_begin - target_begin; - auto target_elements = - cudf::test::make_counting_transform_iterator(0, [](auto i) { return "#" + std::to_string(i); }); + auto target_elements = cudf::detail::make_counting_transform_iterator( + 0, [](auto i) { return "#" + std::to_string(i); }); auto target = cudf::test::strings_column_wrapper(target_elements, target_elements + size); - auto source_elements = cudf::test::make_counting_transform_iterator( + auto source_elements = cudf::detail::make_counting_transform_iterator( 0, [](auto i) { return "#" + std::to_string(i * 2); }); auto source = cudf::test::strings_column_wrapper(source_elements, source_elements + size); auto expected_elements = - cudf::test::make_counting_transform_iterator(0, [target_begin, target_end, row_diff](auto i) { + cudf::detail::make_counting_transform_iterator(0, [target_begin, target_end, row_diff](auto i) { auto num = std::to_string(((i >= target_begin) && (i < target_end)) ? (i + row_diff) * 2 : i); return "#" + num; }); @@ -267,25 +269,25 @@ TEST_F(CopyRangeTestFixture, CopyWithNullsNonzeroOffsetString) auto target_end = target_begin + (source_end - source_begin); auto row_diff = (source_offset + source_begin) - (target_offset + target_begin); - auto target_elements = - cudf::test::make_counting_transform_iterator(0, [](auto i) { return "#" + std::to_string(i); }); - auto target = - cudf::test::strings_column_wrapper(target_elements, - target_elements + size, - cudf::test::make_counting_transform_iterator(0, all_valid)); + auto target_elements = cudf::detail::make_counting_transform_iterator( + 0, [](auto i) { return "#" + std::to_string(i); }); + auto target = cudf::test::strings_column_wrapper( + target_elements, + target_elements + size, + cudf::detail::make_counting_transform_iterator(0, all_valid)); auto target_slice = cudf::slice(target, std::vector{target_offset, size})[0]; - auto source_elements = cudf::test::make_counting_transform_iterator( + auto source_elements = cudf::detail::make_counting_transform_iterator( 0, [](auto i) { return "#" + std::to_string(i * 2); }); - auto source = - cudf::test::strings_column_wrapper(source_elements, - source_elements + size, - cudf::test::make_counting_transform_iterator(0, even_valid)); + auto source = cudf::test::strings_column_wrapper( + source_elements, + source_elements + size, + cudf::detail::make_counting_transform_iterator(0, even_valid)); auto source_slice = cudf::slice(source, std::vector{source_offset, size})[0]; - auto expected_elements = cudf::test::make_counting_transform_iterator( + auto expected_elements = cudf::detail::make_counting_transform_iterator( 0, [target_offset, target_begin, target_end, row_diff](auto i) { auto num = std::to_string(((i >= target_offset + target_begin) && (i < target_offset + target_end)) @@ -296,7 +298,7 @@ TEST_F(CopyRangeTestFixture, CopyWithNullsNonzeroOffsetString) auto expected = cudf::test::strings_column_wrapper( expected_elements, expected_elements + size, - cudf::test::make_counting_transform_iterator( + cudf::detail::make_counting_transform_iterator( 0, [target_offset, target_begin, target_end, row_diff](auto i) { return ((i >= target_offset + target_begin) && (i < target_offset + target_end)) ? even_valid(i + row_diff) @@ -373,7 +375,7 @@ TEST_F(CopyRangeErrorTestFixture, InvalidInplaceCall) auto source = cudf::test::fixed_width_column_wrapper( thrust::make_counting_iterator(0), thrust::make_counting_iterator(0) + size, - cudf::test::make_counting_transform_iterator(0, even_valid)); + cudf::detail::make_counting_transform_iterator(0, even_valid)); cudf::mutable_column_view target_view{target}; // source has null values but target is not nullable. @@ -496,7 +498,8 @@ TYPED_TEST(FixedPointTypesCopyRange, FixedPointLarge) auto s = thrust::make_counting_iterator(-1000); auto t = thrust::make_constant_iterator(0); - auto e = make_counting_transform_iterator(500, [](int i) { return i < 1000 ? i : 0; }); + auto e = + cudf::detail::make_counting_transform_iterator(500, [](int i) { return i < 1000 ? i : 0; }); auto const source = fp_wrapper{s, s + 2000, scale_type{-1}}; auto const target = fp_wrapper{t, t + 2000, scale_type{-1}}; diff --git a/cpp/tests/copying/copy_tests.cu b/cpp/tests/copying/copy_tests.cu index cd62b9eb33d..e2f5d1eec5c 100644 --- a/cpp/tests/copying/copy_tests.cu +++ b/cpp/tests/copying/copy_tests.cu @@ -455,7 +455,7 @@ struct StringsCopyIfElseTest : public cudf::test::BaseFixture { TEST_F(StringsCopyIfElseTest, CopyIfElse) { - auto valids = cudf::test::make_counting_transform_iterator( + auto valids = cudf::detail::make_counting_transform_iterator( 0, [](auto i) { return i % 2 == 0 ? true : false; }); std::vector h_strings1{"eee", "bb", "", "aa", "bbb", "ééé"}; @@ -482,7 +482,7 @@ TEST_F(StringsCopyIfElseTest, CopyIfElse) TEST_F(StringsCopyIfElseTest, CopyIfElseScalarColumn) { - auto valids = cudf::test::make_counting_transform_iterator( + auto valids = cudf::detail::make_counting_transform_iterator( 0, [](auto i) { return i % 2 == 0 ? true : false; }); std::vector h_string1{"eee"}; @@ -510,7 +510,7 @@ TEST_F(StringsCopyIfElseTest, CopyIfElseScalarColumn) TEST_F(StringsCopyIfElseTest, CopyIfElseColumnScalar) { - auto valids = cudf::test::make_counting_transform_iterator( + auto valids = cudf::detail::make_counting_transform_iterator( 0, [](auto i) { return i % 2 == 0 ? true : false; }); std::vector h_string1{"eee"}; @@ -537,7 +537,7 @@ TEST_F(StringsCopyIfElseTest, CopyIfElseColumnScalar) TEST_F(StringsCopyIfElseTest, CopyIfElseScalarScalar) { - auto valids = cudf::test::make_counting_transform_iterator( + auto valids = cudf::detail::make_counting_transform_iterator( 0, [](auto i) { return i % 2 == 0 ? true : false; }); std::vector h_string1{"eee"}; @@ -595,8 +595,9 @@ TYPED_TEST(FixedPointTypes, FixedPointLarge) auto a = thrust::make_counting_iterator(-1000); auto b = thrust::make_constant_iterator(0); - auto m = make_counting_transform_iterator(-1000, [](int i) { return i > 0; }); - auto e = make_counting_transform_iterator(-1000, [](int i) { return std::max(0, i); }); + auto m = cudf::detail::make_counting_transform_iterator(-1000, [](int i) { return i > 0; }); + auto e = + cudf::detail::make_counting_transform_iterator(-1000, [](int i) { return std::max(0, i); }); auto const mask = cudf::test::fixed_width_column_wrapper(m, m + 2000); auto const A = fp_wrapper{a, a + 2000, scale_type{-3}}; diff --git a/cpp/tests/copying/detail_gather_tests.cu b/cpp/tests/copying/detail_gather_tests.cu index d14036516d6..8457171ac6a 100644 --- a/cpp/tests/copying/detail_gather_tests.cu +++ b/cpp/tests/copying/detail_gather_tests.cu @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, NVIDIA CORPORATION. + * Copyright (c) 2020-2021, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,12 +14,15 @@ * limitations under the License. */ #include + #include #include #include #include +#include #include #include + #include #include #include @@ -41,7 +44,7 @@ TYPED_TEST(GatherTest, GatherDetailDeviceVectorTest) rmm::device_vector gather_map(source_size); thrust::sequence(thrust::device, gather_map.begin(), gather_map.end()); - auto data = cudf::test::make_counting_transform_iterator(0, [](auto i) { return i; }); + auto data = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i; }); cudf::test::fixed_width_column_wrapper source_column(data, data + source_size); cudf::table_view source_table({source_column}); @@ -75,10 +78,10 @@ TYPED_TEST(GatherTest, GatherDetailInvalidIndexTest) { constexpr cudf::size_type source_size{1000}; - auto data = cudf::test::make_counting_transform_iterator(0, [](auto i) { return i; }); + auto data = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i; }); cudf::test::fixed_width_column_wrapper source_column(data, data + source_size); auto gather_map_data = - cudf::test::make_counting_transform_iterator(0, [](auto i) { return (i % 2) ? -1 : i; }); + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return (i % 2) ? -1 : i; }); cudf::test::fixed_width_column_wrapper gather_map(gather_map_data, gather_map_data + (source_size * 2)); @@ -90,8 +93,8 @@ TYPED_TEST(GatherTest, GatherDetailInvalidIndexTest) cudf::detail::negative_index_policy::NOT_ALLOWED); auto expect_data = - cudf::test::make_counting_transform_iterator(0, [](auto i) { return (i % 2) ? 0 : i; }); - auto expect_valid = cudf::test::make_counting_transform_iterator( + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return (i % 2) ? 0 : i; }); + auto expect_valid = cudf::detail::make_counting_transform_iterator( 0, [](auto i) { return (i % 2) || (i >= source_size) ? 0 : 1; }); cudf::test::fixed_width_column_wrapper expect_column( expect_data, expect_data + (source_size * 2), expect_valid); diff --git a/cpp/tests/copying/gather_list_tests.cu b/cpp/tests/copying/gather_list_tests.cu index 3369472687e..59f696c440e 100644 --- a/cpp/tests/copying/gather_list_tests.cu +++ b/cpp/tests/copying/gather_list_tests.cu @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, NVIDIA CORPORATION. + * Copyright (c) 2020-2021, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,13 +14,16 @@ * limitations under the License. */ #include + #include #include #include #include +#include #include #include #include + #include #include #include @@ -28,8 +31,6 @@ #include #include -#include - template class GatherTestListTyped : public cudf::test::BaseFixture { }; @@ -108,7 +109,7 @@ TYPED_TEST(GatherTestListTyped, GatherNulls) { using T = TypeParam; - auto valids = cudf::test::make_counting_transform_iterator( + auto valids = cudf::detail::make_counting_transform_iterator( 0, [](auto i) { return i % 2 == 0 ? true : false; }); // List @@ -190,7 +191,7 @@ TYPED_TEST(GatherTestListTyped, GatherNestedNulls) { using T = TypeParam; - auto valids = cudf::test::make_counting_transform_iterator( + auto valids = cudf::detail::make_counting_transform_iterator( 0, [](auto i) { return i % 2 == 0 ? true : false; }); // List> @@ -364,7 +365,8 @@ TYPED_TEST(GatherTestListTyped, GatherSliced) cudf::test::expect_columns_equal(expected1, result1->get_column(0).view()); } - auto valids = cudf::test::make_counting_transform_iterator(0, [](auto i) { return i % 2 == 0; }); + auto valids = + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i % 2 == 0; }); // List>> { diff --git a/cpp/tests/copying/gather_struct_tests.cu b/cpp/tests/copying/gather_struct_tests.cu index 3df44409062..a40e10d5e83 100644 --- a/cpp/tests/copying/gather_struct_tests.cu +++ b/cpp/tests/copying/gather_struct_tests.cu @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, NVIDIA CORPORATION. + * Copyright (c) 2020-2021, 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,7 @@ #include #include +#include #include #include #include @@ -94,15 +95,15 @@ auto get_expected_column(std::vector const& input_values, }; auto expected_row_count{gather_map.size()}; - auto gather_iter = - cudf::test::make_counting_transform_iterator(0, [is_valid, &input_values, &gather_map](auto i) { + auto gather_iter = cudf::detail::make_counting_transform_iterator( + 0, [is_valid, &input_values, &gather_map](auto i) { return is_valid(i) ? input_values[gather_map[i]] : SourceElementT{}; }); return column_wrapper_constructor()( gather_iter, gather_iter + expected_row_count, - cudf::test::make_counting_transform_iterator(0, is_valid)) + cudf::detail::make_counting_transform_iterator(0, is_valid)) .release(); } } // namespace @@ -185,7 +186,7 @@ TYPED_TEST(TypedStructGatherTest, TestGatherStructOfLists) auto lists_column_exemplar = []() { return lists_column_wrapper{ {{5}, {10, 15}, {20, 25, 30}, {35, 40, 45, 50}, {55, 60, 65}, {70, 75}, {80}, {}, {}}, - make_counting_transform_iterator(0, [](auto i) { return !(i % 3); })}; + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return !(i % 3); })}; }; auto lists_column = std::make_unique(cudf::column(lists_column_exemplar(), 0)); @@ -238,7 +239,7 @@ TYPED_TEST(TypedStructGatherTest, TestGatherStructOfListsOfLists) {{80, 80}}, {}, {}}, - make_counting_transform_iterator(0, [](auto i) { return !(i % 3); })}; + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return !(i % 3); })}; }; auto lists_column = std::make_unique(cudf::column(lists_column_exemplar(), 0)); @@ -283,7 +284,7 @@ TYPED_TEST(TypedStructGatherTest, TestGatherStructOfStructs) auto const numeric_column_exemplar = []() { return fixed_width_column_wrapper{ {5, 10, 15, 20, 25, 30, 35, 45, 50, 55, 60, 65, 70, 75}, - make_counting_transform_iterator(0, [](auto i) { return !(i % 3); })}; + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return !(i % 3); })}; }; auto numeric_column = numeric_column_exemplar(); @@ -382,7 +383,7 @@ TYPED_TEST(TypedStructGatherTest, TestGatherStructOfStructsWithValidity) auto const numeric_column_exemplar = [](nvstd::function pred) { return fixed_width_column_wrapper{ {5, 10, 15, 20, 25, 30, 35, 45, 50, 55, 60, 65, 70, 75}, - make_counting_transform_iterator(0, [=](auto i) { return pred(i); })}; + cudf::detail::make_counting_transform_iterator(0, [=](auto i) { return pred(i); })}; }; // Validity predicates. @@ -392,7 +393,7 @@ TYPED_TEST(TypedStructGatherTest, TestGatherStructOfStructsWithValidity) // Construct struct-of-struct-of-numerics. auto numeric_column = numeric_column_exemplar(every_3rd_element_null); auto structs_column = structs_column_wrapper{ - {numeric_column}, make_counting_transform_iterator(0, twelfth_element_null)}; + {numeric_column}, cudf::detail::make_counting_transform_iterator(0, twelfth_element_null)}; auto struct_of_structs_column = structs_column_wrapper{{structs_column}}.release(); // Gather to new struct column. diff --git a/cpp/tests/copying/gather_tests.cu b/cpp/tests/copying/gather_tests.cu index 2420c7597cc..2c0468b4ff4 100644 --- a/cpp/tests/copying/gather_tests.cu +++ b/cpp/tests/copying/gather_tests.cu @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, NVIDIA CORPORATION. + * Copyright (c) 2020-2021, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,12 +14,15 @@ * limitations under the License. */ #include + #include #include #include #include +#include #include #include + #include #include #include @@ -37,7 +40,7 @@ TYPED_TEST(GatherTest, IdentityTest) { constexpr cudf::size_type source_size{1000}; - auto data = cudf::test::make_counting_transform_iterator(0, [](auto i) { return i; }); + auto data = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i; }); cudf::test::fixed_width_column_wrapper source_column(data, data + source_size); cudf::test::fixed_width_column_wrapper gather_map(data, data + source_size); @@ -56,9 +59,9 @@ TYPED_TEST(GatherTest, ReverseIdentityTest) { constexpr cudf::size_type source_size{1000}; - auto data = cudf::test::make_counting_transform_iterator(0, [](auto i) { return i; }); + auto data = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i; }); auto reversed_data = - cudf::test::make_counting_transform_iterator(0, [](auto i) { return source_size - 1 - i; }); + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return source_size - 1 - i; }); cudf::test::fixed_width_column_wrapper source_column(data, data + source_size); cudf::test::fixed_width_column_wrapper gather_map(reversed_data, @@ -80,14 +83,14 @@ TYPED_TEST(GatherTest, EveryOtherNullOdds) constexpr cudf::size_type source_size{1000}; // Every other element is valid - auto data = cudf::test::make_counting_transform_iterator(0, [](auto i) { return i; }); - auto validity = cudf::test::make_counting_transform_iterator(0, [](auto i) { return i % 2; }); + auto data = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i; }); + auto validity = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i % 2; }); cudf::test::fixed_width_column_wrapper source_column( data, data + source_size, validity); // Gather odd-valued indices - auto map_data = cudf::test::make_counting_transform_iterator(0, [](auto i) { return i * 2; }); + auto map_data = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i * 2; }); cudf::test::fixed_width_column_wrapper gather_map(map_data, map_data + (source_size / 2)); @@ -96,8 +99,8 @@ TYPED_TEST(GatherTest, EveryOtherNullOdds) std::unique_ptr result = std::move(cudf::gather(source_table, gather_map)); - auto expect_data = cudf::test::make_counting_transform_iterator(0, [](auto i) { return 0; }); - auto expect_valid = cudf::test::make_counting_transform_iterator(0, [](auto i) { return 0; }); + auto expect_data = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return 0; }); + auto expect_valid = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return 0; }); cudf::test::fixed_width_column_wrapper expect_column( expect_data, expect_data + source_size / 2, expect_valid); @@ -111,14 +114,15 @@ TYPED_TEST(GatherTest, EveryOtherNullEvens) constexpr cudf::size_type source_size{1000}; // Every other element is valid - auto data = cudf::test::make_counting_transform_iterator(0, [](auto i) { return i; }); - auto validity = cudf::test::make_counting_transform_iterator(0, [](auto i) { return i % 2; }); + auto data = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i; }); + auto validity = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i % 2; }); cudf::test::fixed_width_column_wrapper source_column( data, data + source_size, validity); // Gather even-valued indices - auto map_data = cudf::test::make_counting_transform_iterator(0, [](auto i) { return i * 2 + 1; }); + auto map_data = + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i * 2 + 1; }); cudf::test::fixed_width_column_wrapper gather_map(map_data, map_data + (source_size / 2)); @@ -128,8 +132,8 @@ TYPED_TEST(GatherTest, EveryOtherNullEvens) std::unique_ptr result = std::move(cudf::gather(source_table, gather_map)); auto expect_data = - cudf::test::make_counting_transform_iterator(0, [](auto i) { return i * 2 + 1; }); - auto expect_valid = cudf::test::make_counting_transform_iterator(0, [](auto i) { return 1; }); + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i * 2 + 1; }); + auto expect_valid = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return 1; }); cudf::test::fixed_width_column_wrapper expect_column( expect_data, expect_data + source_size / 2, expect_valid); @@ -143,8 +147,8 @@ TYPED_TEST(GatherTest, AllNull) constexpr cudf::size_type source_size{1000}; // Every element is invalid - auto data = cudf::test::make_counting_transform_iterator(0, [](auto i) { return i; }); - auto validity = cudf::test::make_counting_transform_iterator(0, [](auto i) { return 0; }); + auto data = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i; }); + auto validity = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return 0; }); // Create a gather map that gathers to random locations std::vector host_map_data(source_size); @@ -171,9 +175,9 @@ TYPED_TEST(GatherTest, MultiColReverseIdentityTest) constexpr cudf::size_type n_cols = 3; - auto data = cudf::test::make_counting_transform_iterator(0, [](auto i) { return i; }); + auto data = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i; }); auto reversed_data = - cudf::test::make_counting_transform_iterator(0, [](auto i) { return source_size - 1 - i; }); + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return source_size - 1 - i; }); std::vector> source_column_wrappers; std::vector source_columns; @@ -207,8 +211,8 @@ TYPED_TEST(GatherTest, MultiColNulls) constexpr cudf::size_type n_cols = 3; - auto data = cudf::test::make_counting_transform_iterator(0, [](auto i) { return i; }); - auto validity = cudf::test::make_counting_transform_iterator(0, [](auto i) { return i % 2; }); + auto data = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i; }); + auto validity = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i % 2; }); std::vector> source_column_wrappers; std::vector source_columns; @@ -220,7 +224,7 @@ TYPED_TEST(GatherTest, MultiColNulls) } auto reversed_data = - cudf::test::make_counting_transform_iterator(0, [](auto i) { return source_size - 1 - i; }); + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return source_size - 1 - i; }); cudf::test::fixed_width_column_wrapper gather_map(reversed_data, reversed_data + source_size); @@ -231,9 +235,9 @@ TYPED_TEST(GatherTest, MultiColNulls) // Expected data auto expect_data = - cudf::test::make_counting_transform_iterator(0, [](auto i) { return source_size - i - 1; }); + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return source_size - i - 1; }); auto expect_valid = - cudf::test::make_counting_transform_iterator(0, [](auto i) { return (i + 1) % 2; }); + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return (i + 1) % 2; }); cudf::test::fixed_width_column_wrapper expect_column( expect_data, expect_data + source_size, expect_valid); diff --git a/cpp/tests/copying/pack_tests.cu b/cpp/tests/copying/pack_tests.cu index 6f5e933134b..b11ebb0183f 100644 --- a/cpp/tests/copying/pack_tests.cu +++ b/cpp/tests/copying/pack_tests.cu @@ -113,7 +113,7 @@ std::vector> generate_lists(bool include_validity) using LCW = cudf::test::lists_column_wrapper; if(include_validity){ - auto valids = cudf::test::make_counting_transform_iterator(0, [](auto i) { return i % 2 == 0; }); + auto valids = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i % 2 == 0; }); cudf::test::lists_column_wrapper list0{{1, 2, 3}, {4, 5}, {6}, @@ -422,4 +422,4 @@ TEST_F(PackUnpackTest, NestedEmpty) // clang-format on } // namespace test -} // namespace cudf \ No newline at end of file +} // namespace cudf diff --git a/cpp/tests/copying/sample_tests.cpp b/cpp/tests/copying/sample_tests.cpp index 62415693363..4da1b541a65 100644 --- a/cpp/tests/copying/sample_tests.cpp +++ b/cpp/tests/copying/sample_tests.cpp @@ -14,15 +14,15 @@ * limitations under the License. */ -#include #include -#include -#include - #include #include +#include +#include #include +#include +#include #include #include #include @@ -46,7 +46,7 @@ TEST_F(SampleTest, FailCaseRowMultipleSampling) TEST_F(SampleTest, RowMultipleSamplingDisallowed) { cudf::size_type const n_samples = 1024; - auto data = cudf::test::make_counting_transform_iterator(0, [](auto i) { return i; }); + auto data = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i; }); cudf::test::fixed_width_column_wrapper col1(data, data + n_samples); cudf::table_view input({col1}); @@ -62,7 +62,7 @@ TEST_F(SampleTest, RowMultipleSamplingDisallowed) TEST_F(SampleTest, TestReproducibilityWithSeed) { cudf::size_type const n_samples = 1024; - auto data = cudf::test::make_counting_transform_iterator(0, [](auto i) { return i; }); + auto data = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i; }); cudf::test::fixed_width_column_wrapper col1(data, data + n_samples); cudf::table_view input({col1}); @@ -93,7 +93,7 @@ TEST_P(SampleBasicTest, CombinationOfParameters) cudf::size_type const n_samples = std::get<0>(GetParam()); cudf::sample_with_replacement multi_smpl = std::get<1>(GetParam()); - auto data = cudf::test::make_counting_transform_iterator(0, [](auto i) { return i; }); + auto data = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i; }); cudf::test::fixed_width_column_wrapper col1(data, data + table_size); cudf::test::fixed_width_column_wrapper col2(data, data + table_size); diff --git a/cpp/tests/copying/scatter_list_tests.cu b/cpp/tests/copying/scatter_list_tests.cu index 786f1c57b26..2cf4f7b1f31 100644 --- a/cpp/tests/copying/scatter_list_tests.cu +++ b/cpp/tests/copying/scatter_list_tests.cu @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, NVIDIA CORPORATION. + * Copyright (c) 2020-2021, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,12 +15,15 @@ */ #include + #include #include +#include #include #include #include #include + #include #include #include @@ -28,8 +31,6 @@ #include #include -#include - template class TypedScatterListsTest : public cudf::test::BaseFixture { }; @@ -146,7 +147,8 @@ TYPED_TEST(TypedScatterListsTest, NullableListsOfNullableFixedWidth) auto src_child = fixed_width_column_wrapper{{9, 9, 9, 9, 8, 8, 8}, {1, 1, 1, 0, 1, 1, 1}}; - auto src_list_validity = make_counting_transform_iterator(0, [](auto i) { return i != 2; }); + auto src_list_validity = + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i != 2; }); // One null list row, and one row with nulls. auto src_list_column = cudf::make_lists_column(3, @@ -167,7 +169,8 @@ TYPED_TEST(TypedScatterListsTest, NullableListsOfNullableFixedWidth) auto expected_child_ints = fixed_width_column_wrapper{ {8, 8, 8, 1, 1, 9, 9, 9, 9, 3, 3, 4, 4, 6, 6}, {1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1}}; - auto expected_validity = make_counting_transform_iterator(0, [](auto i) { return i != 5; }); + auto expected_validity = + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i != 5; }); auto expected_lists_column = cudf::make_lists_column( 7, fixed_width_column_wrapper{0, 3, 5, 9, 11, 13, 13, 15}.release(), @@ -249,7 +252,7 @@ TEST_F(ScatterListsTest, ListsOfNullableStrings) "four", "five", "five"}, - make_counting_transform_iterator(0, [](auto i) { return i != 0 && i != 7; })}; + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i != 0 && i != 7; })}; auto expected_lists = cudf::make_lists_column( 6, @@ -302,7 +305,7 @@ TEST_F(ScatterListsTest, EmptyListsOfNullableStrings) "three", "five", "five"}, - make_counting_transform_iterator(0, [](auto i) { return i != 0 && i != 7; })}; + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i != 0 && i != 7; })}; auto expected_lists = cudf::make_lists_column( 6, @@ -326,7 +329,8 @@ TEST_F(ScatterListsTest, NullableListsOfNullableStrings) auto src_strings_column = strings_column_wrapper{ {"all", "the", "leaves", "are", "brown", "california", "dreaming"}, {1, 1, 1, 0, 1, 0, 1}}; - auto src_validity = make_counting_transform_iterator(0, [](auto i) { return i != 1; }); + auto src_validity = + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i != 1; }); auto src_list_column = cudf::make_lists_column(3, fixed_width_column_wrapper{0, 5, 5, 7}.release(), @@ -361,10 +365,11 @@ TEST_F(ScatterListsTest, NullableListsOfNullableStrings) "three", "five", "five"}, - make_counting_transform_iterator(0, [](auto i) { return i != 0 && i != 7; })}; + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i != 0 && i != 7; })}; - auto expected_validity = make_counting_transform_iterator(0, [](auto i) { return i != 4; }); - auto expected_lists = cudf::make_lists_column( + auto expected_validity = + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i != 4; }); + auto expected_lists = cudf::make_lists_column( 6, fixed_width_column_wrapper{0, 2, 4, 9, 11, 11, 13}.release(), expected_strings.release(), @@ -441,7 +446,7 @@ TYPED_TEST(TypedScatterListsTest, NullListsOfLists) auto src_list_column = lists_column_wrapper{ {{{1, 1, 1, 1}, {2, 2, 2, 2}}, {{3, 3, 3, 3}, {}}, {}}, - make_counting_transform_iterator(0, [](auto i) { return i != 2; })}; + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i != 2; })}; auto target_list_column = lists_column_wrapper{{{9, 9, 9}, {8, 8, 8}, {7, 7, 7}}, {{6, 6, 6}, {5, 5, 5}, {4, 4, 4}}, @@ -463,7 +468,7 @@ TYPED_TEST(TypedScatterListsTest, NullListsOfLists) {{9, 9}, {8, 8}, {7, 7}}, {}, {{3, 3}, {2, 2}, {1, 1}}}, - make_counting_transform_iterator(0, [](auto i) { return i != 4; })}, + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i != 4; })}, ret->get_column(0)); } @@ -561,7 +566,7 @@ TYPED_TEST(TypedScatterListsTest, ListsOfStructsWithNullMembers) 9, 9, 9, 9, 8, 8, 8 }, - make_counting_transform_iterator(0, [](auto i) { return i != 3; }) + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i != 3; }) }; auto source_strings = strings_column_wrapper{ @@ -569,7 +574,7 @@ TYPED_TEST(TypedScatterListsTest, ListsOfStructsWithNullMembers) "nine", "nine", "nine", "nine", "eight", "eight", "eight" }, - make_counting_transform_iterator(0, [](auto i) { return i != 5; }) + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i != 5; }) }; // clang-format on @@ -620,7 +625,7 @@ TYPED_TEST(TypedScatterListsTest, ListsOfStructsWithNullMembers) 4, 4, 5, 5 }, - make_counting_transform_iterator(0, [](auto i) { return i != 8; }) + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i != 8; }) }; auto expected_strings = strings_column_wrapper{ @@ -632,7 +637,7 @@ TYPED_TEST(TypedScatterListsTest, ListsOfStructsWithNullMembers) "four", "four", "five", "five" }, - make_counting_transform_iterator(0, [](auto i) { return i != 1; }) + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i != 1; }) }; // clang-format on @@ -657,7 +662,7 @@ TYPED_TEST(TypedScatterListsTest, ListsOfNullStructs) 9, 9, 9, 9, 8, 8, 8 }, - make_counting_transform_iterator(0, [](auto i) { return i != 3; }) + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i != 3; }) }; auto source_strings = strings_column_wrapper{ @@ -665,13 +670,13 @@ TYPED_TEST(TypedScatterListsTest, ListsOfNullStructs) "nine", "nine", "nine", "nine", "eight", "eight", "eight" }, - make_counting_transform_iterator(0, [](auto i) { return i != 5; }) + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i != 5; }) }; // clang-format on - auto source_structs = - structs_column_wrapper{{source_numerics, source_strings}, - make_counting_transform_iterator(0, [](auto i) { return i != 1; })}; + auto source_structs = structs_column_wrapper{ + {source_numerics, source_strings}, + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i != 1; })}; auto source_lists = cudf::make_lists_column(2, offsets_column{0, 4, 7}.release(), source_structs.release(), 0, {}); @@ -717,7 +722,7 @@ TYPED_TEST(TypedScatterListsTest, ListsOfNullStructs) 4, 4, 5, 5 }, - make_counting_transform_iterator(0, [](auto i) { return (i != 6) && (i != 8); }) + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return (i != 6) && (i != 8); }) }; auto expected_strings = strings_column_wrapper{ @@ -729,13 +734,13 @@ TYPED_TEST(TypedScatterListsTest, ListsOfNullStructs) "four", "four", "five", "five" }, - make_counting_transform_iterator(0, [](auto i) { return (i != 1) && (i != 6); }) + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return (i != 1) && (i != 6); }) }; // clang-format on - auto expected_structs = - structs_column_wrapper{{expected_numerics, expected_strings}, - make_counting_transform_iterator(0, [](auto i) { return i != 6; })}; + auto expected_structs = structs_column_wrapper{ + {expected_numerics, expected_strings}, + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i != 6; })}; auto expected_lists = cudf::make_lists_column( 6, offsets_column{0, 3, 5, 9, 11, 13, 15}.release(), expected_structs.release(), 0, {}); @@ -756,7 +761,7 @@ TYPED_TEST(TypedScatterListsTest, EmptyListsOfStructs) 9, 9, 9, 9, 8, 8, 8 }, - make_counting_transform_iterator(0, [](auto i) { return i != 3; }) + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i != 3; }) }; auto source_strings = strings_column_wrapper{ @@ -764,13 +769,13 @@ TYPED_TEST(TypedScatterListsTest, EmptyListsOfStructs) "nine", "nine", "nine", "nine", "eight", "eight", "eight" }, - make_counting_transform_iterator(0, [](auto i) { return i != 5; }) + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i != 5; }) }; // clang-format on - auto source_structs = - structs_column_wrapper{{source_numerics, source_strings}, - make_counting_transform_iterator(0, [](auto i) { return i != 1; })}; + auto source_structs = structs_column_wrapper{ + {source_numerics, source_strings}, + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i != 1; })}; auto source_lists = cudf::make_lists_column( 3, offsets_column{0, 4, 7, 7}.release(), source_structs.release(), 0, {}); @@ -815,7 +820,7 @@ TYPED_TEST(TypedScatterListsTest, EmptyListsOfStructs) 3, 3, 5, 5 }, - make_counting_transform_iterator(0, [](auto i) { return (i != 6) && (i != 8); }) + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return (i != 6) && (i != 8); }) }; auto expected_strings = strings_column_wrapper{ @@ -826,13 +831,13 @@ TYPED_TEST(TypedScatterListsTest, EmptyListsOfStructs) "three", "three", "five", "five" }, - make_counting_transform_iterator(0, [](auto i) { return (i != 1) && (i != 6); }) + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return (i != 1) && (i != 6); }) }; // clang-format on - auto expected_structs = - structs_column_wrapper{{expected_numerics, expected_strings}, - make_counting_transform_iterator(0, [](auto i) { return i != 6; })}; + auto expected_structs = structs_column_wrapper{ + {expected_numerics, expected_strings}, + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i != 6; })}; auto expected_lists = cudf::make_lists_column( 6, offsets_column{0, 3, 5, 9, 11, 11, 13}.release(), expected_structs.release(), 0, {}); @@ -853,7 +858,7 @@ TYPED_TEST(TypedScatterListsTest, NullListsOfStructs) 9, 9, 9, 9, 8, 8, 8 }, - make_counting_transform_iterator(0, [](auto i) { return i != 3; }) + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i != 3; }) }; auto source_strings = strings_column_wrapper{ @@ -861,16 +866,16 @@ TYPED_TEST(TypedScatterListsTest, NullListsOfStructs) "nine", "nine", "nine", "nine", "eight", "eight", "eight" }, - make_counting_transform_iterator(0, [](auto i) { return i != 5; }) + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i != 5; }) }; // clang-format on - auto source_structs = - structs_column_wrapper{{source_numerics, source_strings}, - make_counting_transform_iterator(0, [](auto i) { return i != 1; })}; + auto source_structs = structs_column_wrapper{ + {source_numerics, source_strings}, + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i != 1; })}; auto source_list_null_mask_begin = - make_counting_transform_iterator(0, [](auto i) { return i != 2; }); + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i != 2; }); auto source_lists = cudf::make_lists_column( 3, @@ -918,7 +923,7 @@ TYPED_TEST(TypedScatterListsTest, NullListsOfStructs) 3, 3, 5, 5 }, - make_counting_transform_iterator(0, [](auto i) { return (i != 6) && (i != 8); }) + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return (i != 6) && (i != 8); }) }; auto expected_strings = strings_column_wrapper{ @@ -929,16 +934,16 @@ TYPED_TEST(TypedScatterListsTest, NullListsOfStructs) "three", "three", "five", "five" }, - make_counting_transform_iterator(0, [](auto i) { return i != 1 && i != 6; }) + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i != 1 && i != 6; }) }; // clang-format on - auto expected_structs = - structs_column_wrapper{{expected_numerics, expected_strings}, - make_counting_transform_iterator(0, [](auto i) { return i != 6; })}; + auto expected_structs = structs_column_wrapper{ + {expected_numerics, expected_strings}, + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i != 6; })}; auto expected_lists_null_mask_begin = - make_counting_transform_iterator(0, [](auto i) { return i != 4; }); + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i != 4; }); auto expected_lists = cudf::make_lists_column( 6, diff --git a/cpp/tests/copying/scatter_tests.cpp b/cpp/tests/copying/scatter_tests.cpp index 093c19aa765..500c017ca85 100644 --- a/cpp/tests/copying/scatter_tests.cpp +++ b/cpp/tests/copying/scatter_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, NVIDIA CORPORATION. + * Copyright (c) 2019-2021, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,8 +14,10 @@ * limitations under the License. */ #include +#include #include #include + #include #include #include @@ -487,19 +489,20 @@ TYPED_TEST(ScatterDataTypeTests, ScatterScalarBothNulls) TYPED_TEST(ScatterDataTypeTests, ScatterSourceNullsLarge) { + using cudf::detail::make_counting_transform_iterator; using cudf::test::fixed_width_column_wrapper; - using cudf::test::make_counting_transform_iterator; constexpr cudf::size_type N{513}; fixed_width_column_wrapper source({0, 0, 0, 0}, {0, 0, 0, 0}); fixed_width_column_wrapper scatter_map({0, 1, 2, 3}); - auto target_data = make_counting_transform_iterator(0, [](auto i) { return i; }); + auto target_data = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i; }); cudf::test::fixed_width_column_wrapper target(target_data, target_data + N); - auto expect_data = make_counting_transform_iterator(0, [](auto i) { return i; }); - auto expect_valid = make_counting_transform_iterator(0, [](auto i) { return i > 3; }); + auto expect_data = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i; }); + auto expect_valid = + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i > 3; }); fixed_width_column_wrapper expected( expect_data, expect_data + N, expect_valid); diff --git a/cpp/tests/copying/segmented_gather_list_tests.cpp b/cpp/tests/copying/segmented_gather_list_tests.cpp index b1abec9aa55..b02d0ad387d 100644 --- a/cpp/tests/copying/segmented_gather_list_tests.cpp +++ b/cpp/tests/copying/segmented_gather_list_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, NVIDIA CORPORATION. + * Copyright (c) 2020-2021, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,6 +15,7 @@ */ #include #include +#include #include #include @@ -119,7 +120,7 @@ TYPED_TEST(SegmentedGatherTest, GatherNulls) { using T = TypeParam; - auto valids = cudf::test::make_counting_transform_iterator( + auto valids = cudf::detail::make_counting_transform_iterator( 0, [](auto i) { return i % 2 == 0 ? true : false; }); // List @@ -223,7 +224,7 @@ TYPED_TEST(SegmentedGatherTest, GatherNestedNulls) { using T = TypeParam; - auto valids = cudf::test::make_counting_transform_iterator( + auto valids = cudf::detail::make_counting_transform_iterator( 0, [](auto i) { return i % 2 == 0 ? true : false; }); // List> @@ -238,7 +239,7 @@ TYPED_TEST(SegmentedGatherTest, GatherNestedNulls) auto results = cudf::lists::detail::segmented_gather(lists_column_view{list}, lists_column_view{gather_map}); - auto trues = cudf::test::make_counting_transform_iterator(0, [](auto i) { return true; }); + auto trues = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return true; }); LCW expected{{{{2, 3}, valids}, {4, 5}}, {{{6, 7, 8}, {12, 13, 14}}, trues}, @@ -320,7 +321,8 @@ TYPED_TEST(SegmentedGatherTest, GatherSliced) CUDF_TEST_EXPECT_COLUMNS_EQUAL(expected1, result1->view()); } - auto valids = cudf::test::make_counting_transform_iterator(0, [](auto i) { return i % 2 == 0; }); + auto valids = + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i % 2 == 0; }); // List>> { @@ -463,7 +465,8 @@ TEST_F(SegmentedGatherTestFloat, Fails) cudf::lists::detail::segmented_gather(lists_column_view{list}, lists_column_view{nonlist_map2}), "Gather map should be list column of index type"); - auto valids = cudf::test::make_counting_transform_iterator(0, [](auto i) { return i % 2 == 0; }); + auto valids = + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i % 2 == 0; }); LCW nulls_map{{{3, 2, 1, 0}, {0}, {0}, {0, 1}}, valids}; CUDF_EXPECT_THROW_MESSAGE( cudf::lists::detail::segmented_gather(lists_column_view{list}, lists_column_view{nulls_map}), diff --git a/cpp/tests/copying/slice_tests.cpp b/cpp/tests/copying/slice_tests.cpp index e9759aa0259..daaa723e082 100644 --- a/cpp/tests/copying/slice_tests.cpp +++ b/cpp/tests/copying/slice_tests.cpp @@ -16,6 +16,7 @@ #include #include +#include #include #include #include @@ -25,6 +26,7 @@ #include #include #include + #include #include @@ -42,7 +44,7 @@ TYPED_TEST(SliceTest, NumericColumnsWithNulls) cudf::size_type start = 0; cudf::size_type size = 10; - auto valids = cudf::test::make_counting_transform_iterator( + auto valids = cudf::detail::make_counting_transform_iterator( start, [](auto i) { return i % 2 == 0 ? true : false; }); cudf::test::fixed_width_column_wrapper col = create_fixed_columns(start, size, valids); @@ -65,7 +67,7 @@ TYPED_TEST(SliceTest, NumericColumnsWithNullsAsColumn) cudf::size_type start = 0; cudf::size_type size = 10; - auto valids = cudf::test::make_counting_transform_iterator( + auto valids = cudf::detail::make_counting_transform_iterator( start, [](auto i) { return i % 2 == 0 ? true : false; }); cudf::test::fixed_width_column_wrapper col = create_fixed_columns(start, size, valids); @@ -90,7 +92,7 @@ TEST_F(SliceStringTest, StringWithNulls) { std::vector strings{ "", "this", "is", "a", "column", "of", "strings", "with", "in", "valid"}; - auto valids = cudf::test::make_counting_transform_iterator( + auto valids = cudf::detail::make_counting_transform_iterator( 0, [](auto i) { return i % 2 == 0 ? true : false; }); cudf::test::strings_column_wrapper s(strings.begin(), strings.end(), valids); @@ -111,7 +113,7 @@ TEST_F(SliceStringTest, StringWithNullsAsColumn) { std::vector strings{ "", "this", "is", "a", "column", "of", "strings", "with", "in", "valid"}; - auto valids = cudf::test::make_counting_transform_iterator( + auto valids = cudf::detail::make_counting_transform_iterator( 0, [](auto i) { return i % 2 == 0 ? true : false; }); cudf::test::strings_column_wrapper s(strings.begin(), strings.end(), valids); @@ -193,7 +195,8 @@ TEST_F(SliceListTest, ListsWithNulls) { using LCW = cudf::test::lists_column_wrapper; - auto valids = cudf::test::make_counting_transform_iterator(0, [](auto i) { return i % 2 == 0; }); + auto valids = + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i % 2 == 0; }); { cudf::test::lists_column_wrapper list{{1, 2, 3}, @@ -279,7 +282,7 @@ TEST_F(SliceCornerCases, EmptyIndices) { cudf::size_type start = 0; cudf::size_type size = 10; - auto valids = cudf::test::make_counting_transform_iterator( + auto valids = cudf::detail::make_counting_transform_iterator( start, [](auto i) { return i % 2 == 0 ? true : false; }); cudf::test::fixed_width_column_wrapper col = @@ -297,7 +300,7 @@ TEST_F(SliceCornerCases, InvalidSetOfIndices) { cudf::size_type start = 0; cudf::size_type size = 10; - auto valids = cudf::test::make_counting_transform_iterator( + auto valids = cudf::detail::make_counting_transform_iterator( start, [](auto i) { return i % 2 == 0 ? true : false; }); cudf::test::fixed_width_column_wrapper col = create_fixed_columns(start, size, valids); @@ -310,7 +313,7 @@ TEST_F(SliceCornerCases, ImproperRange) { cudf::size_type start = 0; cudf::size_type size = 10; - auto valids = cudf::test::make_counting_transform_iterator( + auto valids = cudf::detail::make_counting_transform_iterator( start, [](auto i) { return i % 2 == 0 ? true : false; }); cudf::test::fixed_width_column_wrapper col = @@ -324,7 +327,7 @@ TEST_F(SliceCornerCases, NegativeOffset) { cudf::size_type start = 0; cudf::size_type size = 10; - auto valids = cudf::test::make_counting_transform_iterator( + auto valids = cudf::detail::make_counting_transform_iterator( start, [](auto i) { return i % 2 == 0 ? true : false; }); cudf::test::fixed_width_column_wrapper col = @@ -346,7 +349,7 @@ TYPED_TEST(SliceTableTest, NumericColumnsWithNulls) cudf::size_type start = 0; cudf::size_type col_size = 10; - auto valids = cudf::test::make_counting_transform_iterator( + auto valids = cudf::detail::make_counting_transform_iterator( start, [](auto i) { return i % 2 == 0 ? true : false; }); cudf::size_type num_cols = 5; @@ -369,7 +372,7 @@ struct SliceStringTableTest : public SliceTableTest { TEST_F(SliceStringTableTest, StringWithNulls) { - auto valids = cudf::test::make_counting_transform_iterator( + auto valids = cudf::detail::make_counting_transform_iterator( 0, [](auto i) { return i % 2 == 0 ? true : false; }); std::vector strings[2] = { @@ -415,7 +418,7 @@ TEST_F(SliceTableCornerCases, EmptyIndices) { cudf::size_type start = 0; cudf::size_type col_size = 10; - auto valids = cudf::test::make_counting_transform_iterator( + auto valids = cudf::detail::make_counting_transform_iterator( start, [](auto i) { return i % 2 == 0 ? true : false; }); cudf::size_type num_cols = 5; @@ -433,7 +436,7 @@ TEST_F(SliceTableCornerCases, InvalidSetOfIndices) { cudf::size_type start = 0; cudf::size_type col_size = 10; - auto valids = cudf::test::make_counting_transform_iterator( + auto valids = cudf::detail::make_counting_transform_iterator( start, [](auto i) { return i % 2 == 0 ? true : false; }); cudf::size_type num_cols = 5; @@ -448,7 +451,7 @@ TEST_F(SliceTableCornerCases, ImproperRange) { cudf::size_type start = 0; cudf::size_type col_size = 10; - auto valids = cudf::test::make_counting_transform_iterator( + auto valids = cudf::detail::make_counting_transform_iterator( start, [](auto i) { return i % 2 == 0 ? true : false; }); cudf::size_type num_cols = 5; @@ -463,7 +466,7 @@ TEST_F(SliceTableCornerCases, NegativeOffset) { cudf::size_type start = 0; cudf::size_type col_size = 10; - auto valids = cudf::test::make_counting_transform_iterator( + auto valids = cudf::detail::make_counting_transform_iterator( start, [](auto i) { return i % 2 == 0 ? true : false; }); cudf::size_type num_cols = 5; diff --git a/cpp/tests/copying/slice_tests.cuh b/cpp/tests/copying/slice_tests.cuh index 8fe333b8fe3..1476dfe2ba1 100644 --- a/cpp/tests/copying/slice_tests.cuh +++ b/cpp/tests/copying/slice_tests.cuh @@ -24,7 +24,7 @@ cudf::test::fixed_width_column_wrapper create_fixed_columns(cudf::size_type s cudf::size_type size, InputIterator valids) { - auto iter = cudf::test::make_counting_transform_iterator(start, [](auto i) { return T(i); }); + auto iter = cudf::detail::make_counting_transform_iterator(start, [](auto i) { return T(i); }); return cudf::test::fixed_width_column_wrapper(iter, iter + size, valids); } @@ -52,12 +52,12 @@ std::vector> create_expected_columns( for (unsigned long index = 0; index < indices.size(); index += 2) { auto iter = - cudf::test::make_counting_transform_iterator(indices[index], [](auto i) { return T(i); }); + cudf::detail::make_counting_transform_iterator(indices[index], [](auto i) { return T(i); }); if (not nullable) { result.push_back(cudf::test::fixed_width_column_wrapper( iter, iter + (indices[index + 1] - indices[index]))); } else { - auto valids = cudf::test::make_counting_transform_iterator( + auto valids = cudf::detail::make_counting_transform_iterator( indices[index], [](auto i) { return i % 2 == 0 ? true : false; }); result.push_back(cudf::test::fixed_width_column_wrapper( iter, iter + (indices[index + 1] - indices[index]), valids)); @@ -75,7 +75,7 @@ std::vector> create_expected_columns( for (unsigned long index = 0; index < indices.size(); index += 2) { auto iter = - cudf::test::make_counting_transform_iterator(indices[index], [](auto i) { return T(i); }); + cudf::detail::make_counting_transform_iterator(indices[index], [](auto i) { return T(i); }); result.push_back(cudf::test::fixed_width_column_wrapper( iter, iter + (indices[index + 1] - indices[index]), validity.begin() + indices[index])); } @@ -96,7 +96,7 @@ std::vector> create_expected_columns( result.push_back(cudf::test::fixed_width_column_wrapper( iter, iter + (indices[index + 1] - indices[index]))); } else { - auto valids = cudf::test::make_counting_transform_iterator( + auto valids = cudf::detail::make_counting_transform_iterator( indices[index], [](auto i) { return i % 2 == 0 ? true : false; }); result.push_back(cudf::test::fixed_width_column_wrapper( iter, iter + (indices[index + 1] - indices[index]), valids)); @@ -132,15 +132,15 @@ std::vector create_expected_tables(cudf::size_type num_cols, std::vector> cols = {}; for (int idx = 0; idx < num_cols; idx++) { - auto iter = cudf::test::make_counting_transform_iterator(indices[index] + (idx * num_cols), - [](auto i) { return T(i); }); + auto iter = cudf::detail::make_counting_transform_iterator(indices[index] + (idx * num_cols), + [](auto i) { return T(i); }); if (not nullable) { cudf::test::fixed_width_column_wrapper wrap( iter, iter + (indices[index + 1] - indices[index])); cols.push_back(wrap.release()); } else { - auto valids = cudf::test::make_counting_transform_iterator( + auto valids = cudf::detail::make_counting_transform_iterator( indices[index], [](auto i) { return i % 2 == 0 ? true : false; }); cudf::test::fixed_width_column_wrapper wrap( iter, iter + (indices[index + 1] - indices[index]), valids); @@ -166,7 +166,7 @@ inline std::vector create_expected_string_co result.push_back(cudf::test::strings_column_wrapper(strings.begin() + indices[index], strings.begin() + indices[index + 1])); } else { - auto valids = cudf::test::make_counting_transform_iterator( + auto valids = cudf::detail::make_counting_transform_iterator( indices[index], [](auto i) { return i % 2 == 0 ? true : false; }); result.push_back(cudf::test::strings_column_wrapper( strings.begin() + indices[index], strings.begin() + indices[index + 1], valids)); @@ -208,7 +208,7 @@ inline std::vector create_expected_string_tables( strings[idx].begin() + indices[index + 1]); cols.push_back(wrap.release()); } else { - auto valids = cudf::test::make_counting_transform_iterator( + auto valids = cudf::detail::make_counting_transform_iterator( indices[index], [](auto i) { return i % 2 == 0 ? true : false; }); cudf::test::strings_column_wrapper wrap( strings[idx].begin() + indices[index], strings[idx].begin() + indices[index + 1], valids); diff --git a/cpp/tests/copying/split_tests.cpp b/cpp/tests/copying/split_tests.cpp index 58e77456869..80fa56b398c 100644 --- a/cpp/tests/copying/split_tests.cpp +++ b/cpp/tests/copying/split_tests.cpp @@ -16,6 +16,7 @@ #include #include +#include #include #include @@ -169,7 +170,7 @@ TYPED_TEST(SplitTest, SplitEndLessThanSize) cudf::size_type start = 0; cudf::size_type size = 10; - auto valids = cudf::test::make_counting_transform_iterator( + auto valids = cudf::detail::make_counting_transform_iterator( start, [](auto i) { return i % 2 == 0 ? true : false; }); cudf::test::fixed_width_column_wrapper col = create_fixed_columns(start, size, valids); @@ -192,7 +193,7 @@ TYPED_TEST(SplitTest, SplitEndToSize) cudf::size_type start = 0; cudf::size_type size = 10; - auto valids = cudf::test::make_counting_transform_iterator( + auto valids = cudf::detail::make_counting_transform_iterator( start, [](auto i) { return i % 2 == 0 ? true : false; }); cudf::test::fixed_width_column_wrapper col = create_fixed_columns(start, size, valids); @@ -229,7 +230,7 @@ void split_custom_column(SplitFunc Split, thrust::make_counting_iterator(0), [&base_strings](cudf::size_type i) { return base_strings[rand() % base_strings.size()]; }); - auto rvalids = cudf::test::make_counting_transform_iterator(start, [include_validity](auto i) { + auto rvalids = cudf::detail::make_counting_transform_iterator(start, [include_validity](auto i) { return include_validity ? (static_cast(rand()) / static_cast(RAND_MAX) < 0.5f ? 0 : 1) : 0; @@ -307,7 +308,7 @@ TEST_F(SplitStringTest, StringWithInvalids) { std::vector strings{ "", "this", "is", "a", "column", "of", "strings", "with", "in", "valid"}; - auto valids = cudf::test::make_counting_transform_iterator( + auto valids = cudf::detail::make_counting_transform_iterator( 0, [](auto i) { return i % 2 == 0 ? true : false; }); cudf::test::strings_column_wrapper s(strings.begin(), strings.end(), valids); @@ -343,7 +344,7 @@ TEST_F(SplitCornerCases, EmptyIndices) { cudf::size_type start = 0; cudf::size_type size = 10; - auto valids = cudf::test::make_counting_transform_iterator( + auto valids = cudf::detail::make_counting_transform_iterator( start, [](auto i) { return i % 2 == 0 ? true : false; }); cudf::test::fixed_width_column_wrapper col = @@ -361,7 +362,7 @@ TEST_F(SplitCornerCases, InvalidSetOfIndices) { cudf::size_type start = 0; cudf::size_type size = 10; - auto valids = cudf::test::make_counting_transform_iterator( + auto valids = cudf::detail::make_counting_transform_iterator( start, [](auto i) { return i % 2 == 0 ? true : false; }); cudf::test::fixed_width_column_wrapper col = create_fixed_columns(start, size, valids); @@ -374,7 +375,7 @@ TEST_F(SplitCornerCases, ImproperRange) { cudf::size_type start = 0; cudf::size_type size = 10; - auto valids = cudf::test::make_counting_transform_iterator( + auto valids = cudf::detail::make_counting_transform_iterator( start, [](auto i) { return i % 2 == 0 ? true : false; }); cudf::test::fixed_width_column_wrapper col = @@ -388,7 +389,7 @@ TEST_F(SplitCornerCases, NegativeValue) { cudf::size_type start = 0; cudf::size_type size = 10; - auto valids = cudf::test::make_counting_transform_iterator( + auto valids = cudf::detail::make_counting_transform_iterator( start, [](auto i) { return i % 2 == 0 ? true : false; }); cudf::test::fixed_width_column_wrapper col = @@ -404,7 +405,7 @@ void split_end_less_than_size(SplitFunc Split, CompareFunc Compare) { cudf::size_type start = 0; cudf::size_type col_size = 10; - auto valids = cudf::test::make_counting_transform_iterator( + auto valids = cudf::detail::make_counting_transform_iterator( start, [](auto i) { return i % 2 == 0 ? true : false; }); cudf::size_type num_cols = 5; @@ -428,7 +429,7 @@ void split_end_to_size(SplitFunc Split, CompareFunc Compare) { cudf::size_type start = 0; cudf::size_type col_size = 10; - auto valids = cudf::test::make_counting_transform_iterator( + auto valids = cudf::detail::make_counting_transform_iterator( start, [](auto i) { return i % 2 == 0 ? true : false; }); cudf::size_type num_cols = 5; @@ -465,7 +466,7 @@ void split_empty_indices(SplitFunc Split) { cudf::size_type start = 0; cudf::size_type col_size = 10; - auto valids = cudf::test::make_counting_transform_iterator( + auto valids = cudf::detail::make_counting_transform_iterator( start, [](auto i) { return i % 2 == 0 ? true : false; }); cudf::size_type num_cols = 5; @@ -484,7 +485,7 @@ void split_invalid_indices(SplitFunc Split) { cudf::size_type start = 0; cudf::size_type col_size = 10; - auto valids = cudf::test::make_counting_transform_iterator( + auto valids = cudf::detail::make_counting_transform_iterator( start, [](auto i) { return i % 2 == 0 ? true : false; }); cudf::size_type num_cols = 5; @@ -500,7 +501,7 @@ void split_improper_range(SplitFunc Split) { cudf::size_type start = 0; cudf::size_type col_size = 10; - auto valids = cudf::test::make_counting_transform_iterator( + auto valids = cudf::detail::make_counting_transform_iterator( start, [](auto i) { return i % 2 == 0 ? true : false; }); cudf::size_type num_cols = 5; @@ -516,7 +517,7 @@ void split_negative_value(SplitFunc Split) { cudf::size_type start = 0; cudf::size_type col_size = 10; - auto valids = cudf::test::make_counting_transform_iterator( + auto valids = cudf::detail::make_counting_transform_iterator( start, [](auto i) { return i % 2 == 0 ? true : false; }); cudf::size_type num_cols = 5; @@ -532,7 +533,7 @@ void split_empty_output_column_value(SplitFunc Split, CompareFunc Compare) { cudf::size_type start = 0; cudf::size_type col_size = 10; - auto valids = cudf::test::make_counting_transform_iterator( + auto valids = cudf::detail::make_counting_transform_iterator( start, [](auto i) { return i % 2 == 0 ? true : false; }); cudf::size_type num_cols = 5; @@ -624,7 +625,7 @@ TEST_F(SplitTableCornerCases, EmptyOutputColumn) template void split_string_with_invalids(SplitFunc Split, CompareFunc Compare) { - auto valids = cudf::test::make_counting_transform_iterator( + auto valids = cudf::detail::make_counting_transform_iterator( 0, [](auto i) { return i % 2 == 0 ? true : false; }); std::vector strings[2] = { @@ -655,7 +656,7 @@ void split_string_with_invalids(SplitFunc Split, CompareFunc Compare) template void split_empty_output_strings_column_value(SplitFunc Split, CompareFunc Compare) { - auto valids = cudf::test::make_counting_transform_iterator( + auto valids = cudf::detail::make_counting_transform_iterator( 0, [](auto i) { return i % 2 == 0 ? true : false; }); std::vector strings[2] = { @@ -682,8 +683,8 @@ void split_empty_output_strings_column_value(SplitFunc Split, CompareFunc Compar template void split_null_input_strings_column_value(SplitFunc Split, CompareFunc Compare) { - auto no_valids = cudf::test::make_counting_transform_iterator(0, [](auto i) { return false; }); - auto valids = cudf::test::make_counting_transform_iterator( + auto no_valids = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return false; }); + auto valids = cudf::detail::make_counting_transform_iterator( 0, [](auto i) { return i % 2 == 0 ? true : false; }); std::vector strings[2] = { @@ -826,7 +827,8 @@ void split_lists_with_nulls(SplitFunc Split, CompareFunc Compare) { using LCW = cudf::test::lists_column_wrapper; - auto valids = cudf::test::make_counting_transform_iterator(0, [](auto i) { return i % 2 == 0; }); + auto valids = + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i % 2 == 0; }); { cudf::test::lists_column_wrapper list{{1, 2, 3}, @@ -1458,7 +1460,7 @@ TEST_F(ContiguousSplitTableCornerCases, EmptyOutputColumn) TEST_F(ContiguousSplitTableCornerCases, MixedColumnTypes) { cudf::size_type start = 0; - auto valids = cudf::test::make_counting_transform_iterator(start, [](auto i) { return true; }); + auto valids = cudf::detail::make_counting_transform_iterator(start, [](auto i) { return true; }); std::vector strings[2] = { {"", "this", "is", "a", "column", "of", "strings", "with", "in", "valid"}, @@ -1466,11 +1468,11 @@ TEST_F(ContiguousSplitTableCornerCases, MixedColumnTypes) std::vector> cols; - auto iter0 = cudf::test::make_counting_transform_iterator(0, [](auto i) { return (i); }); + auto iter0 = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return (i); }); auto c0 = cudf::test::fixed_width_column_wrapper(iter0, iter0 + 10, valids); cols.push_back(c0.release()); - auto iter1 = cudf::test::make_counting_transform_iterator(10, [](auto i) { return (i); }); + auto iter1 = cudf::detail::make_counting_transform_iterator(10, [](auto i) { return (i); }); auto c1 = cudf::test::fixed_width_column_wrapper(iter1, iter1 + 10, valids); cols.push_back(c1.release()); @@ -1480,7 +1482,7 @@ TEST_F(ContiguousSplitTableCornerCases, MixedColumnTypes) auto c3 = cudf::test::strings_column_wrapper(strings[1].begin(), strings[1].end(), valids); cols.push_back(c3.release()); - auto iter4 = cudf::test::make_counting_transform_iterator(20, [](auto i) { return (i); }); + auto iter4 = cudf::detail::make_counting_transform_iterator(20, [](auto i) { return (i); }); auto c4 = cudf::test::fixed_width_column_wrapper(iter4, iter4 + 10, valids); cols.push_back(c4.release()); @@ -1504,7 +1506,7 @@ TEST_F(ContiguousSplitTableCornerCases, PreSplitTable) cudf::size_type size = 10002; srand(824); - auto rvalids = cudf::test::make_counting_transform_iterator(start, [](auto i) { + auto rvalids = cudf::detail::make_counting_transform_iterator(start, [](auto i) { return static_cast(rand()) / static_cast(RAND_MAX) < 0.5f ? 0 : 1; }); diff --git a/cpp/tests/filling/fill_tests.cpp b/cpp/tests/filling/fill_tests.cpp index 45f970cbce0..6fedf7fea05 100644 --- a/cpp/tests/filling/fill_tests.cpp +++ b/cpp/tests/filling/fill_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, NVIDIA CORPORATION. + * Copyright (c) 2019-2021, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,6 +20,7 @@ #include #include +#include #include #include #include @@ -52,7 +53,7 @@ class FillTypedTestFixture : public cudf::test::BaseFixture { cudf::test::fixed_width_column_wrapper destination( thrust::make_counting_iterator(0), thrust::make_counting_iterator(0) + size, - cudf::test::make_counting_transform_iterator(0, destination_validity)); + cudf::detail::make_counting_transform_iterator(0, destination_validity)); std::unique_ptr p_val{nullptr}; cudf::data_type type{cudf::type_to_id()}; @@ -70,13 +71,13 @@ class FillTypedTestFixture : public cudf::test::BaseFixture { static_cast(p_val.get())->set_valid(value_is_valid); auto expected_elements = - cudf::test::make_counting_transform_iterator(0, [begin, end, value](auto i) { + cudf::detail::make_counting_transform_iterator(0, [begin, end, value](auto i) { return (i >= begin && i < end) ? value : cudf::test::make_type_param_scalar(i); }); cudf::test::fixed_width_column_wrapper expected( expected_elements, expected_elements + size, - cudf::test::make_counting_transform_iterator( + cudf::detail::make_counting_transform_iterator( 0, [begin, end, value_is_valid, destination_validity](auto i) { return (i >= begin && i < end) ? value_is_valid : destination_validity(i); })); @@ -179,12 +180,12 @@ class FillStringTestFixture : public cudf::test::BaseFixture { { cudf::size_type size{FillStringTestFixture::column_size}; - auto destination_elements = cudf::test::make_counting_transform_iterator( + auto destination_elements = cudf::detail::make_counting_transform_iterator( 0, [](auto i) { return "#" + std::to_string(i); }); auto destination = cudf::test::strings_column_wrapper( destination_elements, destination_elements + size, - cudf::test::make_counting_transform_iterator(0, destination_validity)); + cudf::detail::make_counting_transform_iterator(0, destination_validity)); auto p_val = cudf::make_string_scalar(value); using ScalarType = cudf::scalar_type_t; @@ -193,13 +194,13 @@ class FillStringTestFixture : public cudf::test::BaseFixture { auto p_chars = value.c_str(); auto num_chars = value.length(); auto expected_elements = - cudf::test::make_counting_transform_iterator(0, [begin, end, p_chars, num_chars](auto i) { + cudf::detail::make_counting_transform_iterator(0, [begin, end, p_chars, num_chars](auto i) { return (i >= begin && i < end) ? std::string(p_chars, num_chars) : "#" + std::to_string(i); }); auto expected = cudf::test::strings_column_wrapper( expected_elements, expected_elements + size, - cudf::test::make_counting_transform_iterator( + cudf::detail::make_counting_transform_iterator( 0, [begin, end, value_is_valid, destination_validity](auto i) { return (i >= begin && i < end) ? value_is_valid : destination_validity(i); })); diff --git a/cpp/tests/filling/repeat_tests.cpp b/cpp/tests/filling/repeat_tests.cpp index 625f3269579..b450015c0c8 100644 --- a/cpp/tests/filling/repeat_tests.cpp +++ b/cpp/tests/filling/repeat_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, NVIDIA CORPORATION. + * Copyright (c) 2019-2021, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,6 +20,7 @@ #include #include +#include #include #include #include @@ -56,7 +57,7 @@ TYPED_TEST(RepeatTypedTestFixture, RepeatScalarCount) thrust::make_counting_iterator(0), thrust::make_counting_iterator(0) + num_values); static_assert(repeat_count > 0, "repeat_count should be larger than 0."); - auto expected_elements = cudf::test::make_counting_transform_iterator( + auto expected_elements = cudf::detail::make_counting_transform_iterator( 0, [repeat_count](auto i) { return i / repeat_count; }); auto expected = cudf::test::fixed_width_column_wrapper( diff --git a/cpp/tests/groupby/groupby_test_util.hpp b/cpp/tests/groupby/groupby_test_util.hpp index 83c7a258e19..0b68b7bbfb4 100644 --- a/cpp/tests/groupby/groupby_test_util.hpp +++ b/cpp/tests/groupby/groupby_test_util.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, NVIDIA CORPORATION. + * Copyright (c) 2020-2021, 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,7 @@ #include #include +#include #include #include #include @@ -100,13 +101,13 @@ inline void test_single_agg(column_view const& keys, inline auto all_valid() { - auto all_valid = make_counting_transform_iterator(0, [](auto i) { return true; }); + auto all_valid = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return true; }); return all_valid; } inline auto all_null() { - auto all_null = make_counting_transform_iterator(0, [](auto i) { return false; }); + auto all_null = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return false; }); return all_null; } diff --git a/cpp/tests/hashing/hash_test.cpp b/cpp/tests/hashing/hash_test.cpp index 88415d820d6..f0d13390edf 100644 --- a/cpp/tests/hashing/hash_test.cpp +++ b/cpp/tests/hashing/hash_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2020, NVIDIA CORPORATION. + * Copyright (c) 2019-2021, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + +#include #include + #include #include #include @@ -389,7 +392,7 @@ TEST_F(MD5HashTest, MultiValueNulls) TEST_F(MD5HashTest, StringListsNulls) { - auto validity = make_counting_transform_iterator(0, [](auto i) { return i != 0; }); + auto validity = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i != 0; }); strings_column_wrapper const strings_col( {"", @@ -464,7 +467,7 @@ TEST_F(MD5HashTest, TestBoolListsWithNulls) fixed_width_column_wrapper const col3({0, 255, 255, 64, 49, 42, 5, 6, 102}, {1, 0, 0, 1, 1, 0, 0, 0, 1}); - auto validity = make_counting_transform_iterator(0, [](auto i) { return i != 1; }); + auto validity = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i != 1; }); lists_column_wrapper const list_col( {{0, 0, 0}, {1}, {}, {{1, 1, 1}, validity}, {1, 1}, {1, 1}, {1}, {1}, {1}}, validity); @@ -496,7 +499,7 @@ TYPED_TEST(MD5HashListTestTyped, TestListsWithNulls) fixed_width_column_wrapper const col3({0, 255, 255, 64, 49, 42, 5, 6, 102}, {1, 0, 0, 1, 1, 0, 0, 0, 1}); - auto validity = make_counting_transform_iterator(0, [](auto i) { return i != 1; }); + auto validity = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i != 1; }); lists_column_wrapper const list_col( {{0, 0, 0}, {127}, {}, {{32, 127, 64}, validity}, {27, 49}, {18, 68}, {100}, {101}, {102}}, validity); diff --git a/cpp/tests/interop/from_arrow_test.cpp b/cpp/tests/interop/from_arrow_test.cpp index b8f3bbb4b04..9f5bbe2dcb9 100644 --- a/cpp/tests/interop/from_arrow_test.cpp +++ b/cpp/tests/interop/from_arrow_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, NVIDIA CORPORATION. + * Copyright (c) 2020-2021, 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,17 +18,20 @@ #include #include #include +#include #include #include #include #include #include #include + #include #include #include #include #include + #include std::unique_ptr get_cudf_table() @@ -131,8 +134,9 @@ TYPED_TEST(FromArrowTestDurationsTest, DurationTable) TEST_F(FromArrowTest, NestedList) { - auto valids = cudf::test::make_counting_transform_iterator(0, [](auto i) { return i % 3 != 0; }); - auto col = cudf::test::lists_column_wrapper( + auto valids = + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i % 3 != 0; }); + auto col = cudf::test::lists_column_wrapper( {{{{{1, 2}, valids}, {{3, 4}, valids}, {5}}, {{6}, {{7, 8, 9}, valids}}}, valids}); cudf::table_view expected_table_view({col}); diff --git a/cpp/tests/interop/to_arrow_test.cpp b/cpp/tests/interop/to_arrow_test.cpp index dff710a17c8..c8e56711135 100644 --- a/cpp/tests/interop/to_arrow_test.cpp +++ b/cpp/tests/interop/to_arrow_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, NVIDIA CORPORATION. + * Copyright (c) 2020-2021, 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,17 +18,20 @@ #include #include #include +#include #include #include #include #include #include #include + #include #include #include #include #include + #include using vector_of_columns = std::vector>; @@ -235,8 +238,9 @@ TYPED_TEST(ToArrowTestDurationsTest, DurationTable) TEST_F(ToArrowTest, NestedList) { - auto valids = cudf::test::make_counting_transform_iterator(0, [](auto i) { return i % 3 != 0; }); - auto col = cudf::test::lists_column_wrapper( + auto valids = + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i % 3 != 0; }); + auto col = cudf::test::lists_column_wrapper( {{{{{1, 2}, valids}, {{3, 4}, valids}, {5}}, {{6}, {{7, 8, 9}, valids}}}, valids}); cudf::table_view input_view({col}); diff --git a/cpp/tests/io/csv_test.cpp b/cpp/tests/io/csv_test.cpp index 4dae480d39e..07d6001708b 100644 --- a/cpp/tests/io/csv_test.cpp +++ b/cpp/tests/io/csv_test.cpp @@ -21,14 +21,21 @@ #include #include +#include #include #include +#include #include #include #include +#include #include +#include +#include +#include + #include #include #include @@ -39,12 +46,6 @@ #include #include -#include -#include -#include -#include -#include - namespace cudf_io = cudf::io; template @@ -288,7 +289,7 @@ std::vector prepend_zeros(const std::vector& input, TYPED_TEST(CsvReaderNumericTypeTest, SingleColumn) { constexpr auto num_rows = 10; - auto sequence = cudf::test::make_counting_transform_iterator( + auto sequence = cudf::detail::make_counting_transform_iterator( 0, [](auto i) { return static_cast(i + 1000.50f); }); auto filepath = temp_env->get_temp_filepath("SingleColumn.csv"); @@ -1240,7 +1241,7 @@ TEST_F(CsvReaderTest, HexTest) TYPED_TEST(CsvReaderNumericTypeTest, SingleColumnWithWriter) { constexpr auto num_rows = 10; - auto sequence = cudf::test::make_counting_transform_iterator( + auto sequence = cudf::detail::make_counting_transform_iterator( 0, [](auto i) { return static_cast(i + 1000.50f); }); auto input_column = column_wrapper(sequence, sequence + num_rows); auto input_table = cudf::table_view{std::vector{input_column}}; @@ -1349,7 +1350,7 @@ TEST_F(CsvReaderTest, MultiColumnWithWriter) const auto result_sliced_view = result_table.select(non_float64s); CUDF_TEST_EXPECT_TABLES_EQUIVALENT(input_sliced_view, result_sliced_view); - auto validity = cudf::test::make_counting_transform_iterator(0, [](auto i) { return true; }); + auto validity = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return true; }); double tol{1.0e-6}; auto float64_col_idx = non_float64s.size(); check_float_column( @@ -1857,7 +1858,7 @@ TEST_F(CsvReaderTest, ParseOutOfRangeIntegers) TEST_F(CsvReaderTest, ReadMaxNumericValue) { constexpr auto num_rows = 10; - auto sequence = cudf::test::make_counting_transform_iterator( + auto sequence = cudf::detail::make_counting_transform_iterator( 0, [](auto i) { return std::numeric_limits::max() - i; }); auto filepath = temp_env->get_temp_filepath("ReadMaxNumericValue.csv"); @@ -1878,7 +1879,7 @@ TEST_F(CsvReaderTest, ReadMaxNumericValue) TEST_F(CsvReaderTest, DefaultWriteChunkSize) { for (auto num_rows : {1, 20, 100, 1000}) { - auto sequence = cudf::test::make_counting_transform_iterator( + auto sequence = cudf::detail::make_counting_transform_iterator( 0, [](auto i) { return static_cast(i + 1000.50f); }); auto input_column = column_wrapper(sequence, sequence + num_rows); auto input_table = cudf::table_view{std::vector{input_column}}; diff --git a/cpp/tests/io/json_test.cpp b/cpp/tests/io/json_test.cpp index 886af048aac..76dba91e3a7 100644 --- a/cpp/tests/io/json_test.cpp +++ b/cpp/tests/io/json_test.cpp @@ -20,17 +20,16 @@ #include #include +#include #include +#include #include #include #include -#include - #include #include - #include #define wrapper cudf::test::fixed_width_column_wrapper @@ -165,7 +164,7 @@ TEST_F(JsonReaderTest, BasicJsonLines) EXPECT_EQ(result.metadata.column_names[0], "0"); EXPECT_EQ(result.metadata.column_names[1], "1"); - auto validity = cudf::test::make_counting_transform_iterator(0, [](auto i) { return true; }); + auto validity = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return true; }); CUDF_TEST_EXPECT_COLUMNS_EQUAL(result.tbl->get_column(0), int_wrapper{{1, 2, 3}, validity}); CUDF_TEST_EXPECT_COLUMNS_EQUAL(result.tbl->get_column(1), @@ -190,7 +189,7 @@ TEST_F(JsonReaderTest, FloatingPoint) EXPECT_EQ(result.tbl->num_columns(), 1); EXPECT_EQ(result.tbl->get_column(0).type().id(), cudf::type_id::FLOAT32); - auto validity = cudf::test::make_counting_transform_iterator(0, [](auto i) { return true; }); + auto validity = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return true; }); CUDF_TEST_EXPECT_COLUMNS_EQUAL( result.tbl->get_column(0), @@ -223,7 +222,7 @@ TEST_F(JsonReaderTest, JsonLinesStrings) EXPECT_EQ(result.metadata.column_names[1], "1"); EXPECT_EQ(result.metadata.column_names[2], "2"); - auto validity = cudf::test::make_counting_transform_iterator(0, [](auto i) { return true; }); + auto validity = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return true; }); CUDF_TEST_EXPECT_COLUMNS_EQUAL(result.tbl->get_column(0), int_wrapper{{1, 2}, validity}); CUDF_TEST_EXPECT_COLUMNS_EQUAL(result.tbl->get_column(1), float64_wrapper{{1.1, 2.2}, validity}); @@ -270,7 +269,7 @@ TEST_F(JsonReaderTest, MultiColumn) .lines(true); cudf_io::table_with_metadata result = cudf_io::read_json(in_options); - auto validity = cudf::test::make_counting_transform_iterator(0, [](auto i) { return true; }); + auto validity = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return true; }); const auto view = result.tbl->view(); @@ -325,7 +324,7 @@ TEST_F(JsonReaderTest, Booleans) EXPECT_EQ(result.tbl->num_columns(), 1); EXPECT_EQ(result.tbl->get_column(0).type().id(), cudf::type_id::BOOL8); - auto validity = cudf::test::make_counting_transform_iterator(0, [](auto i) { return true; }); + auto validity = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return true; }); CUDF_TEST_EXPECT_COLUMNS_EQUAL(result.tbl->get_column(0), bool_wrapper{{true, true, false, false, true}, validity}); @@ -352,7 +351,7 @@ TEST_F(JsonReaderTest, Dates) EXPECT_EQ(result.tbl->num_columns(), 1); EXPECT_EQ(result.tbl->get_column(0).type().id(), cudf::type_id::TIMESTAMP_MILLISECONDS); - auto validity = cudf::test::make_counting_transform_iterator(0, [](auto i) { return true; }); + auto validity = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return true; }); CUDF_TEST_EXPECT_COLUMNS_EQUAL(result.tbl->get_column(0), timestamp_ms_wrapper{{983750400000, @@ -388,7 +387,7 @@ TEST_F(JsonReaderTest, Durations) EXPECT_EQ(result.tbl->num_columns(), 1); EXPECT_EQ(result.tbl->get_column(0).type().id(), cudf::type_id::DURATION_NANOSECONDS); - auto validity = cudf::test::make_counting_transform_iterator(0, [](auto i) { return true; }); + auto validity = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return true; }); CUDF_TEST_EXPECT_COLUMNS_EQUAL( result.tbl->get_column(0), @@ -424,7 +423,7 @@ TEST_F(JsonReaderTest, JsonLinesDtypeInference) EXPECT_EQ(std::string(result.metadata.column_names[1]), "1"); EXPECT_EQ(std::string(result.metadata.column_names[2]), "2"); - auto validity = cudf::test::make_counting_transform_iterator(0, [](auto i) { return true; }); + auto validity = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return true; }); CUDF_TEST_EXPECT_COLUMNS_EQUAL(result.tbl->get_column(0), int64_wrapper{{100, 200}, validity}); CUDF_TEST_EXPECT_COLUMNS_EQUAL(result.tbl->get_column(1), float64_wrapper{{1.1, 2.2}, validity}); @@ -453,7 +452,7 @@ TEST_F(JsonReaderTest, JsonLinesFileInput) EXPECT_EQ(std::string(result.metadata.column_names[0]), "0"); EXPECT_EQ(std::string(result.metadata.column_names[1]), "1"); - auto validity = cudf::test::make_counting_transform_iterator(0, [](auto i) { return true; }); + auto validity = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return true; }); CUDF_TEST_EXPECT_COLUMNS_EQUAL(result.tbl->get_column(0), int64_wrapper{{11, 22}, validity}); CUDF_TEST_EXPECT_COLUMNS_EQUAL(result.tbl->get_column(1), float64_wrapper{{1.1, 2.2}, validity}); @@ -480,7 +479,7 @@ TEST_F(JsonReaderTest, JsonLinesByteRange) EXPECT_EQ(result.tbl->get_column(0).type().id(), cudf::type_id::INT64); EXPECT_EQ(std::string(result.metadata.column_names[0]), "0"); - auto validity = cudf::test::make_counting_transform_iterator(0, [](auto i) { return true; }); + auto validity = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return true; }); CUDF_TEST_EXPECT_COLUMNS_EQUAL(result.tbl->get_column(0), int64_wrapper{{3000, 4000, 5000}, validity}); @@ -506,7 +505,7 @@ TEST_F(JsonReaderTest, JsonLinesObjects) EXPECT_EQ(result.tbl->get_column(1).type().id(), cudf::type_id::FLOAT64); EXPECT_EQ(std::string(result.metadata.column_names[1]), "col2"); - auto validity = cudf::test::make_counting_transform_iterator(0, [](auto i) { return true; }); + auto validity = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return true; }); CUDF_TEST_EXPECT_COLUMNS_EQUAL(result.tbl->get_column(0), int64_wrapper{{1}, validity}); CUDF_TEST_EXPECT_COLUMNS_EQUAL(result.tbl->get_column(1), float64_wrapper{{2.0}, validity}); @@ -532,7 +531,7 @@ TEST_F(JsonReaderTest, JsonLinesObjectsStrings) EXPECT_EQ(std::string(result.metadata.column_names[1]), "col2"); EXPECT_EQ(std::string(result.metadata.column_names[2]), "col3"); - auto validity = cudf::test::make_counting_transform_iterator(0, [](auto i) { return true; }); + auto validity = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return true; }); CUDF_TEST_EXPECT_COLUMNS_EQUAL(result.tbl->get_column(0), int64_wrapper{{100, 200}, validity}); CUDF_TEST_EXPECT_COLUMNS_EQUAL(result.tbl->get_column(1), @@ -574,9 +573,9 @@ TEST_F(JsonReaderTest, JsonLinesObjectsMissingData) EXPECT_EQ(std::string(result.metadata.column_names[2]), "col1"); auto col1_validity = - cudf::test::make_counting_transform_iterator(0, [](auto i) { return i != 0; }); + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i != 0; }); auto col2_validity = - cudf::test::make_counting_transform_iterator(0, [](auto i) { return i == 0; }); + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i == 0; }); CUDF_TEST_EXPECT_COLUMNS_EQUAL(result.tbl->get_column(2), float64_wrapper{{0., 200.}, col1_validity}); @@ -608,7 +607,7 @@ TEST_F(JsonReaderTest, JsonLinesObjectsOutOfOrder) EXPECT_EQ(std::string(result.metadata.column_names[1]), "col2"); EXPECT_EQ(std::string(result.metadata.column_names[2]), "col3"); - auto validity = cudf::test::make_counting_transform_iterator(0, [](auto i) { return true; }); + auto validity = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return true; }); CUDF_TEST_EXPECT_COLUMNS_EQUAL(result.tbl->get_column(0), int64_wrapper{{100, 200}, validity}); CUDF_TEST_EXPECT_COLUMNS_EQUAL(result.tbl->get_column(1), float64_wrapper{{1.1, 2.2}, validity}); @@ -673,7 +672,7 @@ TEST_F(JsonReaderTest, ArrowFileSource) static_cast(in_options.get_dtypes().size())); EXPECT_EQ(result.tbl->get_column(0).type().id(), cudf::type_id::INT8); - auto validity = cudf::test::make_counting_transform_iterator(0, [](auto i) { return true; }); + auto validity = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return true; }); CUDF_TEST_EXPECT_COLUMNS_EQUAL(result.tbl->get_column(0), int8_wrapper{{9, 8, 7, 6, 5, 4, 3, 2}, validity}); diff --git a/cpp/tests/io/orc_test.cpp b/cpp/tests/io/orc_test.cpp index a93c3170445..cc4c9b700af 100644 --- a/cpp/tests/io/orc_test.cpp +++ b/cpp/tests/io/orc_test.cpp @@ -23,6 +23,7 @@ #include #include +#include #include #include #include @@ -51,12 +52,12 @@ std::unique_ptr create_random_fixed_table(cudf::size_type num_colum cudf::size_type num_rows, bool include_validity) { - auto valids = cudf::test::make_counting_transform_iterator( + auto valids = cudf::detail::make_counting_transform_iterator( 0, [](auto i) { return i % 2 == 0 ? true : false; }); std::vector> src_cols(num_columns); for (int idx = 0; idx < num_columns; idx++) { auto rand_elements = - cudf::test::make_counting_transform_iterator(0, [](T i) { return rand(); }); + cudf::detail::make_counting_transform_iterator(0, [](T i) { return rand(); }); if (include_validity) { src_cols[idx] = cudf::test::fixed_width_column_wrapper(rand_elements, rand_elements + num_rows, valids); @@ -155,8 +156,8 @@ struct SkipRowTest { int file_num_rows, int read_num_rows) { - auto sequence = cudf::test::make_counting_transform_iterator(0, [](auto i) { return i; }); - auto validity = cudf::test::make_counting_transform_iterator(0, [](auto i) { return true; }); + auto sequence = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i; }); + auto validity = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return true; }); column_wrapper input_col( sequence, sequence + file_num_rows, validity); @@ -216,8 +217,8 @@ struct SkipRowTest { TYPED_TEST(OrcWriterNumericTypeTest, SingleColumn) { - auto sequence = cudf::test::make_counting_transform_iterator(0, [](auto i) { return i; }); - auto validity = cudf::test::make_counting_transform_iterator(0, [](auto i) { return true; }); + auto sequence = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i; }); + auto validity = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return true; }); constexpr auto num_rows = 100; column_wrapper col( @@ -242,8 +243,8 @@ TYPED_TEST(OrcWriterNumericTypeTest, SingleColumn) TYPED_TEST(OrcWriterNumericTypeTest, SingleColumnWithNulls) { - auto sequence = cudf::test::make_counting_transform_iterator(0, [](auto i) { return i; }); - auto validity = cudf::test::make_counting_transform_iterator(0, [](auto i) { return (i % 2); }); + auto sequence = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i; }); + auto validity = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return (i % 2); }); constexpr auto num_rows = 100; column_wrapper col( @@ -269,8 +270,8 @@ TYPED_TEST(OrcWriterNumericTypeTest, SingleColumnWithNulls) TYPED_TEST(OrcWriterTimestampTypeTest, Timestamps) { auto sequence = - cudf::test::make_counting_transform_iterator(0, [](auto i) { return (std::rand() / 10); }); - auto validity = cudf::test::make_counting_transform_iterator(0, [](auto i) { return true; }); + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return (std::rand() / 10); }); + auto validity = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return true; }); constexpr auto num_rows = 100; column_wrapper col( @@ -298,9 +299,9 @@ TYPED_TEST(OrcWriterTimestampTypeTest, Timestamps) TYPED_TEST(OrcWriterTimestampTypeTest, TimestampsWithNulls) { auto sequence = - cudf::test::make_counting_transform_iterator(0, [](auto i) { return (std::rand() / 10); }); + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return (std::rand() / 10); }); auto validity = - cudf::test::make_counting_transform_iterator(0, [](auto i) { return (i > 30) && (i < 60); }); + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return (i > 30) && (i < 60); }); constexpr auto num_rows = 100; column_wrapper col( @@ -335,7 +336,7 @@ TEST_F(OrcWriterTest, MultiColumn) auto col3_data = random_values(num_rows); auto col4_data = random_values(num_rows); auto col5_data = random_values(num_rows); - auto validity = cudf::test::make_counting_transform_iterator(0, [](auto i) { return true; }); + auto validity = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return true; }); column_wrapper col0{col0_data.begin(), col0_data.end(), validity}; column_wrapper col1{col1_data.begin(), col1_data.end(), validity}; @@ -386,14 +387,17 @@ TEST_F(OrcWriterTest, MultiColumnWithNulls) auto col3_data = random_values(num_rows); auto col4_data = random_values(num_rows); auto col5_data = random_values(num_rows); - auto col0_mask = cudf::test::make_counting_transform_iterator(0, [](auto i) { return (i % 2); }); - auto col1_mask = cudf::test::make_counting_transform_iterator(0, [](auto i) { return (i < 10); }); - auto col2_mask = cudf::test::make_counting_transform_iterator(0, [](auto i) { return true; }); + auto col0_mask = + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return (i % 2); }); + auto col1_mask = + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return (i < 10); }); + auto col2_mask = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return true; }); auto col3_mask = - cudf::test::make_counting_transform_iterator(0, [](auto i) { return (i == (num_rows - 1)); }); + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return (i == (num_rows - 1)); }); auto col4_mask = - cudf::test::make_counting_transform_iterator(0, [](auto i) { return (i >= 40 || i <= 60); }); - auto col5_mask = cudf::test::make_counting_transform_iterator(0, [](auto i) { return (i > 80); }); + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return (i >= 40 || i <= 60); }); + auto col5_mask = + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return (i > 80); }); column_wrapper col0{col0_data.begin(), col0_data.end(), col0_mask}; column_wrapper col1{col1_data.begin(), col1_data.end(), col1_mask}; @@ -436,8 +440,8 @@ TEST_F(OrcWriterTest, MultiColumnWithNulls) TEST_F(OrcWriterTest, ReadZeroRows) { - auto sequence = cudf::test::make_counting_transform_iterator(0, [](auto i) { return i; }); - auto validity = cudf::test::make_counting_transform_iterator(0, [](auto i) { return true; }); + auto sequence = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i; }); + auto validity = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return true; }); constexpr auto num_rows = 10; column_wrapper col( @@ -471,7 +475,7 @@ TEST_F(OrcWriterTest, Strings) auto seq_col0 = random_values(num_rows); auto seq_col2 = random_values(num_rows); - auto validity = cudf::test::make_counting_transform_iterator(0, [](auto i) { return true; }); + auto validity = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return true; }); column_wrapper col0{seq_col0.begin(), seq_col0.end(), validity}; column_wrapper col1{strings.begin(), strings.end()}; @@ -513,7 +517,7 @@ TEST_F(OrcWriterTest, SlicedTable) auto seq_col0 = random_values(num_rows); auto seq_col2 = random_values(num_rows); - auto validity = cudf::test::make_counting_transform_iterator(0, [](auto i) { return true; }); + auto validity = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return true; }); column_wrapper col0{seq_col0.begin(), seq_col0.end(), validity}; column_wrapper col1{strings.begin(), strings.end()}; @@ -552,7 +556,7 @@ TEST_F(OrcWriterTest, HostBuffer) constexpr auto num_rows = 100 << 10; const auto seq_col = random_values(num_rows); const auto validity = - cudf::test::make_counting_transform_iterator(0, [](auto i) { return true; }); + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return true; }); column_wrapper col{seq_col.begin(), seq_col.end(), validity}; cudf_io::table_metadata expected_metadata; @@ -934,9 +938,9 @@ TEST_F(OrcReaderTest, CombinedSkipRowTest) TEST_F(OrcStatisticsTest, Basic) { - auto sequence = cudf::test::make_counting_transform_iterator(0, [](auto i) { return i; }); - auto validity = cudf::test::make_counting_transform_iterator(0, [](auto i) { return i % 2; }); - auto valid_all = cudf::test::make_counting_transform_iterator(0, [](auto i) { return true; }); + auto sequence = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i; }); + auto validity = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i % 2; }); + auto valid_all = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return true; }); std::vector strings{ "Monday", "Monday", "Friday", "Monday", "Friday", "Friday", "Friday", "Wednesday", "Tuesday"}; diff --git a/cpp/tests/io/parquet_test.cpp b/cpp/tests/io/parquet_test.cpp index 34b9a2565e2..420bdc3e3ba 100644 --- a/cpp/tests/io/parquet_test.cpp +++ b/cpp/tests/io/parquet_test.cpp @@ -16,6 +16,7 @@ #include #include +#include #include #include #include @@ -55,7 +56,7 @@ std::unique_ptr create_fixed_table(cudf::size_type num_columns, bool include_validity, Elements elements) { - auto valids = cudf::test::make_counting_transform_iterator( + auto valids = cudf::detail::make_counting_transform_iterator( 0, [](auto i) { return i % 2 == 0 ? true : false; }); std::vector> src_cols(num_columns); for (int idx = 0; idx < num_columns; idx++) { @@ -83,7 +84,8 @@ std::unique_ptr create_random_fixed_table(cudf::size_type num_colum cudf::size_type num_rows, bool include_validity) { - auto rand_elements = cudf::test::make_counting_transform_iterator(0, [](T i) { return rand(); }); + auto rand_elements = + cudf::detail::make_counting_transform_iterator(0, [](T i) { return rand(); }); return create_fixed_table(num_columns, num_rows, include_validity, rand_elements); } @@ -94,7 +96,7 @@ std::unique_ptr create_compressible_fixed_table(cudf::size_type num bool include_validity) { auto compressible_elements = - cudf::test::make_counting_transform_iterator(0, [period](T i) { return i / period; }); + cudf::detail::make_counting_transform_iterator(0, [period](T i) { return i / period; }); return create_fixed_table(num_columns, num_rows, include_validity, compressible_elements); } @@ -170,8 +172,8 @@ inline auto random_values(size_t size) TYPED_TEST(ParquetWriterNumericTypeTest, SingleColumn) { auto sequence = - cudf::test::make_counting_transform_iterator(0, [](auto i) { return TypeParam(i); }); - auto validity = cudf::test::make_counting_transform_iterator(0, [](auto i) { return true; }); + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return TypeParam(i); }); + auto validity = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return true; }); constexpr auto num_rows = 100; column_wrapper col(sequence, sequence + num_rows, validity); @@ -196,8 +198,8 @@ TYPED_TEST(ParquetWriterNumericTypeTest, SingleColumn) TYPED_TEST(ParquetWriterNumericTypeTest, SingleColumnWithNulls) { auto sequence = - cudf::test::make_counting_transform_iterator(0, [](auto i) { return TypeParam(i); }); - auto validity = cudf::test::make_counting_transform_iterator(0, [](auto i) { return (i % 2); }); + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return TypeParam(i); }); + auto validity = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return (i % 2); }); constexpr auto num_rows = 100; column_wrapper col(sequence, sequence + num_rows, validity); @@ -221,9 +223,9 @@ TYPED_TEST(ParquetWriterNumericTypeTest, SingleColumnWithNulls) TYPED_TEST(ParquetWriterChronoTypeTest, Chronos) { - auto sequence = cudf::test::make_counting_transform_iterator( + auto sequence = cudf::detail::make_counting_transform_iterator( 0, [](auto i) { return ((std::rand() / 10000) * 1000); }); - auto validity = cudf::test::make_counting_transform_iterator(0, [](auto i) { return true; }); + auto validity = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return true; }); constexpr auto num_rows = 100; column_wrapper col( @@ -249,10 +251,10 @@ TYPED_TEST(ParquetWriterChronoTypeTest, Chronos) TYPED_TEST(ParquetWriterChronoTypeTest, ChronosWithNulls) { - auto sequence = cudf::test::make_counting_transform_iterator( + auto sequence = cudf::detail::make_counting_transform_iterator( 0, [](auto i) { return ((std::rand() / 10000) * 1000); }); auto validity = - cudf::test::make_counting_transform_iterator(0, [](auto i) { return (i > 30) && (i < 60); }); + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return (i > 30) && (i < 60); }); constexpr auto num_rows = 100; column_wrapper col( @@ -288,13 +290,13 @@ TEST_F(ParquetWriterTest, MultiColumn) auto col5_data = random_values(num_rows); auto col6_vals = random_values(num_rows); auto col7_vals = random_values(num_rows); - auto col6_data = cudf::test::make_counting_transform_iterator(0, [col6_vals](auto i) { + auto col6_data = cudf::detail::make_counting_transform_iterator(0, [col6_vals](auto i) { return numeric::decimal32{col6_vals[i], numeric::scale_type{5}}; }); - auto col7_data = cudf::test::make_counting_transform_iterator(0, [col7_vals](auto i) { + auto col7_data = cudf::detail::make_counting_transform_iterator(0, [col7_vals](auto i) { return numeric::decimal64{col7_vals[i], numeric::scale_type{-5}}; }); - auto validity = cudf::test::make_counting_transform_iterator(0, [](auto i) { return true; }); + auto validity = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return true; }); // column_wrapper col0{ // col0_data.begin(), col0_data.end(), validity}; @@ -356,24 +358,27 @@ TEST_F(ParquetWriterTest, MultiColumnWithNulls) auto col5_data = random_values(num_rows); auto col6_vals = random_values(num_rows); auto col7_vals = random_values(num_rows); - auto col6_data = cudf::test::make_counting_transform_iterator(0, [col6_vals](auto i) { + auto col6_data = cudf::detail::make_counting_transform_iterator(0, [col6_vals](auto i) { return numeric::decimal32{col6_vals[i], numeric::scale_type{-2}}; }); - auto col7_data = cudf::test::make_counting_transform_iterator(0, [col7_vals](auto i) { + auto col7_data = cudf::detail::make_counting_transform_iterator(0, [col7_vals](auto i) { return numeric::decimal64{col7_vals[i], numeric::scale_type{-8}}; }); - // auto col0_mask = cudf::test::make_counting_transform_iterator( + // auto col0_mask = cudf::detail::make_counting_transform_iterator( // 0, [](auto i) { return (i % 2); }); - auto col1_mask = cudf::test::make_counting_transform_iterator(0, [](auto i) { return (i < 10); }); - auto col2_mask = cudf::test::make_counting_transform_iterator(0, [](auto i) { return true; }); + auto col1_mask = + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return (i < 10); }); + auto col2_mask = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return true; }); auto col3_mask = - cudf::test::make_counting_transform_iterator(0, [](auto i) { return (i == (num_rows - 1)); }); + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return (i == (num_rows - 1)); }); auto col4_mask = - cudf::test::make_counting_transform_iterator(0, [](auto i) { return (i >= 40 || i <= 60); }); - auto col5_mask = cudf::test::make_counting_transform_iterator(0, [](auto i) { return (i > 80); }); - auto col6_mask = cudf::test::make_counting_transform_iterator(0, [](auto i) { return (i % 5); }); + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return (i >= 40 || i <= 60); }); + auto col5_mask = + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return (i > 80); }); + auto col6_mask = + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return (i % 5); }); auto col7_mask = - cudf::test::make_counting_transform_iterator(0, [](auto i) { return (i != 55); }); + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return (i != 55); }); // column_wrapper col0{ // col0_data.begin(), col0_data.end(), col0_mask}; @@ -432,7 +437,7 @@ TEST_F(ParquetWriterTest, Strings) auto seq_col0 = random_values(num_rows); auto seq_col2 = random_values(num_rows); - auto validity = cudf::test::make_counting_transform_iterator(0, [](auto i) { return true; }); + auto validity = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return true; }); column_wrapper col0{seq_col0.begin(), seq_col0.end(), validity}; column_wrapper col1{strings.begin(), strings.end()}; @@ -474,7 +479,7 @@ TEST_F(ParquetWriterTest, SlicedTable) auto seq_col0 = random_values(num_rows); auto seq_col2 = random_values(num_rows); - auto validity = cudf::test::make_counting_transform_iterator(0, [](auto i) { return true; }); + auto validity = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return true; }); column_wrapper col0{seq_col0.begin(), seq_col0.end(), validity}; column_wrapper col1{strings.begin(), strings.end()}; @@ -491,8 +496,8 @@ TEST_F(ParquetWriterTest, SlicedTable) // [NULL, [[13],[14,15,16]], NULL] // [[[]]] // [NULL, [], NULL, [[]]] - auto valids = cudf::test::make_counting_transform_iterator(0, [](auto i) { return i % 2; }); - auto valids2 = cudf::test::make_counting_transform_iterator(0, [](auto i) { return i != 3; }); + auto valids = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i % 2; }); + auto valids2 = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i != 3; }); lcw col4{{ {{{{1, 2, 3, 4}, valids}}, {{{5, 6, 7}, valids}, {8, 9}}}, {{{{10, 11}, {12}}, {{13}, {14, 15, 16}}, {{17, 18}}}, valids}, @@ -532,8 +537,8 @@ TEST_F(ParquetWriterTest, SlicedTable) TEST_F(ParquetWriterTest, ListColumn) { - auto valids = cudf::test::make_counting_transform_iterator(0, [](auto i) { return i % 2; }); - auto valids2 = cudf::test::make_counting_transform_iterator(0, [](auto i) { return i != 3; }); + auto valids = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i % 2; }); + auto valids2 = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i != 3; }); using lcw = cudf::test::lists_column_wrapper; @@ -637,7 +642,7 @@ TEST_F(ParquetWriterTest, MultiIndex) auto col3_data = random_values(num_rows); auto col4_data = random_values(num_rows); auto col5_data = random_values(num_rows); - auto validity = cudf::test::make_counting_transform_iterator(0, [](auto i) { return true; }); + auto validity = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return true; }); column_wrapper col1{col1_data.begin(), col1_data.end(), validity}; column_wrapper col2{col2_data.begin(), col2_data.end(), validity}; @@ -684,7 +689,7 @@ TEST_F(ParquetWriterTest, HostBuffer) constexpr auto num_rows = 100 << 10; const auto seq_col = random_values(num_rows); const auto validity = - cudf::test::make_counting_transform_iterator(0, [](auto i) { return true; }); + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return true; }); column_wrapper col{seq_col.begin(), seq_col.end(), validity}; cudf_io::table_metadata expected_metadata; @@ -993,8 +998,8 @@ TEST_F(ParquetChunkedWriterTest, Strings) TEST_F(ParquetChunkedWriterTest, ListColumn) { - auto valids = cudf::test::make_counting_transform_iterator(0, [](auto i) { return i % 2; }); - auto valids2 = cudf::test::make_counting_transform_iterator(0, [](auto i) { return i != 3; }); + auto valids = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i % 2; }); + auto valids2 = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i != 3; }); using lcw = cudf::test::lists_column_wrapper; @@ -1111,8 +1116,8 @@ TEST_F(ParquetChunkedWriterTest, MismatchedStructure) TEST_F(ParquetChunkedWriterTest, MismatchedStructureList) { - auto valids = cudf::test::make_counting_transform_iterator(0, [](auto i) { return i % 2; }); - auto valids2 = cudf::test::make_counting_transform_iterator(0, [](auto i) { return i != 3; }); + auto valids = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i % 2; }); + auto valids2 = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i != 3; }); using lcw = cudf::test::lists_column_wrapper; @@ -1203,8 +1208,8 @@ TEST_F(ParquetChunkedWriterTest, ForcedNullabilityList) { srand(31337); - auto valids = cudf::test::make_counting_transform_iterator(0, [](auto i) { return i % 2; }); - auto valids2 = cudf::test::make_counting_transform_iterator(0, [](auto i) { return i != 3; }); + auto valids = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i % 2; }); + auto valids2 = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i != 3; }); using lcw = cudf::test::lists_column_wrapper; @@ -1329,7 +1334,8 @@ TEST_F(ParquetChunkedWriterTest, DecimalWrite) auto seq_col0 = random_values(num_rows); auto seq_col1 = random_values(num_rows); - auto valids = cudf::test::make_counting_transform_iterator(0, [](auto i) { return i % 2 == 0; }); + auto valids = + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i % 2 == 0; }); auto col0 = cudf::test::fixed_point_column_wrapper{ seq_col0.begin(), seq_col0.end(), valids, numeric::scale_type{5}}; @@ -2006,7 +2012,8 @@ TEST_F(ParquetReaderTest, DecimalRead) cudf_io::source_info{reinterpret_cast(decimals_parquet), decimals_parquet_len}); auto result = cudf_io::read_parquet(read_opts); - auto validity = cudf::test::make_counting_transform_iterator(0, [](auto i) { return i != 50; }); + auto validity = + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i != 50; }); EXPECT_EQ(result.tbl->view().num_columns(), 3); @@ -2154,7 +2161,7 @@ TEST_F(ParquetReaderTest, DecimalRead) EXPECT_EQ(result.tbl->view().num_columns(), 2); auto validity_c0 = - cudf::test::make_counting_transform_iterator(0, [](auto i) { return i != 19; }); + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i != 19; }); int64_t col0_data[] = {6361295, 698632, 7821423, 7073444, 9631892, 3021012, 5195059, 9913714, 901749, 7776938, 3186566, 4955569, 5131067, 98619, 2282579, 7521455, 4430706, 1937859, 4532040, 0}; @@ -2166,7 +2173,7 @@ TEST_F(ParquetReaderTest, DecimalRead) cudf::test::expect_columns_equal(result.tbl->view().column(0), col0); auto validity_c1 = - cudf::test::make_counting_transform_iterator(0, [](auto i) { return i != 18; }); + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i != 18; }); int64_t col1_data[] = {361378026250, 30646804862, 429930238629, diff --git a/cpp/tests/iterator/value_iterator_test.cu b/cpp/tests/iterator/value_iterator_test.cu index 293a33881b3..3ad7ac6d0cd 100644 --- a/cpp/tests/iterator/value_iterator_test.cu +++ b/cpp/tests/iterator/value_iterator_test.cu @@ -16,7 +16,7 @@ auto strings_to_string_views(std::vector& input_strings) { - auto all_valid = cudf::test::make_counting_transform_iterator(0, [](auto i) { return true; }); + auto all_valid = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return true; }); std::vector chars; std::vector offsets; std::tie(chars, offsets) = cudf::test::detail::make_chars_and_offsets( diff --git a/cpp/tests/join/semi_join_tests.cpp b/cpp/tests/join/semi_join_tests.cpp index b704e84fb19..13c74616484 100644 --- a/cpp/tests/join/semi_join_tests.cpp +++ b/cpp/tests/join/semi_join_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2020, NVIDIA CORPORATION. + * Copyright (c) 2019-2021, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,6 +26,8 @@ #include #include +#include + template using column_wrapper = cudf::test::fixed_width_column_wrapper; diff --git a/cpp/tests/lead_lag/lead_lag_test.cpp b/cpp/tests/lead_lag/lead_lag_test.cpp index e4ee6da4063..749475a9fc3 100644 --- a/cpp/tests/lead_lag/lead_lag_test.cpp +++ b/cpp/tests/lead_lag/lead_lag_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, NVIDIA CORPORATION. + * Copyright (c) 2020-2021, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,27 +14,32 @@ * limitations under the License. */ -#include -#include -#include #include #include +#include #include #include #include #include #include #include + #include #include #include #include #include + +#include + +#include +#include + +#include #include #include #include #include -#include using cudf::size_type; using namespace cudf::test; @@ -423,7 +428,8 @@ TYPED_TEST(TypedLeadLagWindowTest, TestLeadLagWithAllNullInput) using T = TypeParam; auto const input_col = fixed_width_column_wrapper{ - {0, 1, 2, 3, 4, 5, 0, 10, 20, 30, 40, 50}, make_counting_transform_iterator(0, [](auto i) { + {0, 1, 2, 3, 4, 5, 0, 10, 20, 30, 40, 50}, + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return false; })}.release(); @@ -476,7 +482,7 @@ TYPED_TEST(TypedLeadLagWindowTest, DefaultValuesWithoutLeadLag) using T = TypeParam; auto const input_col = fixed_width_column_wrapper{ - {0, 1, 2, 3, 4, 5}, make_counting_transform_iterator(0, [](auto i) { + {0, 1, 2, 3, 4, 5}, cudf::detail::make_counting_transform_iterator(0, [](auto i) { return true; })}.release(); @@ -512,7 +518,7 @@ TEST_F(LeadLagWindowTest, LeadLagWithoutFixedWidthInput) // Check that Lead/Lag aren't supported for non-fixed-width types. auto const input_col = strings_column_wrapper{ - {"0", "1", "2", "3", "4", "5"}, make_counting_transform_iterator(0, [](auto i) { + {"0", "1", "2", "3", "4", "5"}, cudf::detail::make_counting_transform_iterator(0, [](auto i) { return false; })}.release(); diff --git a/cpp/tests/lists/contains_tests.cpp b/cpp/tests/lists/contains_tests.cpp index 1885f626490..5a3eab07d4c 100644 --- a/cpp/tests/lists/contains_tests.cpp +++ b/cpp/tests/lists/contains_tests.cpp @@ -16,6 +16,7 @@ */ #include +#include #include #include #include @@ -142,7 +143,7 @@ TYPED_TEST(TypedContainsTest, ListContainsScalarWithNullLists) {}, {1, 2, 3}, {}}, - make_counting_transform_iterator(0, [](auto i) { + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return (i != 3) && (i != 10); })}.release(); @@ -150,9 +151,10 @@ TYPED_TEST(TypedContainsTest, ListContainsScalarWithNullLists) auto actual_result = lists::contains(search_space->view(), *search_key_one); - auto expected_result = fixed_width_column_wrapper{ - {1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0}, - make_counting_transform_iterator(0, [](auto i) { return (i != 3) && (i != 10); })}; + auto expected_result = + fixed_width_column_wrapper{{1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0}, + cudf::detail::make_counting_transform_iterator( + 0, [](auto i) { return (i != 3) && (i != 10); })}; CUDF_TEST_EXPECT_COLUMNS_EQUIVALENT(expected_result, *actual_result); } @@ -164,7 +166,7 @@ TYPED_TEST(TypedContainsTest, ListContainsScalarNonNullListsWithNullValues) auto numerals = fixed_width_column_wrapper{ {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4}, - make_counting_transform_iterator(0, [](auto i) -> bool { return i % 3; })}; + cudf::detail::make_counting_transform_iterator(0, [](auto i) -> bool { return i % 3; })}; auto search_space = make_lists_column(8, @@ -189,9 +191,10 @@ TYPED_TEST(TypedContainsTest, ListContainsScalarWithNullsInLists) auto numerals = fixed_width_column_wrapper{ {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4}, - make_counting_transform_iterator(0, [](auto i) -> bool { return i % 3; })}; + cudf::detail::make_counting_transform_iterator(0, [](auto i) -> bool { return i % 3; })}; - auto input_null_mask_iter = make_counting_transform_iterator(0, [](auto i) { return i != 4; }); + auto input_null_mask_iter = + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i != 4; }); auto search_space = make_lists_column( 8, @@ -216,9 +219,10 @@ TEST_F(ContainsTest, BoolListContainsScalarWithNullsInLists) auto numerals = fixed_width_column_wrapper{ {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4}, - make_counting_transform_iterator(0, [](auto i) -> bool { return i % 3; })}; + cudf::detail::make_counting_transform_iterator(0, [](auto i) -> bool { return i % 3; })}; - auto input_null_mask_iter = make_counting_transform_iterator(0, [](auto i) { return i != 4; }); + auto input_null_mask_iter = + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i != 4; }); auto search_space = make_lists_column( 8, @@ -243,9 +247,10 @@ TEST_F(ContainsTest, StringListContainsScalarWithNullsInLists) auto strings = strings_column_wrapper{ {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "1", "2", "3", "4"}, - make_counting_transform_iterator(0, [](auto i) -> bool { return i % 3; })}; + cudf::detail::make_counting_transform_iterator(0, [](auto i) -> bool { return i % 3; })}; - auto input_null_mask_iter = make_counting_transform_iterator(0, [](auto i) { return i != 4; }); + auto input_null_mask_iter = + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i != 4; }); auto search_space = make_lists_column( 8, @@ -280,7 +285,7 @@ TYPED_TEST(TypedContainsTest, ContainsScalarNullSearchKey) {}, {1, 2, 3}, {}}, - make_counting_transform_iterator(0, [](auto i) { + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return (i != 3) && (i != 10); })}.release(); @@ -290,7 +295,7 @@ TYPED_TEST(TypedContainsTest, ContainsScalarNullSearchKey) auto expected_result = fixed_width_column_wrapper{ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - make_counting_transform_iterator(0, [](auto i) { return false; })}; + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return false; })}; CUDF_TEST_EXPECT_COLUMNS_EQUIVALENT(expected_result, *actual_result); } @@ -375,7 +380,7 @@ TYPED_TEST(TypedVectorContainsTest, ListContainsVectorWithNullLists) {}, {1, 2, 3}, {}}, - make_counting_transform_iterator(0, [](auto i) { + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return (i != 3) && (i != 10); })}.release(); @@ -383,9 +388,10 @@ TYPED_TEST(TypedVectorContainsTest, ListContainsVectorWithNullLists) auto actual_result = lists::contains(search_space->view(), search_keys); - auto expected_result = fixed_width_column_wrapper{ - {1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0}, - make_counting_transform_iterator(0, [](auto i) { return (i != 3) && (i != 10); })}; + auto expected_result = + fixed_width_column_wrapper{{1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0}, + cudf::detail::make_counting_transform_iterator( + 0, [](auto i) { return (i != 3) && (i != 10); })}; CUDF_TEST_EXPECT_COLUMNS_EQUIVALENT(expected_result, *actual_result); } @@ -397,7 +403,7 @@ TYPED_TEST(TypedVectorContainsTest, ListContainsVectorNonNullListsWithNullValues auto numerals = fixed_width_column_wrapper{ {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4}, - make_counting_transform_iterator(0, [](auto i) -> bool { return i % 3; })}; + cudf::detail::make_counting_transform_iterator(0, [](auto i) -> bool { return i % 3; })}; auto search_space = make_lists_column(8, @@ -422,9 +428,10 @@ TYPED_TEST(TypedVectorContainsTest, ListContainsVectorWithNullsInLists) auto numerals = fixed_width_column_wrapper{ {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4}, - make_counting_transform_iterator(0, [](auto i) -> bool { return i % 3; })}; + cudf::detail::make_counting_transform_iterator(0, [](auto i) -> bool { return i % 3; })}; - auto input_null_mask_iter = make_counting_transform_iterator(0, [](auto i) { return i != 4; }); + auto input_null_mask_iter = + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i != 4; }); auto search_space = make_lists_column( 8, @@ -449,9 +456,10 @@ TYPED_TEST(TypedVectorContainsTest, ListContainsVectorWithNullsInListsAndInSearc auto numerals = fixed_width_column_wrapper{ {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4}, - make_counting_transform_iterator(0, [](auto i) -> bool { return i % 3; })}; + cudf::detail::make_counting_transform_iterator(0, [](auto i) -> bool { return i % 3; })}; - auto input_null_mask_iter = make_counting_transform_iterator(0, [](auto i) { return i != 4; }); + auto input_null_mask_iter = + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i != 4; }); auto search_space = make_lists_column( 8, @@ -461,7 +469,8 @@ TYPED_TEST(TypedVectorContainsTest, ListContainsVectorWithNullsInListsAndInSearc cudf::test::detail::make_null_mask(input_null_mask_iter, input_null_mask_iter + 8)); auto search_keys = fixed_width_column_wrapper{ - {1, 2, 3, 1, 2, 3, 1, 3}, make_counting_transform_iterator(0, [](auto i) { return i != 6; })}; + {1, 2, 3, 1, 2, 3, 1, 3}, + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i != 6; })}; auto actual_result = lists::contains(search_space->view(), search_keys); @@ -477,9 +486,10 @@ TEST_F(ContainsTest, BoolListContainsVectorWithNullsInListsAndInSearchKeys) auto numerals = fixed_width_column_wrapper{ {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4}, - make_counting_transform_iterator(0, [](auto i) -> bool { return i % 3; })}; + cudf::detail::make_counting_transform_iterator(0, [](auto i) -> bool { return i % 3; })}; - auto input_null_mask_iter = make_counting_transform_iterator(0, [](auto i) { return i != 4; }); + auto input_null_mask_iter = + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i != 4; }); auto search_space = make_lists_column( 8, @@ -489,7 +499,8 @@ TEST_F(ContainsTest, BoolListContainsVectorWithNullsInListsAndInSearchKeys) cudf::test::detail::make_null_mask(input_null_mask_iter, input_null_mask_iter + 8)); auto search_keys = fixed_width_column_wrapper{ - {0, 1, 0, 1, 0, 0, 1, 1}, make_counting_transform_iterator(0, [](auto i) { return i != 6; })}; + {0, 1, 0, 1, 0, 0, 1, 1}, + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i != 6; })}; auto actual_result = lists::contains(search_space->view(), search_keys); @@ -503,9 +514,10 @@ TEST_F(ContainsTest, StringListContainsVectorWithNullsInListsAndInSearchKeys) { auto numerals = strings_column_wrapper{ {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "1", "2", "3", "4"}, - make_counting_transform_iterator(0, [](auto i) -> bool { return i % 3; })}; + cudf::detail::make_counting_transform_iterator(0, [](auto i) -> bool { return i % 3; })}; - auto input_null_mask_iter = make_counting_transform_iterator(0, [](auto i) { return i != 4; }); + auto input_null_mask_iter = + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i != 4; }); auto search_space = make_lists_column( 8, @@ -514,9 +526,9 @@ TEST_F(ContainsTest, StringListContainsVectorWithNullsInListsAndInSearchKeys) 1, cudf::test::detail::make_null_mask(input_null_mask_iter, input_null_mask_iter + 8)); - auto search_keys = - strings_column_wrapper{{"1", "2", "3", "1", "2", "3", "1", "3"}, - make_counting_transform_iterator(0, [](auto i) { return i != 6; })}; + auto search_keys = strings_column_wrapper{ + {"1", "2", "3", "1", "2", "3", "1", "3"}, + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i != 6; })}; auto actual_result = lists::contains(search_space->view(), search_keys); diff --git a/cpp/tests/merge/merge_string_test.cpp b/cpp/tests/merge/merge_string_test.cpp index 118deb8f9c5..625a947d8e8 100644 --- a/cpp/tests/merge/merge_string_test.cpp +++ b/cpp/tests/merge/merge_string_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, NVIDIA CORPORATION. + * Copyright (c) 2020-2021, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,6 +15,7 @@ */ #include +#include #include #include #include @@ -50,7 +51,7 @@ TYPED_TEST(MergeStringTest, Merge1StringKeyColumns) strings_column_wrapper leftColWrap1({"ab", "bc", "cd", "de", "ef", "fg", "gh", "hi"}); cudf::size_type inputRows1 = static_cast(leftColWrap1).size(); - auto sequence0 = cudf::test::make_counting_transform_iterator(0, [](auto row) { + auto sequence0 = cudf::detail::make_counting_transform_iterator(0, [](auto row) { if (cudf::type_to_id() == cudf::type_id::BOOL8) return 0; else @@ -97,7 +98,7 @@ TYPED_TEST(MergeStringTest, Merge1StringKeyColumns) "hi", "hj"}); - auto seq_out2 = cudf::test::make_counting_transform_iterator(0, [outputRows](auto row) { + auto seq_out2 = cudf::detail::make_counting_transform_iterator(0, [outputRows](auto row) { if (cudf::type_to_id() == cudf::type_id::BOOL8) return 0; else @@ -128,7 +129,7 @@ TYPED_TEST(MergeStringTest, Merge2StringKeyColumns) EXPECT_EQ(inputRows, static_cast(leftColWrap3).size()); - auto sequence_l = cudf::test::make_counting_transform_iterator(0, [](auto row) { + auto sequence_l = cudf::detail::make_counting_transform_iterator(0, [](auto row) { if (cudf::type_to_id() == cudf::type_id::BOOL8) return 1; else @@ -144,7 +145,7 @@ TYPED_TEST(MergeStringTest, Merge2StringKeyColumns) EXPECT_EQ(inputRows, static_cast(rightColWrap1).size()); - auto sequence_r = cudf::test::make_counting_transform_iterator(0, [](auto row) { + auto sequence_r = cudf::detail::make_counting_transform_iterator(0, [](auto row) { if (cudf::type_to_id() == cudf::type_id::BOOL8) return 0; else @@ -187,7 +188,7 @@ TYPED_TEST(MergeStringTest, Merge2StringKeyColumns) "hi", "hj"}); - auto seq_out2 = cudf::test::make_counting_transform_iterator(0, [outputRows](auto row) { + auto seq_out2 = cudf::detail::make_counting_transform_iterator(0, [outputRows](auto row) { if (cudf::type_to_id() == cudf::type_id::BOOL8) { return (row % 2 == 0) ? 1 : 0; } else @@ -234,7 +235,7 @@ TYPED_TEST(MergeStringTest, Merge1StringKeyNullColumns) cudf::size_type inputRows = static_cast(leftColWrap1).size(); - auto sequence0 = cudf::test::make_counting_transform_iterator(0, [](auto row) { + auto sequence0 = cudf::detail::make_counting_transform_iterator(0, [](auto row) { if (cudf::type_to_id() == cudf::type_id::BOOL8) return 0; else @@ -283,7 +284,7 @@ TYPED_TEST(MergeStringTest, Merge1StringKeyNullColumns) "hi", "hj"}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0}); - auto seq_out2 = cudf::test::make_counting_transform_iterator(0, [outputRows](auto row) { + auto seq_out2 = cudf::detail::make_counting_transform_iterator(0, [outputRows](auto row) { if (cudf::type_to_id() == cudf::type_id::BOOL8) return 0; else @@ -313,7 +314,7 @@ TYPED_TEST(MergeStringTest, Merge2StringKeyNullColumns) EXPECT_EQ(inputRows, static_cast(leftColWrap3).size()); - auto sequence_l = cudf::test::make_counting_transform_iterator(0, [](auto row) { + auto sequence_l = cudf::detail::make_counting_transform_iterator(0, [](auto row) { if (cudf::type_to_id() == cudf::type_id::BOOL8) return 1; else @@ -330,7 +331,7 @@ TYPED_TEST(MergeStringTest, Merge2StringKeyNullColumns) EXPECT_EQ(inputRows, static_cast(rightColWrap1).size()); - auto sequence_r = cudf::test::make_counting_transform_iterator(0, [](auto row) { + auto sequence_r = cudf::detail::make_counting_transform_iterator(0, [](auto row) { if (cudf::type_to_id() == cudf::type_id::BOOL8) return 0; else @@ -375,7 +376,7 @@ TYPED_TEST(MergeStringTest, Merge2StringKeyNullColumns) "hj"}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0}); - auto seq_out2 = cudf::test::make_counting_transform_iterator(0, [outputRows](auto row) { + auto seq_out2 = cudf::detail::make_counting_transform_iterator(0, [outputRows](auto row) { if (cudf::type_to_id() == cudf::type_id::BOOL8) { return (row % 2 == 0) ? 1 : 0; } else diff --git a/cpp/tests/merge/merge_test.cpp b/cpp/tests/merge/merge_test.cpp index 93bcaba30c3..fa3bde8cb52 100644 --- a/cpp/tests/merge/merge_test.cpp +++ b/cpp/tests/merge/merge_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, NVIDIA CORPORATION. + * Copyright (c) 2020-2021, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,6 +15,7 @@ */ #include +#include #include #include #include @@ -203,7 +204,7 @@ TYPED_TEST(MergeTest_, SingleTableInput) { cudf::size_type inputRows = 40; - auto sequence = cudf::test::make_counting_transform_iterator(0, [](auto i) { return i; }); + auto sequence = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i; }); cudf::test::fixed_width_column_wrapper colWrap1(sequence, sequence + inputRows); @@ -250,7 +251,7 @@ TYPED_TEST(MergeTest_, MergeWithEmptyColumn) cudf::size_type inputRows = 40; - auto sequence = cudf::test::make_counting_transform_iterator(0, [](auto i) { return i; }); + auto sequence = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i; }); cudf::test::fixed_width_column_wrapper leftColWrap1(sequence, sequence + inputRows); columnFactoryT rightColWrap1{}; // wrapper of empty column <- this might require a (sequence, @@ -287,21 +288,21 @@ TYPED_TEST(MergeTest_, Merge1KeyColumns) { cudf::size_type inputRows = 40; - auto sequence0 = cudf::test::make_counting_transform_iterator(0, [](auto row) { + auto sequence0 = cudf::detail::make_counting_transform_iterator(0, [](auto row) { if (cudf::type_to_id() == cudf::type_id::BOOL8) return 0; else return row; }); - auto sequence1 = cudf::test::make_counting_transform_iterator(0, [](auto row) { + auto sequence1 = cudf::detail::make_counting_transform_iterator(0, [](auto row) { if (cudf::type_to_id() == cudf::type_id::BOOL8) return 1; else return 2 * row; }); - auto sequence2 = cudf::test::make_counting_transform_iterator(0, [](auto row) { + auto sequence2 = cudf::detail::make_counting_transform_iterator(0, [](auto row) { if (cudf::type_to_id() == cudf::type_id::BOOL8) return 0; else @@ -336,7 +337,7 @@ TYPED_TEST(MergeTest_, Merge1KeyColumns) cudf::column_view const& a_right_tbl_cview{static_cast(rightColWrap1)}; const cudf::size_type outputRows = a_left_tbl_cview.size() + a_right_tbl_cview.size(); - auto seq_out1 = cudf::test::make_counting_transform_iterator(0, [outputRows](auto row) { + auto seq_out1 = cudf::detail::make_counting_transform_iterator(0, [outputRows](auto row) { if (cudf::type_to_id() == cudf::type_id::BOOL8) { return (row >= outputRows / 2) ? 1 : 0; } else @@ -345,7 +346,7 @@ TYPED_TEST(MergeTest_, Merge1KeyColumns) cudf::test::fixed_width_column_wrapper expectedDataWrap1(seq_out1, seq_out1 + outputRows); - auto seq_out2 = cudf::test::make_counting_transform_iterator(0, [outputRows](auto row) { + auto seq_out2 = cudf::detail::make_counting_transform_iterator(0, [outputRows](auto row) { if (cudf::type_to_id() == cudf::type_id::BOOL8) return 0; else @@ -368,7 +369,7 @@ TYPED_TEST(MergeTest_, Merge2KeyColumns) { cudf::size_type inputRows = 40; - auto sequence1 = cudf::test::make_counting_transform_iterator(0, [inputRows](auto row) { + auto sequence1 = cudf::detail::make_counting_transform_iterator(0, [inputRows](auto row) { if (cudf::type_to_id() == cudf::type_id::BOOL8) { return (row >= inputRows / 2) ? 1 : 0; } else @@ -377,7 +378,7 @@ TYPED_TEST(MergeTest_, Merge2KeyColumns) cudf::test::fixed_width_column_wrapper leftColWrap1(sequence1, sequence1 + inputRows); - auto sequence2 = cudf::test::make_counting_transform_iterator(0, [inputRows](auto row) { + auto sequence2 = cudf::detail::make_counting_transform_iterator(0, [inputRows](auto row) { if (cudf::type_to_id() == cudf::type_id::BOOL8) { return ((row / (inputRows / 4)) % 2 == 0) ? 1 : 0; } else { @@ -390,7 +391,7 @@ TYPED_TEST(MergeTest_, Merge2KeyColumns) cudf::test::fixed_width_column_wrapper rightColWrap1(sequence1, sequence1 + inputRows); - auto sequence3 = cudf::test::make_counting_transform_iterator(0, [inputRows](auto row) { + auto sequence3 = cudf::detail::make_counting_transform_iterator(0, [inputRows](auto row) { if (cudf::type_to_id() == cudf::type_id::BOOL8) { return ((row / (inputRows / 4)) % 2 == 0) ? 1 : 0; } else @@ -414,7 +415,7 @@ TYPED_TEST(MergeTest_, Merge2KeyColumns) cudf::column_view const& a_right_tbl_cview{static_cast(rightColWrap1)}; const cudf::size_type outputRows = a_left_tbl_cview.size() + a_right_tbl_cview.size(); - auto seq_out1 = cudf::test::make_counting_transform_iterator(0, [outputRows](auto row) { + auto seq_out1 = cudf::detail::make_counting_transform_iterator(0, [outputRows](auto row) { if (cudf::type_to_id() == cudf::type_id::BOOL8) { return (row >= outputRows / 2) ? 1 : 0; } else @@ -423,7 +424,7 @@ TYPED_TEST(MergeTest_, Merge2KeyColumns) cudf::test::fixed_width_column_wrapper expectedDataWrap1(seq_out1, seq_out1 + outputRows); - auto seq_out2 = cudf::test::make_counting_transform_iterator(0, [outputRows](auto row) { + auto seq_out2 = cudf::detail::make_counting_transform_iterator(0, [outputRows](auto row) { if (cudf::type_to_id() == cudf::type_id::BOOL8) { return ((row / (outputRows / 4)) % 2 == 0) ? 1 : 0; } else { @@ -448,20 +449,20 @@ TYPED_TEST(MergeTest_, Merge1KeyNullColumns) cudf::size_type inputRows = 40; // data: 0 2 4 6 | valid: 1 1 1 0 - auto sequence1 = cudf::test::make_counting_transform_iterator(0, [inputRows](auto row) { + auto sequence1 = cudf::detail::make_counting_transform_iterator(0, [inputRows](auto row) { if (cudf::type_to_id() == cudf::type_id::BOOL8) { return 0; // <- no shortcut to this can avoid compiler errors } else { return row * 2; } }); - auto valid_sequence1 = cudf::test::make_counting_transform_iterator( + auto valid_sequence1 = cudf::detail::make_counting_transform_iterator( 0, [inputRows](auto row) { return (row < inputRows - 1); }); cudf::test::fixed_width_column_wrapper leftColWrap1(sequence1, sequence1 + inputRows, valid_sequence1); // data: 1 3 5 7 | valid: 1 1 1 0 - auto sequence2 = cudf::test::make_counting_transform_iterator(0, [inputRows](auto row) { + auto sequence2 = cudf::detail::make_counting_transform_iterator(0, [inputRows](auto row) { if (cudf::type_to_id() == cudf::type_id::BOOL8) { return 1; } else @@ -505,13 +506,13 @@ TYPED_TEST(MergeTest_, Merge1KeyNullColumns) // data: 0 1 2 3 4 5 6 7 | valid: 1 1 1 1 1 1 0 0 auto seq_out1 = - cudf::test::make_counting_transform_iterator(0, [outputRows, column1TotalNulls](auto row) { + cudf::detail::make_counting_transform_iterator(0, [outputRows, column1TotalNulls](auto row) { if (cudf::type_to_id() == cudf::type_id::BOOL8) { return (row >= (outputRows - column1TotalNulls) / 2) ? 1 : 0; } else return (row); }); - auto valid_seq_out = cudf::test::make_counting_transform_iterator( + auto valid_seq_out = cudf::detail::make_counting_transform_iterator( 0, [outputRows, column1TotalNulls](auto row) { return (row < (outputRows - column1TotalNulls)); }); cudf::test::fixed_width_column_wrapper @@ -528,21 +529,21 @@ TYPED_TEST(MergeTest_, Merge2KeyNullColumns) cudf::size_type inputRows = 40; // data: 0 1 2 3 | valid: 1 1 1 1 - auto sequence1 = cudf::test::make_counting_transform_iterator(0, [inputRows](auto row) { + auto sequence1 = cudf::detail::make_counting_transform_iterator(0, [inputRows](auto row) { if (cudf::type_to_id() == cudf::type_id::BOOL8) { return (row >= inputRows / 2) ? 1 : 0; } else return (row); }); auto valid_sequence1 = - cudf::test::make_counting_transform_iterator(0, [](auto row) { return true; }); + cudf::detail::make_counting_transform_iterator(0, [](auto row) { return true; }); cudf::test::fixed_width_column_wrapper leftColWrap1(sequence1, sequence1 + inputRows, valid_sequence1); // if left out: valid_sequence defaults to `false`; // data: 0 2 4 6 | valid: 1 1 1 1 - auto sequence2 = cudf::test::make_counting_transform_iterator(0, [inputRows](auto row) { + auto sequence2 = cudf::detail::make_counting_transform_iterator(0, [inputRows](auto row) { if (cudf::type_to_id() == cudf::type_id::BOOL8) { return ((row / (inputRows / 4)) % 2 == 0) ? 1 : 0; } else { @@ -559,14 +560,14 @@ TYPED_TEST(MergeTest_, Merge2KeyNullColumns) valid_sequence1); // if left out: valid_sequence defaults to `false`; // data: 0 1 2 3 | valid: 0 0 0 0 - auto sequence3 = cudf::test::make_counting_transform_iterator(0, [inputRows](auto row) { + auto sequence3 = cudf::detail::make_counting_transform_iterator(0, [inputRows](auto row) { if (cudf::type_to_id() == cudf::type_id::BOOL8) { return ((row / (inputRows / 4)) % 2 == 0) ? 1 : 0; } else return (row); }); auto valid_sequence0 = - cudf::test::make_counting_transform_iterator(0, [](auto row) { return false; }); + cudf::detail::make_counting_transform_iterator(0, [](auto row) { return false; }); cudf::test::fixed_width_column_wrapper rightColWrap2(sequence3, sequence3 + inputRows, valid_sequence0); @@ -586,7 +587,7 @@ TYPED_TEST(MergeTest_, Merge2KeyNullColumns) const cudf::size_type outputRows = a_left_tbl_cview.size() + a_right_tbl_cview.size(); // data: 0 0 1 1 2 2 3 3 | valid: 1 1 1 1 1 1 1 1 - auto seq_out1 = cudf::test::make_counting_transform_iterator(0, [outputRows](auto row) { + auto seq_out1 = cudf::detail::make_counting_transform_iterator(0, [outputRows](auto row) { if (cudf::type_to_id() == cudf::type_id::BOOL8) { return (row >= outputRows / 2) ? 1 : 0; } else @@ -596,20 +597,21 @@ TYPED_TEST(MergeTest_, Merge2KeyNullColumns) expectedDataWrap1(seq_out1, seq_out1 + outputRows, valid_sequence1); // data: 0 0 2 1 4 2 6 3 | valid: 0 1 0 1 0 1 0 1 - auto seq_out2 = cudf::test::make_counting_transform_iterator(0, [outputRows](auto row) { + auto seq_out2 = cudf::detail::make_counting_transform_iterator(0, [outputRows](auto row) { if (cudf::type_to_id() == cudf::type_id::BOOL8) { return ((row / (outputRows / 8)) % 2 == 0) ? 1 : 0; } else { return (row % 2 != 0 ? 2 * (row / 2) : (row / 2)); } }); - auto valid_sequence_out = cudf::test::make_counting_transform_iterator(0, [outputRows](auto row) { - if (cudf::type_to_id() == cudf::type_id::BOOL8) { - return ((row / (outputRows / 4)) % 2 == 1) ? 1 : 0; - } else { - return (row % 2 != 0) ? 1 : 0; - } - }); + auto valid_sequence_out = + cudf::detail::make_counting_transform_iterator(0, [outputRows](auto row) { + if (cudf::type_to_id() == cudf::type_id::BOOL8) { + return ((row / (outputRows / 4)) % 2 == 1) ? 1 : 0; + } else { + return (row % 2 != 0) ? 1 : 0; + } + }); cudf::test::fixed_width_column_wrapper expectedDataWrap2(seq_out2, seq_out2 + outputRows, valid_sequence_out); @@ -627,14 +629,14 @@ TYPED_TEST(MergeTest_, NMerge1KeyColumns) { cudf::size_type inputRows = 64; - auto sequence0 = cudf::test::make_counting_transform_iterator(0, [](auto row) { + auto sequence0 = cudf::detail::make_counting_transform_iterator(0, [](auto row) { if (cudf::type_to_id() == cudf::type_id::BOOL8) return 0; else return row; }); - auto sequence1 = cudf::test::make_counting_transform_iterator(0, [inputRows](auto row) { + auto sequence1 = cudf::detail::make_counting_transform_iterator(0, [inputRows](auto row) { if (cudf::type_to_id() == cudf::type_id::BOOL8) return 1; else @@ -662,7 +664,7 @@ TYPED_TEST(MergeTest_, NMerge1KeyColumns) const cudf::size_type outputRows = inputRows * num_tables; - auto seq_out1 = cudf::test::make_counting_transform_iterator(0, [](auto row) { + auto seq_out1 = cudf::detail::make_counting_transform_iterator(0, [](auto row) { if (cudf::type_to_id() == cudf::type_id::BOOL8) { return (0); } else @@ -671,7 +673,7 @@ TYPED_TEST(MergeTest_, NMerge1KeyColumns) cudf::test::fixed_width_column_wrapper expectedDataWrap1(seq_out1, seq_out1 + outputRows); - auto seq_out2 = cudf::test::make_counting_transform_iterator(0, [inputRows](auto row) { + auto seq_out2 = cudf::detail::make_counting_transform_iterator(0, [inputRows](auto row) { if (cudf::type_to_id() == cudf::type_id::BOOL8) return 1; else @@ -697,10 +699,10 @@ TEST_F(MergeTest, KeysWithNulls) { cudf::size_type nrows = 13200; // Ensures that thrust::merge uses more than one tile/block auto data_iter = thrust::make_counting_iterator(0); - auto valids1 = cudf::test::make_counting_transform_iterator( + auto valids1 = cudf::detail::make_counting_transform_iterator( 0, [](auto row) { return (row % 10 == 0) ? false : true; }); cudf::test::fixed_width_column_wrapper data1(data_iter, data_iter + nrows, valids1); - auto valids2 = cudf::test::make_counting_transform_iterator( + auto valids2 = cudf::detail::make_counting_transform_iterator( 0, [](auto row) { return (row % 15 == 0) ? false : true; }); cudf::test::fixed_width_column_wrapper data2(data_iter, data_iter + nrows, valids2); auto all_data = cudf::concatenate({data1, data2}); diff --git a/cpp/tests/partitioning/round_robin_test.cpp b/cpp/tests/partitioning/round_robin_test.cpp index f9aaba6fa40..59bdc80dc07 100644 --- a/cpp/tests/partitioning/round_robin_test.cpp +++ b/cpp/tests/partitioning/round_robin_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, NVIDIA CORPORATION. + * Copyright (c) 2020-2021, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,6 +15,7 @@ */ #include +#include #include #include #include @@ -54,7 +55,7 @@ TYPED_TEST(RoundRobinTest, RoundRobinPartitions13_3) cudf::size_type inputRows = static_cast(rrColWrap1).size(); - auto sequence_l = cudf::test::make_counting_transform_iterator(0, [](auto row) { + auto sequence_l = cudf::detail::make_counting_transform_iterator(0, [](auto row) { if (cudf::type_to_id() == cudf::type_id::BOOL8) { return (row % 2 == 0) ? 1 : 0; } else @@ -190,7 +191,7 @@ TYPED_TEST(RoundRobinTest, RoundRobinPartitions11_3) cudf::size_type inputRows = static_cast(rrColWrap1).size(); - auto sequence_l = cudf::test::make_counting_transform_iterator(0, [](auto row) { + auto sequence_l = cudf::detail::make_counting_transform_iterator(0, [](auto row) { if (cudf::type_to_id() == cudf::type_id::BOOL8) { return (row % 2 == 0) ? 1 : 0; } else @@ -323,7 +324,7 @@ TYPED_TEST(RoundRobinTest, RoundRobinDegeneratePartitions11_15) cudf::size_type inputRows = static_cast(rrColWrap1).size(); - auto sequence_l = cudf::test::make_counting_transform_iterator(0, [](auto row) { + auto sequence_l = cudf::detail::make_counting_transform_iterator(0, [](auto row) { if (cudf::type_to_id() == cudf::type_id::BOOL8) { return (row % 2 == 0) ? 1 : 0; } else @@ -459,7 +460,7 @@ TYPED_TEST(RoundRobinTest, RoundRobinDegeneratePartitions11_11) cudf::size_type inputRows = static_cast(rrColWrap1).size(); - auto sequence_l = cudf::test::make_counting_transform_iterator(0, [](auto row) { + auto sequence_l = cudf::detail::make_counting_transform_iterator(0, [](auto row) { if (cudf::type_to_id() == cudf::type_id::BOOL8) { return (row % 2 == 0) ? 1 : 0; } else @@ -527,7 +528,7 @@ TYPED_TEST(RoundRobinTest, RoundRobinNPartitionsDivideNRows) cudf::size_type inputRows = static_cast(rrColWrap1).size(); - auto sequence_l = cudf::test::make_counting_transform_iterator(0, [](auto row) { + auto sequence_l = cudf::detail::make_counting_transform_iterator(0, [](auto row) { if (cudf::type_to_id() == cudf::type_id::BOOL8) { return (row % 2 == 0) ? 1 : 0; } else @@ -643,7 +644,7 @@ TYPED_TEST(RoundRobinTest, RoundRobinSinglePartition) cudf::size_type inputRows = static_cast(rrColWrap1).size(); - auto sequence_l = cudf::test::make_counting_transform_iterator(0, [](auto row) { + auto sequence_l = cudf::detail::make_counting_transform_iterator(0, [](auto row) { if (cudf::type_to_id() == cudf::type_id::BOOL8) { return (row % 2 == 0) ? 1 : 0; } else @@ -698,7 +699,7 @@ TYPED_TEST(RoundRobinTest, RoundRobinIncorrectNumPartitions) cudf::size_type inputRows = static_cast(rrColWrap1).size(); - auto sequence_l = cudf::test::make_counting_transform_iterator(0, [](auto row) { + auto sequence_l = cudf::detail::make_counting_transform_iterator(0, [](auto row) { if (cudf::type_to_id() == cudf::type_id::BOOL8) { return (row % 2 == 0) ? 1 : 0; } else @@ -724,7 +725,7 @@ TYPED_TEST(RoundRobinTest, RoundRobinIncorrectStartPartition) cudf::size_type inputRows = static_cast(rrColWrap1).size(); - auto sequence_l = cudf::test::make_counting_transform_iterator(0, [](auto row) { + auto sequence_l = cudf::detail::make_counting_transform_iterator(0, [](auto row) { if (cudf::type_to_id() == cudf::type_id::BOOL8) { return (row % 2 == 0) ? 1 : 0; } else diff --git a/cpp/tests/reductions/reduction_tests.cpp b/cpp/tests/reductions/reduction_tests.cpp index 4be702ad441..fce9e77dc55 100644 --- a/cpp/tests/reductions/reduction_tests.cpp +++ b/cpp/tests/reductions/reduction_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2020, NVIDIA CORPORATION. + * Copyright (c) 2019-2021, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,6 +20,7 @@ #include #include +#include #include #include #include @@ -1209,7 +1210,7 @@ TYPED_TEST(FixedPointTestBothReps, FixedPointReductionMinLarge) for (auto const i : {0, -1, -2, -3}) { auto const scale = scale_type{i}; - auto f = cudf::test::make_counting_transform_iterator(0, [](auto e) { return e % 43; }); + auto f = cudf::detail::make_counting_transform_iterator(0, [](auto e) { return e % 43; }); auto const column = fp_wrapper{f, f + 5000, scale}; auto const out_type = static_cast(column).type(); auto const expected = decimalXX{0, scale}; @@ -1250,7 +1251,7 @@ TYPED_TEST(FixedPointTestBothReps, FixedPointReductionMaxLarge) for (auto const i : {0, -1, -2, -3}) { auto const scale = scale_type{i}; - auto f = cudf::test::make_counting_transform_iterator(0, [](auto e) { return e % 43; }); + auto f = cudf::detail::make_counting_transform_iterator(0, [](auto e) { return e % 43; }); auto const column = fp_wrapper{f, f + 5000, scale}; auto const out_type = static_cast(column).type(); auto const expected = decimalXX{scaled_integer{42, scale}}; diff --git a/cpp/tests/replace/clamp_test.cpp b/cpp/tests/replace/clamp_test.cpp index be587af7f7e..47599035709 100644 --- a/cpp/tests/replace/clamp_test.cpp +++ b/cpp/tests/replace/clamp_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2020, NVIDIA CORPORATION. + * Copyright (c) 2019-2021, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,6 +14,7 @@ * limitations under the License. */ +#include #include #include #include @@ -622,7 +623,7 @@ TYPED_TEST(FixedPointTest, LargeTest) auto begin = thrust::make_counting_iterator(-1000); auto clamp = [](int e) { return e < 1000 ? 1000 : e > 2000 ? 2000 : e; }; - auto begin2 = cudf::test::make_counting_transform_iterator(-1000, clamp); + auto begin2 = cudf::detail::make_counting_transform_iterator(-1000, clamp); auto const input = fp_wrapper{begin, begin + 5000, scale}; auto const expected = fp_wrapper{begin2, begin2 + 5000, scale}; auto const result = cudf::clamp(input, *lo, *hi); diff --git a/cpp/tests/replace/replace_tests.cpp b/cpp/tests/replace/replace_tests.cpp index 51b0b3b9111..32ddf11f16d 100644 --- a/cpp/tests/replace/replace_tests.cpp +++ b/cpp/tests/replace/replace_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2019-20, NVIDIA CORPORATION. + * Copyright 2019-2021, NVIDIA CORPORATION. * * Copyright 2018 BlazingDB, Inc. * Copyright 2018 Cristhian Alberto Gonzales Castillo @@ -16,12 +16,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + #include #include #include #include #include +#include #include #include #include @@ -550,7 +552,7 @@ TYPED_TEST(FixedPointTestBothReps, FixedPointReplace) auto const sz = std::size_t{1000}; auto mod2 = [&](auto e) { return e % 2 ? ONE : TWO; }; - auto transform_begin = cudf::test::make_counting_transform_iterator(0, mod2); + auto transform_begin = cudf::detail::make_counting_transform_iterator(0, mod2); auto const vec1 = std::vector(transform_begin, transform_begin + sz); auto const vec2 = std::vector(sz, TWO); diff --git a/cpp/tests/reshape/byte_cast_tests.cpp b/cpp/tests/reshape/byte_cast_tests.cpp index 48ee77d565f..e5f3b8a1f7f 100644 --- a/cpp/tests/reshape/byte_cast_tests.cpp +++ b/cpp/tests/reshape/byte_cast_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, NVIDIA CORPORATION. + * Copyright (c) 2020-2021, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,11 +14,13 @@ * limitations under the License. */ -#include #include #include #include +#include +#include + using namespace cudf::test; class ByteCastTest : public cudf::test::BaseFixture { @@ -48,8 +50,9 @@ TEST_F(ByteCastTest, int16ValuesWithSplit) TEST_F(ByteCastTest, int16ValuesWithNulls) { - using limits = std::numeric_limits; - auto odd_validity = make_counting_transform_iterator(0, [](auto i) { return i % 2; }); + using limits = std::numeric_limits; + auto odd_validity = + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i % 2; }); fixed_width_column_wrapper const int16_col( {short(0), short(100), short(-100), limits::min(), limits::max()}, {0, 1, 0, 1, 0}); @@ -96,8 +99,9 @@ TEST_F(ByteCastTest, int32Values) TEST_F(ByteCastTest, int32ValuesWithNulls) { - using limits = std::numeric_limits; - auto even_validity = make_counting_transform_iterator(0, [](auto i) { return (i + 1) % 2; }); + using limits = std::numeric_limits; + auto even_validity = + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return (i + 1) % 2; }); fixed_width_column_wrapper const int32_col({0, 100, -100, limits::min(), limits::max()}, {1, 0, 1, 0, 1}); @@ -153,8 +157,9 @@ TEST_F(ByteCastTest, int64ValuesWithSplit) TEST_F(ByteCastTest, int64ValuesWithNulls) { - using limits = std::numeric_limits; - auto odd_validity = make_counting_transform_iterator(0, [](auto i) { return i % 2; }); + using limits = std::numeric_limits; + auto odd_validity = + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i % 2; }); fixed_width_column_wrapper const int64_col( {long(0), long(100), long(-100), limits::min(), limits::max()}, {0, 1, 0, 1, 0}); @@ -217,8 +222,9 @@ TEST_F(ByteCastTest, fp32ValuesWithSplit) TEST_F(ByteCastTest, fp32ValuesWithNulls) { - using limits = std::numeric_limits; - auto even_validity = make_counting_transform_iterator(0, [](auto i) { return (i + 1) % 2; }); + using limits = std::numeric_limits; + auto even_validity = + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return (i + 1) % 2; }); fixed_width_column_wrapper const fp32_col( {float(0.0), float(100.0), float(-100.0), limits::min(), limits::max()}, {1, 0, 1, 0, 1}); @@ -291,8 +297,9 @@ TEST_F(ByteCastTest, fp64ValuesWithSplit) TEST_F(ByteCastTest, fp64ValuesWithNulls) { - using limits = std::numeric_limits; - auto odd_validity = make_counting_transform_iterator(0, [](auto i) { return i % 2; }); + using limits = std::numeric_limits; + auto odd_validity = + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i % 2; }); fixed_width_column_wrapper const fp64_col( {double(0.0), double(100.0), double(-100.0), limits::min(), limits::max()}, {0, 1, 0, 1, 0}); diff --git a/cpp/tests/reshape/explode_tests.cpp b/cpp/tests/reshape/explode_tests.cpp index 6f98332243e..b2db3251889 100644 --- a/cpp/tests/reshape/explode_tests.cpp +++ b/cpp/tests/reshape/explode_tests.cpp @@ -14,6 +14,7 @@ * limitations under the License. */ +#include #include #include @@ -97,7 +98,7 @@ TEST_F(ExplodeTest, SingleNull) */ auto first_invalid = - cudf::test::make_counting_transform_iterator(0, [](auto i) { return i == 0 ? false : true; }); + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i == 0 ? false : true; }); lists_column_wrapper a({lists_column_wrapper{1, 2, 7}, lists_column_wrapper{5, 6}, @@ -126,9 +127,10 @@ TEST_F(ExplodeTest, Nulls) [0, 3] 300 */ - auto valids = cudf::test::make_counting_transform_iterator( + auto valids = cudf::detail::make_counting_transform_iterator( 0, [](auto i) { return i % 2 == 0 ? true : false; }); - auto always_valid = cudf::test::make_counting_transform_iterator(0, [](auto i) { return true; }); + auto always_valid = + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return true; }); lists_column_wrapper a({lists_column_wrapper{1, 2, 7}, lists_column_wrapper{5, 6}, @@ -157,7 +159,7 @@ TEST_F(ExplodeTest, NullsInList) [0, 3, 8] 400 */ - auto valids = cudf::test::make_counting_transform_iterator( + auto valids = cudf::detail::make_counting_transform_iterator( 0, [](auto i) { return i % 2 == 0 ? true : false; }); lists_column_wrapper a{lists_column_wrapper({1, 2, 7}, valids), @@ -223,9 +225,10 @@ TEST_F(ExplodeTest, NestedNulls) [[0, 3],[5],[2, 1]] 300 */ - auto valids = cudf::test::make_counting_transform_iterator( + auto valids = cudf::detail::make_counting_transform_iterator( 0, [](auto i) { return i % 2 == 0 ? true : false; }); - auto always_valid = cudf::test::make_counting_transform_iterator(0, [](auto i) { return true; }); + auto always_valid = + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return true; }); lists_column_wrapper a( {lists_column_wrapper{lists_column_wrapper{1, 2}, @@ -261,7 +264,7 @@ TEST_F(ExplodeTest, NullsInNested) [[0, 3],[5],[2, 1]] 300 */ - auto valids = cudf::test::make_counting_transform_iterator( + auto valids = cudf::detail::make_counting_transform_iterator( 0, [](auto i) { return i % 2 == 0 ? true : false; }); lists_column_wrapper a( @@ -298,7 +301,7 @@ TEST_F(ExplodeTest, NullsInNestedDoubleExplode) [[0, 3],[5],[2, 1]] 300 */ - auto valids = cudf::test::make_counting_transform_iterator( + auto valids = cudf::detail::make_counting_transform_iterator( 0, [](auto i) { return i % 2 == 0 ? true : false; }); lists_column_wrapper a{ @@ -334,7 +337,7 @@ TEST_F(ExplodeTest, NestedStructs) [[0, 3],[5],[2, 1]] {300, "300"} */ - auto valids = cudf::test::make_counting_transform_iterator( + auto valids = cudf::detail::make_counting_transform_iterator( 0, [](auto i) { return i % 2 == 0 ? true : false; }); lists_column_wrapper a( @@ -418,7 +421,7 @@ TEST_F(ExplodeTest, SlicedList) slicing the top 2 rows and the bottom row off */ - auto valids = cudf::test::make_counting_transform_iterator( + auto valids = cudf::detail::make_counting_transform_iterator( 0, [](auto i) { return i % 2 == 0 ? true : false; }); lists_column_wrapper a( diff --git a/cpp/tests/rolling/rolling_test.cpp b/cpp/tests/rolling/rolling_test.cpp index 26e4d485b30..e7eaeb7f415 100644 --- a/cpp/tests/rolling/rolling_test.cpp +++ b/cpp/tests/rolling/rolling_test.cpp @@ -22,6 +22,7 @@ #include #include +#include #include #include #include @@ -878,13 +879,13 @@ TEST_F(RollingTestUdf, StaticWindow) std::unique_ptr output; - auto start = cudf::test::make_counting_transform_iterator(0, [size] __device__(size_type row) { + auto start = cudf::detail::make_counting_transform_iterator(0, [size] __device__(size_type row) { return std::accumulate(thrust::make_counting_iterator(std::max(0, row - 2 + 1)), thrust::make_counting_iterator(std::min(size, row + 2 + 1)), 0); }); - auto valid = cudf::test::make_counting_transform_iterator(0, [size] __device__(size_type row) { + auto valid = cudf::detail::make_counting_transform_iterator(0, [size] __device__(size_type row) { return (row != 0 && row != size - 2 && row != size - 1); }); @@ -915,23 +916,23 @@ TEST_F(RollingTestUdf, DynamicWindow) thrust::make_counting_iterator(size), thrust::make_constant_iterator(true)); - auto prec = cudf::test::make_counting_transform_iterator( + auto prec = cudf::detail::make_counting_transform_iterator( 0, [size] __device__(size_type row) { return row % 2 + 2; }); - auto follow = cudf::test::make_counting_transform_iterator( + auto follow = cudf::detail::make_counting_transform_iterator( 0, [size] __device__(size_type row) { return row % 2; }); fixed_width_column_wrapper preceding(prec, prec + size); fixed_width_column_wrapper following(follow, follow + size); std::unique_ptr output; - auto start = cudf::test::make_counting_transform_iterator(0, [size] __device__(size_type row) { + auto start = cudf::detail::make_counting_transform_iterator(0, [size] __device__(size_type row) { return std::accumulate(thrust::make_counting_iterator(std::max(0, row - (row % 2 + 2) + 1)), thrust::make_counting_iterator(std::min(size, row + (row % 2) + 1)), 0); }); - auto valid = cudf::test::make_counting_transform_iterator( + auto valid = cudf::detail::make_counting_transform_iterator( 0, [size] __device__(size_type row) { return row != 0; }); fixed_width_column_wrapper expected{start, start + size, valid}; diff --git a/cpp/tests/round/round_tests.cpp b/cpp/tests/round/round_tests.cpp index 06fd5faddf0..825703274e2 100644 --- a/cpp/tests/round/round_tests.cpp +++ b/cpp/tests/round/round_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, NVIDIA CORPORATION. + * Copyright (c) 2020-2021, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,11 +14,13 @@ * limitations under the License. */ -#include #include #include #include +#include +#include + #include struct RoundTests : public cudf::test::BaseFixture { @@ -373,11 +375,11 @@ TYPED_TEST(RoundTestsFloatingPointTypes, LargeFloatingPointHalfUp) using fw_wrapper = cudf::test::fixed_width_column_wrapper; auto transform = [](int i) -> float { return i % 2 == 0 ? i + 0.44 : i + 0.56; }; - auto begin = cudf::test::make_counting_transform_iterator(0, transform); + auto begin = cudf::detail::make_counting_transform_iterator(0, transform); auto const input = fw_wrapper(begin, begin + 2000); auto transform2 = [](int i) { return i % 2 == 0 ? i + 0.4 : i + 0.6; }; - auto begin2 = cudf::test::make_counting_transform_iterator(0, transform2); + auto begin2 = cudf::detail::make_counting_transform_iterator(0, transform2); auto const expected = fw_wrapper(begin2, begin2 + 2000); auto const result = cudf::round(input, 1, cudf::rounding_method::HALF_UP); @@ -390,11 +392,11 @@ TYPED_TEST(RoundTestsIntegerTypes, LargeIntegerHalfEven) using fw_wrapper = cudf::test::fixed_width_column_wrapper; auto transform = [](int i) -> float { return 10 * i + 5; }; - auto begin = cudf::test::make_counting_transform_iterator(1, transform); + auto begin = cudf::detail::make_counting_transform_iterator(1, transform); auto const input = fw_wrapper(begin, begin + 2000); auto transform2 = [](int i) { return i % 2 == 0 ? 10 * i : 10 + 10 * i; }; - auto begin2 = cudf::test::make_counting_transform_iterator(1, transform2); + auto begin2 = cudf::detail::make_counting_transform_iterator(1, transform2); auto const expected = fw_wrapper(begin2, begin2 + 2000); auto const result = cudf::round(input, -1, cudf::rounding_method::HALF_EVEN); diff --git a/cpp/tests/stream_compaction/apply_boolean_mask_tests.cpp b/cpp/tests/stream_compaction/apply_boolean_mask_tests.cpp index ad693f96c4d..813cceb0861 100644 --- a/cpp/tests/stream_compaction/apply_boolean_mask_tests.cpp +++ b/cpp/tests/stream_compaction/apply_boolean_mask_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, NVIDIA CORPORATION. + * Copyright (c) 2019-2021, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,6 +15,7 @@ */ #include +#include #include #include #include @@ -251,15 +252,16 @@ TEST_F(ApplyBooleanMask, CorrectNullCount) { cudf::size_type inputRows = 471234; - auto seq1 = cudf::test::make_counting_transform_iterator(0, [](auto i) { return i; }); - auto valid_seq1 = cudf::test::make_counting_transform_iterator(0, [](auto row) { return true; }); + auto seq1 = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i; }); + auto valid_seq1 = + cudf::detail::make_counting_transform_iterator(0, [](auto row) { return true; }); cudf::test::fixed_width_column_wrapper col1( seq1, seq1 + inputRows, valid_seq1); cudf::table_view input{{col1}}; auto seq3 = - cudf::test::make_counting_transform_iterator(0, [](auto i) { return (i % 277) == 0; }); + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return (i % 277) == 0; }); cudf::test::fixed_width_column_wrapper boolean_mask(seq3, seq3 + inputRows); auto got = cudf::apply_boolean_mask(input, boolean_mask); @@ -344,7 +346,7 @@ TEST_F(ApplyBooleanMask, StructOfListsFiltering) auto lists_column = lists_column_wrapper{ {{0, 0}, {1, 1}, {2, 2}, {3, 3}, {4, 4}}, - make_counting_transform_iterator(0, [](auto i) { return i != 2; })}; + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i != 2; })}; auto structs_column = structs_column_wrapper{{lists_column}}; @@ -356,7 +358,8 @@ TEST_F(ApplyBooleanMask, StructOfListsFiltering) // Compare against expected values; auto expected_lists_column = lists_column_wrapper{ - {{0, 0}, {2, 2}, {4, 4}}, make_counting_transform_iterator(0, [](auto i) { return i != 1; })}; + {{0, 0}, {2, 2}, {4, 4}}, + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i != 1; })}; auto expected_structs_column = structs_column_wrapper{{expected_lists_column}}; diff --git a/cpp/tests/strings/attrs_tests.cpp b/cpp/tests/strings/attrs_tests.cpp index 117a215374a..9ff2c55ed81 100644 --- a/cpp/tests/strings/attrs_tests.cpp +++ b/cpp/tests/strings/attrs_tests.cpp @@ -22,6 +22,8 @@ #include #include +#include + #include struct StringsAttributesTest : public cudf::test::BaseFixture { diff --git a/cpp/tests/strings/booleans_tests.cpp b/cpp/tests/strings/booleans_tests.cpp index b51108b11c1..17b163a8690 100644 --- a/cpp/tests/strings/booleans_tests.cpp +++ b/cpp/tests/strings/booleans_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, NVIDIA CORPORATION. + * Copyright (c) 2019-2021, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,6 +21,8 @@ #include #include +#include + #include struct StringsConvertTest : public cudf::test::BaseFixture { diff --git a/cpp/tests/strings/case_tests.cpp b/cpp/tests/strings/case_tests.cpp index efad547ca90..f2e493c253a 100644 --- a/cpp/tests/strings/case_tests.cpp +++ b/cpp/tests/strings/case_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, NVIDIA CORPORATION. + * Copyright (c) 2019-2021, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,6 +24,8 @@ #include #include +#include + #include struct StringsCaseTest : public cudf::test::BaseFixture { diff --git a/cpp/tests/strings/chars_types_tests.cpp b/cpp/tests/strings/chars_types_tests.cpp index 7a7d1e3e106..803a9b01b07 100644 --- a/cpp/tests/strings/chars_types_tests.cpp +++ b/cpp/tests/strings/chars_types_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2020, NVIDIA CORPORATION. + * Copyright (c) 2019-2021, 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,8 @@ #include #include +#include + #include struct StringsCharsTest : public cudf::test::BaseFixture { diff --git a/cpp/tests/strings/combine_tests.cpp b/cpp/tests/strings/combine_tests.cpp index 01f29aa8581..cfeca2bba29 100644 --- a/cpp/tests/strings/combine_tests.cpp +++ b/cpp/tests/strings/combine_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, NVIDIA CORPORATION. + * Copyright (c) 2019-2021, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,6 +26,8 @@ #include #include +#include + #include struct StringsCombineTest : public cudf::test::BaseFixture { diff --git a/cpp/tests/structs/structs_column_tests.cu b/cpp/tests/structs/structs_column_tests.cu index 8ff66ecd5f7..2a0856133ba 100644 --- a/cpp/tests/structs/structs_column_tests.cu +++ b/cpp/tests/structs/structs_column_tests.cu @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, NVIDIA CORPORATION. + * Copyright (c) 2020-2021, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,32 +14,36 @@ * limitations under the License. */ -#include -#include -#include - -#include -#include -#include -#include -#include #include +#include +#include #include +#include #include #include +#include #include #include #include + #include #include #include #include #include + +#include +#include +#include +#include + +#include + +#include #include #include #include #include -#include using vector_of_columns = std::vector>; using cudf::size_type; @@ -192,7 +196,7 @@ TYPED_TEST(TypedStructColumnWrapperTest, TestStructsContainingLists) // For `Name` member, indices 4 and 5 are null. auto expected_names_col = cudf::test::strings_column_wrapper{ - names.begin(), names.end(), cudf::test::make_counting_transform_iterator(0, [](auto i) { + names.begin(), names.end(), cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i < 4; })}.release(); @@ -214,7 +218,7 @@ TYPED_TEST(TypedStructColumnWrapperTest, TestStructsContainingLists) {7, 8}, // Null. {9} // Null. }, - cudf::test::make_counting_transform_iterator(0, [](auto i) { + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i == 0; })}.release(); @@ -256,7 +260,7 @@ TYPED_TEST(TypedStructColumnWrapperTest, StructOfStructs) cudf::test::strings_column_wrapper( names.begin(), names.end(), - cudf::test::make_counting_transform_iterator(0, [](auto i) { return i != 0 && i != 4; })) + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i != 0 && i != 4; })) .release(); cudf::test::expect_columns_equivalent(*expected_names_col, struct_2->child(1).child(0)); @@ -331,7 +335,7 @@ TYPED_TEST(TypedStructColumnWrapperTest, TestNullMaskPropagationForNonNullStruct cudf::test::strings_column_wrapper( names.begin(), names.end(), - cudf::test::make_counting_transform_iterator(0, [](auto i) { return i != 0; })) + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i != 0; })) .release(); cudf::test::expect_columns_equivalent(*expected_names_col, struct_2->child(1).child(0)); @@ -436,7 +440,7 @@ TYPED_TEST(TypedStructColumnWrapperTest, ListOfStructOfList) auto list_col = lists_column_wrapper{ {{0}, {1}, {}, {3}, {4}, {5, 5}, {6}, {}, {8}, {9}}, - cudf::test::make_counting_transform_iterator(0, [](auto i) { return i % 2; })}; + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i % 2; })}; // TODO: Struct cannot be compared with expect_columns_equal(), // if the struct has null values. After lists support "equivalence" @@ -444,7 +448,7 @@ TYPED_TEST(TypedStructColumnWrapperTest, ListOfStructOfList) auto struct_of_lists_col = structs_column_wrapper{{list_col}}.release(); auto list_of_struct_of_list_validity = - make_counting_transform_iterator(0, [](auto i) { return i % 3; }); + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i % 3; }); auto list_of_struct_of_list = cudf::make_lists_column( 5, std::move(fixed_width_column_wrapper{0, 2, 4, 6, 8, 10}.release()), @@ -456,7 +460,7 @@ TYPED_TEST(TypedStructColumnWrapperTest, ListOfStructOfList) auto expected_level0_list = lists_column_wrapper{ {{}, {1}, {}, {3}, {}, {5, 5}, {}, {}, {}, {9}}, - make_counting_transform_iterator(0, [](auto i) { return i % 2; })}; + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i % 2; })}; auto expected_level2_struct = structs_column_wrapper{{expected_level0_list}}.release(); @@ -479,17 +483,19 @@ TYPED_TEST(TypedStructColumnWrapperTest, StructOfListOfStruct) auto ints_col = fixed_width_column_wrapper{ {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, - make_counting_transform_iterator(0, [](auto i) { return i % 2; })}; + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i % 2; })}; auto structs_col = structs_column_wrapper{ {ints_col}, - make_counting_transform_iterator(0, [](auto i) { return i < 6; }) // Last 4 structs are null. + cudf::detail::make_counting_transform_iterator( + 0, [](auto i) { return i < 6; }) // Last 4 structs are null. } .release(); - auto list_validity = make_counting_transform_iterator(0, [](auto i) { return i % 3; }); - auto lists_col = cudf::make_lists_column( + auto list_validity = + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i % 3; }); + auto lists_col = cudf::make_lists_column( 5, std::move(fixed_width_column_wrapper{0, 2, 4, 6, 8, 10}.release()), std::move(structs_col), @@ -594,11 +600,11 @@ TYPED_TEST(TypedStructColumnWrapperTest, CopyColumnFromView) auto lists_column = lists_column_wrapper{ {{0, 0}, {1, 1}, {2, 2}, {3, 3}, {4, 4}, {5, 5}}, - make_counting_transform_iterator(0, [](auto i) { return i != 4; })}; + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i != 4; })}; - auto structs_column = - structs_column_wrapper{{numeric_column, lists_column}, - make_counting_transform_iterator(0, [](auto i) { return i != 3; })}; + auto structs_column = structs_column_wrapper{ + {numeric_column, lists_column}, + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i != 3; })}; auto clone_structs_column = cudf::column(structs_column); diff --git a/cpp/tests/transform/bools_to_mask_test.cpp b/cpp/tests/transform/bools_to_mask_test.cpp index 20d1c5df5ea..52e03b8ffa6 100644 --- a/cpp/tests/transform/bools_to_mask_test.cpp +++ b/cpp/tests/transform/bools_to_mask_test.cpp @@ -16,8 +16,10 @@ #include #include +#include #include #include + #include #include #include @@ -36,7 +38,7 @@ struct MaskToNullTest : public cudf::test::BaseFixture { } }); - auto sample = cudf::test::make_counting_transform_iterator(0, [](auto i) { return i; }); + auto sample = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i; }); cudf::test::fixed_width_column_wrapper expected( sample, sample + input.size(), input.begin()); @@ -52,7 +54,7 @@ struct MaskToNullTest : public cudf::test::BaseFixture { { cudf::test::fixed_width_column_wrapper input_column(input.begin(), input.end()); - auto sample = cudf::test::make_counting_transform_iterator(0, [](auto i) { return i; }); + auto sample = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i; }); cudf::test::fixed_width_column_wrapper expected( sample, sample + input.size(), input.begin()); diff --git a/cpp/tests/transform/integration/unary-transform-test.cpp b/cpp/tests/transform/integration/unary-transform-test.cpp index bcbabde3176..3f9088f9b4f 100644 --- a/cpp/tests/transform/integration/unary-transform-test.cpp +++ b/cpp/tests/transform/integration/unary-transform-test.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, NVIDIA CORPORATION. + * Copyright (c) 2019-2021, NVIDIA CORPORATION. * * Copyright 2018-2019 BlazingDB, Inc. * Copyright 2018 Christian Noboa Mardini @@ -17,10 +17,13 @@ * limitations under the License. */ +#include #include #include + #include #include + #include "assert-unary.h" #include @@ -34,8 +37,8 @@ struct UnaryOperationIntegrationTest : public cudf::test::BaseFixture { template void test_udf(const char udf[], Op op, Data data_init, cudf::size_type size, bool is_ptx) { - auto all_valid = cudf::test::make_counting_transform_iterator(0, [](auto i) { return true; }); - auto data_iter = cudf::test::make_counting_transform_iterator(0, data_init); + auto all_valid = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return true; }); + auto data_iter = cudf::detail::make_counting_transform_iterator(0, data_init); cudf::test::fixed_width_column_wrapper in( data_iter, data_iter + size, all_valid); diff --git a/cpp/tests/unary/cast_tests.cpp b/cpp/tests/unary/cast_tests.cpp index f4e623eea66..e8953ab9a30 100644 --- a/cpp/tests/unary/cast_tests.cpp +++ b/cpp/tests/unary/cast_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, NVIDIA CORPORATION. + * Copyright (c) 2020-2021, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,6 +19,7 @@ #include #include +#include #include #include #include @@ -566,8 +567,9 @@ TYPED_TEST(FixedPointTests, CastToDoubleLarge) using fp_wrapper = cudf::test::fixed_point_column_wrapper; using fw_wrapper = cudf::test::fixed_width_column_wrapper; - auto begin = make_counting_transform_iterator(0, [](auto i) { return 10 * (i + 0.5); }); - auto begin2 = make_counting_transform_iterator(0, [](auto i) { return i + 0.5; }); + auto begin = + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return 10 * (i + 0.5); }); + auto begin2 = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i + 0.5; }); auto const input = fp_wrapper{begin, begin + 2000, scale_type{-1}}; auto const expected = fw_wrapper(begin2, begin2 + 2000); auto const result = cudf::cast(input, make_data_type()); @@ -599,8 +601,8 @@ TYPED_TEST(FixedPointTests, CastToIntLarge) using fp_wrapper = cudf::test::fixed_point_column_wrapper; using fw_wrapper = cudf::test::fixed_width_column_wrapper; - auto begin = thrust::make_counting_iterator(0); - auto begin2 = make_counting_transform_iterator(0, [](auto i) { return 10 * i; }); + auto begin = thrust::make_counting_iterator(0); + auto begin2 = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return 10 * i; }); auto const input = fp_wrapper{begin, begin + 2000, scale_type{1}}; auto const expected = fw_wrapper(begin2, begin2 + 2000); auto const result = cudf::cast(input, make_data_type()); @@ -632,8 +634,9 @@ TYPED_TEST(FixedPointTests, CastFromDoubleLarge) using fp_wrapper = cudf::test::fixed_point_column_wrapper; using fw_wrapper = cudf::test::fixed_width_column_wrapper; - auto begin = make_counting_transform_iterator(0, [](auto i) { return i + 0.5; }); - auto begin2 = make_counting_transform_iterator(0, [](auto i) { return 10 * (i + 0.5); }); + auto begin = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i + 0.5; }); + auto begin2 = + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return 10 * (i + 0.5); }); auto const input = fw_wrapper(begin, begin + 2000); auto const expected = fp_wrapper{begin2, begin2 + 2000, scale_type{-1}}; auto const result = cudf::cast(input, make_fixed_point_data_type(-1)); @@ -665,8 +668,8 @@ TYPED_TEST(FixedPointTests, CastFromIntLarge) using fp_wrapper = cudf::test::fixed_point_column_wrapper; using fw_wrapper = cudf::test::fixed_width_column_wrapper; - auto begin = make_counting_transform_iterator(0, [](auto i) { return 1000 * i; }); - auto begin2 = thrust::make_counting_iterator(0); + auto begin = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return 1000 * i; }); + auto begin2 = thrust::make_counting_iterator(0); auto const input = fw_wrapper(begin, begin + 2000); auto const expected = fp_wrapper{begin2, begin2 + 2000, scale_type{3}}; auto const result = cudf::cast(input, make_fixed_point_data_type(3)); diff --git a/cpp/tests/unary/unary_ops_test.cpp b/cpp/tests/unary/unary_ops_test.cpp index 626cd520a11..0bb6bf740f5 100644 --- a/cpp/tests/unary/unary_ops_test.cpp +++ b/cpp/tests/unary/unary_ops_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2020, NVIDIA CORPORATION. + * Copyright (c) 2019-2021, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,6 +19,7 @@ #include #include +#include #include template @@ -26,12 +27,12 @@ cudf::test::fixed_width_column_wrapper create_fixed_columns(cudf::size_type s cudf::size_type size, bool nullable) { - auto iter = cudf::test::make_counting_transform_iterator(start, [](auto i) { return T(i); }); + auto iter = cudf::detail::make_counting_transform_iterator(start, [](auto i) { return T(i); }); if (not nullable) { return cudf::test::fixed_width_column_wrapper(iter, iter + size); } else { - auto valids = cudf::test::make_counting_transform_iterator( + auto valids = cudf::detail::make_counting_transform_iterator( 0, [](auto i) { return i % 2 == 0 ? true : false; }); return cudf::test::fixed_width_column_wrapper(iter, iter + size, valids); } @@ -43,11 +44,11 @@ cudf::test::fixed_width_column_wrapper create_expected_columns(cudf::size_typ bool nulls_to_be) { if (not nullable) { - auto iter = cudf::test::make_counting_transform_iterator( + auto iter = cudf::detail::make_counting_transform_iterator( 0, [nulls_to_be](auto i) { return not nulls_to_be; }); return cudf::test::fixed_width_column_wrapper(iter, iter + size); } else { - auto iter = cudf::test::make_counting_transform_iterator( + auto iter = cudf::detail::make_counting_transform_iterator( 0, [nulls_to_be](auto i) { return i % 2 == 0 ? not nulls_to_be : nulls_to_be; }); return cudf::test::fixed_width_column_wrapper(iter, iter + size); } @@ -303,7 +304,8 @@ TYPED_TEST(FixedPointUnaryTests, FixedPointUnaryAbsLarge) using fp_wrapper = cudf::test::fixed_point_column_wrapper; auto a = thrust::make_counting_iterator(-2000); - auto b = cudf::test::make_counting_transform_iterator(-2000, [](auto e) { return std::abs(e); }); + auto b = + cudf::detail::make_counting_transform_iterator(-2000, [](auto e) { return std::abs(e); }); auto const input = fp_wrapper{a, a + 4000, scale_type{-1}}; auto const expected = fp_wrapper{b, b + 4000, scale_type{-1}}; auto const result = cudf::unary_operation(input, cudf::unary_operator::ABS); @@ -333,7 +335,8 @@ TYPED_TEST(FixedPointUnaryTests, FixedPointUnaryCeilLarge) using fp_wrapper = cudf::test::fixed_point_column_wrapper; auto a = thrust::make_counting_iterator(-5000); - auto b = cudf::test::make_counting_transform_iterator(-5000, [](int e) { return (e / 10) * 10; }); + auto b = + cudf::detail::make_counting_transform_iterator(-5000, [](int e) { return (e / 10) * 10; }); auto const input = fp_wrapper{a, a + 4000, scale_type{-1}}; auto const expected = fp_wrapper{b, b + 4000, scale_type{-1}}; auto const result = cudf::unary_operation(input, cudf::unary_operator::CEIL); @@ -363,7 +366,8 @@ TYPED_TEST(FixedPointUnaryTests, FixedPointUnaryFloorLarge) using fp_wrapper = cudf::test::fixed_point_column_wrapper; auto a = thrust::make_counting_iterator(100); - auto b = cudf::test::make_counting_transform_iterator(100, [](auto e) { return (e / 10) * 10; }); + auto b = + cudf::detail::make_counting_transform_iterator(100, [](auto e) { return (e / 10) * 10; }); auto const input = fp_wrapper{a, a + 4000, scale_type{-1}}; auto const expected = fp_wrapper{b, b + 4000, scale_type{-1}}; auto const result = cudf::unary_operation(input, cudf::unary_operator::FLOOR); diff --git a/cpp/tests/utilities_tests/column_utilities_tests.cpp b/cpp/tests/utilities_tests/column_utilities_tests.cpp index 037ffbb2f25..75a8cec24e9 100644 --- a/cpp/tests/utilities_tests/column_utilities_tests.cpp +++ b/cpp/tests/utilities_tests/column_utilities_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, NVIDIA CORPORATION. + * Copyright (c) 2019-2021, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,16 +15,19 @@ */ #include +#include #include + #include #include #include #include #include -#include #include +#include + template struct ColumnUtilitiesTest : public cudf::test::BaseFixture { cudf::test::UniformRandomGenerator random; @@ -55,7 +58,7 @@ TYPED_TEST_CASE(ColumnUtilitiesTestFixedPoint, cudf::test::FixedPointTypes); TYPED_TEST(ColumnUtilitiesTest, NonNullableToHost) { - auto sequence = cudf::test::make_counting_transform_iterator( + auto sequence = cudf::detail::make_counting_transform_iterator( 0, [](auto i) { return cudf::test::make_type_param_scalar(i); }); auto size = this->size(); @@ -70,7 +73,7 @@ TYPED_TEST(ColumnUtilitiesTest, NonNullableToHost) TYPED_TEST(ColumnUtilitiesTest, NonNullableToHostWithOffset) { - auto sequence = cudf::test::make_counting_transform_iterator( + auto sequence = cudf::detail::make_counting_transform_iterator( 0, [](auto i) { return cudf::test::make_type_param_scalar(i); }); auto const size = this->size(); @@ -90,12 +93,12 @@ TYPED_TEST(ColumnUtilitiesTest, NonNullableToHostWithOffset) TYPED_TEST(ColumnUtilitiesTest, NullableToHostWithOffset) { - auto sequence = cudf::test::make_counting_transform_iterator( + auto sequence = cudf::detail::make_counting_transform_iterator( 0, [](auto i) { return cudf::test::make_type_param_scalar(i); }); auto split = 2; auto size = this->size(); - auto valid = cudf::test::make_counting_transform_iterator( + auto valid = cudf::detail::make_counting_transform_iterator( 0, [&split](auto i) { return (i < (split + 1) or i > 10) ? false : true; }); std::vector data(sequence, sequence + size); std::vector expected_data(sequence + split, sequence + size); @@ -115,7 +118,7 @@ TYPED_TEST(ColumnUtilitiesTest, NullableToHostWithOffset) TYPED_TEST(ColumnUtilitiesTest, NullableToHostAllValid) { - auto sequence = cudf::test::make_counting_transform_iterator( + auto sequence = cudf::detail::make_counting_transform_iterator( 0, [](auto i) { return cudf::test::make_type_param_scalar(i); }); auto all_valid = thrust::make_constant_iterator(true); @@ -147,7 +150,7 @@ TEST_F(ColumnUtilitiesEquivalenceTest, DoubleTest) TEST_F(ColumnUtilitiesEquivalenceTest, NullabilityTest) { - auto all_valid = cudf::test::make_counting_transform_iterator(0, [](auto i) { return true; }); + auto all_valid = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return true; }); cudf::test::fixed_width_column_wrapper col1{1, 2, 3}; cudf::test::fixed_width_column_wrapper col2({1, 2, 3}, all_valid); @@ -285,8 +288,8 @@ TYPED_TEST(ColumnUtilitiesTestFixedPoint, NonNullableToHost) auto const scale = scale_type{-2}; auto to_fp = [&](auto i) { return decimalXX{i, scale}; }; auto to_rep = [](auto i) { return i * 100; }; - auto fps = cudf::test::make_counting_transform_iterator(0, to_fp); - auto reps = cudf::test::make_counting_transform_iterator(0, to_rep); + auto fps = cudf::detail::make_counting_transform_iterator(0, to_fp); + auto reps = cudf::detail::make_counting_transform_iterator(0, to_rep); auto const size = 1000; auto const expected = std::vector(fps, fps + size); @@ -305,8 +308,8 @@ TYPED_TEST(ColumnUtilitiesTestFixedPoint, NonNullableToHostWithOffset) auto const scale = scale_type{-2}; auto to_fp = [&](auto i) { return decimalXX{i, scale}; }; auto to_rep = [](auto i) { return i * 100; }; - auto fps = cudf::test::make_counting_transform_iterator(0, to_fp); - auto reps = cudf::test::make_counting_transform_iterator(0, to_rep); + auto fps = cudf::detail::make_counting_transform_iterator(0, to_fp); + auto reps = cudf::detail::make_counting_transform_iterator(0, to_rep); auto const size = 1000; auto const split = cudf::size_type{2}; diff --git a/cpp/tests/utilities_tests/column_wrapper_tests.cpp b/cpp/tests/utilities_tests/column_wrapper_tests.cpp index e1826c46796..6c799b8d632 100644 --- a/cpp/tests/utilities_tests/column_wrapper_tests.cpp +++ b/cpp/tests/utilities_tests/column_wrapper_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, NVIDIA CORPORATION. + * Copyright (c) 2019-2021, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,6 +20,8 @@ #include #include +#include + template struct FixedWidthColumnWrapperTest : public cudf::test::BaseFixture, cudf::test::UniformRandomGenerator { @@ -34,7 +36,7 @@ TYPED_TEST_CASE(FixedWidthColumnWrapperTest, cudf::test::FixedWidthTypes); TYPED_TEST(FixedWidthColumnWrapperTest, EmptyIterator) { - auto sequence = cudf::test::make_counting_transform_iterator(0, [](auto i) { return i; }); + auto sequence = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i; }); cudf::test::fixed_width_column_wrapper col( sequence, sequence); cudf::column_view view = col; @@ -59,7 +61,7 @@ TYPED_TEST(FixedWidthColumnWrapperTest, EmptyList) TYPED_TEST(FixedWidthColumnWrapperTest, NonNullableIteratorConstructor) { - auto sequence = cudf::test::make_counting_transform_iterator(0, [](auto i) { return i; }); + auto sequence = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i; }); auto size = this->size(); @@ -89,9 +91,9 @@ TYPED_TEST(FixedWidthColumnWrapperTest, NonNullableListConstructor) TYPED_TEST(FixedWidthColumnWrapperTest, NullableIteratorConstructorAllValid) { - auto sequence = cudf::test::make_counting_transform_iterator(0, [](auto i) { return i; }); + auto sequence = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i; }); - auto all_valid = cudf::test::make_counting_transform_iterator(0, [](auto i) { return true; }); + auto all_valid = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return true; }); auto size = this->size(); @@ -108,7 +110,7 @@ TYPED_TEST(FixedWidthColumnWrapperTest, NullableIteratorConstructorAllValid) TYPED_TEST(FixedWidthColumnWrapperTest, NullableListConstructorAllValid) { - auto all_valid = cudf::test::make_counting_transform_iterator(0, [](auto i) { return true; }); + auto all_valid = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return true; }); cudf::test::fixed_width_column_wrapper col({1, 2, 3, 4, 5}, all_valid); cudf::column_view view = col; @@ -122,9 +124,9 @@ TYPED_TEST(FixedWidthColumnWrapperTest, NullableListConstructorAllValid) TYPED_TEST(FixedWidthColumnWrapperTest, NullableIteratorConstructorAllNull) { - auto sequence = cudf::test::make_counting_transform_iterator(0, [](auto i) { return i; }); + auto sequence = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i; }); - auto all_null = cudf::test::make_counting_transform_iterator(0, [](auto i) { return false; }); + auto all_null = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return false; }); auto size = this->size(); @@ -142,7 +144,7 @@ TYPED_TEST(FixedWidthColumnWrapperTest, NullableIteratorConstructorAllNull) TYPED_TEST(FixedWidthColumnWrapperTest, NullableListConstructorAllNull) { - auto all_null = cudf::test::make_counting_transform_iterator(0, [](auto i) { return false; }); + auto all_null = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return false; }); cudf::test::fixed_width_column_wrapper col({1, 2, 3, 4, 5}, all_null); cudf::column_view view = col; @@ -174,7 +176,7 @@ TYPED_TEST(FixedWidthColumnWrapperTest, NullablePairListConstructorAllNull) TYPED_TEST(FixedWidthColumnWrapperTest, NullablePairListConstructorAllNullMatch) { auto odd_valid = - cudf::test::make_counting_transform_iterator(0, [](auto i) { return i % 2 != 0; }); + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i % 2 != 0; }); cudf::test::fixed_width_column_wrapper match_col({1, 2, 3, 4, 5}, odd_valid); cudf::column_view match_view = match_col; @@ -192,7 +194,7 @@ TYPED_TEST(FixedWidthColumnWrapperTest, NullablePairListConstructorAllNullMatch) TYPED_TEST(FixedWidthColumnWrapperTest, ReleaseWrapperAllValid) { - auto all_valid = cudf::test::make_counting_transform_iterator(0, [](auto i) { return true; }); + auto all_valid = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return true; }); cudf::test::fixed_width_column_wrapper col({1, 2, 3, 4, 5}, all_valid); auto colPtr = col.release(); @@ -207,7 +209,7 @@ TYPED_TEST(FixedWidthColumnWrapperTest, ReleaseWrapperAllValid) TYPED_TEST(FixedWidthColumnWrapperTest, ReleaseWrapperAllNull) { - auto all_null = cudf::test::make_counting_transform_iterator(0, [](auto i) { return false; }); + auto all_null = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return false; }); cudf::test::fixed_width_column_wrapper col({1, 2, 3, 4, 5}, all_null); auto colPtr = col.release(); @@ -261,7 +263,7 @@ TYPED_TEST(StringsColumnWrapperTest, NullablePairListConstructorAllNull) TYPED_TEST(StringsColumnWrapperTest, NullablePairListConstructorAllNullMatch) { auto odd_valid = - cudf::test::make_counting_transform_iterator(0, [](auto i) { return i % 2 != 0; }); + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i % 2 != 0; }); cudf::test::strings_column_wrapper match_col({"a", "string", "", "test", "for", "nulls"}, odd_valid); diff --git a/cpp/tests/utilities_tests/lists_column_wrapper_tests.cpp b/cpp/tests/utilities_tests/lists_column_wrapper_tests.cpp index 0ef31a0cef6..1fb74c901b8 100644 --- a/cpp/tests/utilities_tests/lists_column_wrapper_tests.cpp +++ b/cpp/tests/utilities_tests/lists_column_wrapper_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, NVIDIA CORPORATION. + * Copyright (c) 2020-2021, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,18 +14,21 @@ * limitations under the License. */ +#include +#include #include +#include #include #include #include #include #include -#include "cudf/column/column_factories.hpp" -#include "cudf/types.hpp" -#include "rmm/device_buffer.hpp" -#include "thrust/iterator/counting_iterator.h" -#include "thrust/iterator/transform_iterator.h" + +#include + +#include +#include struct ListColumnWrapperTest : public cudf::test::BaseFixture { }; @@ -103,7 +106,7 @@ TYPED_TEST(ListColumnWrapperTestTyped, ListWithValidity) using namespace cudf; using T = TypeParam; - auto valids = cudf::test::make_counting_transform_iterator( + auto valids = cudf::detail::make_counting_transform_iterator( 0, [](auto i) { return i % 2 == 0 ? true : false; }); // List, 1 row @@ -170,7 +173,7 @@ TYPED_TEST(ListColumnWrapperTestTyped, ListFromIterator) // Children : // 0, 1, 2, 3, 4 // - auto sequence = cudf::test::make_counting_transform_iterator(0, [](auto i) { return i; }); + auto sequence = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i; }); test::lists_column_wrapper list{sequence, sequence + 5}; @@ -194,7 +197,7 @@ TYPED_TEST(ListColumnWrapperTestTyped, ListFromIteratorWithValidity) using namespace cudf; using T = TypeParam; - auto valids = cudf::test::make_counting_transform_iterator( + auto valids = cudf::detail::make_counting_transform_iterator( 0, [](auto i) { return i % 2 == 0 ? true : false; }); // List, 1 row @@ -205,7 +208,7 @@ TYPED_TEST(ListColumnWrapperTestTyped, ListFromIteratorWithValidity) // Children : // 0, NULL, 2, NULL, 4 // - auto sequence = cudf::test::make_counting_transform_iterator(0, [](auto i) { return i; }); + auto sequence = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i; }); test::lists_column_wrapper list{ sequence, sequence + 5, valids}; @@ -309,7 +312,7 @@ TYPED_TEST(ListColumnWrapperTestTyped, ListOfListsWithValidity) using namespace cudf; using T = TypeParam; - auto valids = cudf::test::make_counting_transform_iterator( + auto valids = cudf::detail::make_counting_transform_iterator( 0, [](auto i) { return i % 2 == 0 ? true : false; }); // List>, 1 row @@ -398,7 +401,7 @@ TYPED_TEST(ListColumnWrapperTestTyped, ListOfListOfListsWithValidity) using namespace cudf; using T = TypeParam; - auto valids = cudf::test::make_counting_transform_iterator( + auto valids = cudf::detail::make_counting_transform_iterator( 0, [](auto i) { return i % 2 == 0 ? true : false; }); // List>>, 2 rows @@ -596,7 +599,7 @@ TYPED_TEST(ListColumnWrapperTestTyped, EmptyListsWithValidity) // empty lists in lists_column_wrapper documentation using LCW = test::lists_column_wrapper; - auto valids = cudf::test::make_counting_transform_iterator( + auto valids = cudf::detail::make_counting_transform_iterator( 0, [](auto i) { return i % 2 == 0 ? true : false; }); // List, 2 rows @@ -1269,7 +1272,7 @@ TEST_F(ListColumnWrapperTest, ListOfBoolsWithValidity) { using namespace cudf; - auto valids = cudf::test::make_counting_transform_iterator( + auto valids = cudf::detail::make_counting_transform_iterator( 0, [](auto i) { return i % 2 == 0 ? true : false; }); // List, 3 rows @@ -1529,7 +1532,7 @@ TYPED_TEST(ListColumnWrapperTestTyped, LargeListsOfStructsWithValidity) auto numeric_column = test::fixed_width_column_wrapper{ thrust::make_counting_iterator(0), thrust::make_counting_iterator(num_struct_rows), - cudf::test::make_counting_transform_iterator(0, [](auto i) { return i % 2 == 1; })}; + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i % 2 == 1; })}; auto bool_iterator = thrust::make_transform_iterator(thrust::make_counting_iterator(0), [](auto i) { return i % 3 == 0; }); @@ -1537,7 +1540,7 @@ TYPED_TEST(ListColumnWrapperTestTyped, LargeListsOfStructsWithValidity) test::fixed_width_column_wrapper(bool_iterator, bool_iterator + num_struct_rows); auto struct_validity_iterator = - cudf::test::make_counting_transform_iterator(0, [](auto i) { return i % 5 == 0; }); + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i % 5 == 0; }); auto struct_column = test::structs_column_wrapper{ {numeric_column, bool_column}, @@ -1550,7 +1553,7 @@ TYPED_TEST(ListColumnWrapperTestTyped, LargeListsOfStructsWithValidity) // Each list has 50 elements. auto num_list_rows = num_struct_rows / 50; auto list_offset_iterator = - test::make_counting_transform_iterator(0, [](auto i) { return i * 50; }); + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i * 50; }); auto list_offset_column = test::fixed_width_column_wrapper( list_offset_iterator, list_offset_iterator + num_list_rows + 1) .release(); @@ -1566,7 +1569,7 @@ TYPED_TEST(ListColumnWrapperTestTyped, LargeListsOfStructsWithValidity) auto expected_numeric_column = test::fixed_width_column_wrapper{ thrust::make_counting_iterator(0), thrust::make_counting_iterator(num_struct_rows), - cudf::test::make_counting_transform_iterator(0, [](auto i) { return i % 2 == 1; })}; + cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i % 2 == 1; })}; auto expected_bool_column = test::fixed_width_column_wrapper(bool_iterator, bool_iterator + num_struct_rows);