From 202c2f29e76ee37b96ad0cc817738b6ce35933bd Mon Sep 17 00:00:00 2001 From: Karthikeyan Natarajan Date: Wed, 25 May 2022 17:34:23 +0530 Subject: [PATCH 1/7] add missing docs in table headers --- .../cudf/table/experimental/row_operators.cuh | 127 ++++++++++++++---- cpp/include/cudf/table/row_operators.cuh | 116 ++++++++++++++-- cpp/include/cudf/table/table.hpp | 16 ++- cpp/include/cudf/table/table_device_view.cuh | 120 ++++++++++++++++- cpp/include/cudf/table/table_view.hpp | 65 +++++++-- 5 files changed, 398 insertions(+), 46 deletions(-) diff --git a/cpp/include/cudf/table/experimental/row_operators.cuh b/cpp/include/cudf/table/experimental/row_operators.cuh index f01bc41a2bc..ee5fbdc9b09 100644 --- a/cpp/include/cudf/table/experimental/row_operators.cuh +++ b/cpp/include/cudf/table/experimental/row_operators.cuh @@ -67,6 +67,7 @@ namespace experimental { */ template struct dispatch_void_if_nested { + /// The type to dispatch to if the type is nested using type = std::conditional_t>; }; @@ -95,11 +96,17 @@ struct strong_index_iterator : public thrust::iterator_facade { - using super_t = thrust::iterator_adaptor, Index>; + using super_t = + thrust::iterator_adaptor, Index>; ///< The base class + /** + * @brief Constructs a strong index iterator + * + * @param n The beginning index + */ explicit constexpr strong_index_iterator(Underlying n) : begin{n} {} - friend class thrust::iterator_core_access; + friend class thrust::iterator_core_access; ///< Allow access to the base class private: __device__ constexpr void increment() { ++begin; } @@ -154,8 +161,8 @@ namespace lexicographic { */ template class device_row_comparator { - friend class self_comparator; - friend class two_table_comparator; + friend class self_comparator; ///< Allow self_comparator to access private members + friend class two_table_comparator; ///< Allow two_table_comparator to access private members /** * @brief Construct a function object for performing a lexicographic @@ -378,7 +385,12 @@ template using less_equivalent_comparator = weak_ordering_comparator_impl; +/** + * @brief Preprocessed table for use with lexicographical comparison + * + */ struct preprocessed_table { + /// Type of table device view owner for the preprocessed table. using table_device_view_owner = std::invoke_result_t; @@ -396,6 +408,7 @@ struct preprocessed_table { * values compare to all other for every column. If it is nullptr, then null precedence would be * `null_order::BEFORE` for all columns. * @param stream The stream to launch kernels and h->d copies on while preprocessing. + * @return A preprocessed table as a shared pointer */ static std::shared_ptr create(table_view const& table, host_span column_order, @@ -403,8 +416,8 @@ struct preprocessed_table { rmm::cuda_stream_view stream); private: - friend class self_comparator; - friend class two_table_comparator; + friend class self_comparator; ///< Allow self_comparator to access private members + friend class two_table_comparator; ///< Allow two_table_comparator to access private members preprocessed_table(table_device_view_owner&& table, rmm::device_uvector&& column_order, @@ -525,6 +538,8 @@ class self_comparator { * `F(i,j)` returns true if and only if row `i` compares lexicographically less than row `j`. * * @tparam Nullate A cudf::nullate type describing whether to check for nulls. + * @param nullate Indicates if either input column contains nulls + * @return A binary callable object */ template less_comparator> device_comparator(Nullate nullate = {}) const @@ -537,6 +552,7 @@ class self_comparator { std::shared_ptr d_t; }; +// @cond template struct strong_index_comparator_adapter { __device__ constexpr weak_ordering operator()(lhs_index_type const lhs_index, @@ -563,6 +579,7 @@ struct strong_index_comparator_adapter { Comparator const comparator; }; +// @endcond /** * @brief An owning object that can be used to lexicographically compare rows of two different @@ -636,6 +653,8 @@ class two_table_comparator { * `j` of the left table. * * @tparam Nullate A cudf::nullate type describing whether to check for nulls. + * @param nullate Indicates if either input column contains nulls. + * @return A binary callable object */ template less_comparator>> @@ -662,11 +681,15 @@ class row_hasher; } namespace equality { - +/** + * @brief Comparator for performing equality comparison between the rows of two tables. + * + * @tparam Nullate A cudf::nullate type describing whether to check for nulls. + */ template class device_row_comparator { - friend class self_comparator; - friend class two_table_comparator; + friend class self_comparator; ///< Allow self_comparator to access private members + friend class two_table_comparator; ///< Allow two_table_comparator to access private members public: /** @@ -860,24 +883,30 @@ class device_row_comparator { null_equality const nulls_are_equal; }; +/** + * @brief Preprocess table for use with row equality comparison or row hashing + * + * Sets up the table for use with row equality comparison or row hashing. The resulting + * preprocessed table can be passed to the constructor of `equality::self_comparator` to + * avoid preprocessing again. + * + */ struct preprocessed_table { /** - * @brief Preprocess table for use with row equality comparison or row hashing - * - * Sets up the table for use with row equality comparison or row hashing. The resulting - * preprocessed table can be passed to the constructor of `equality::self_comparator` to - * avoid preprocessing again. + * @brief Factory to construct preprocessed_table for use with + * row equality comparison or row hashing * * @param table The table to preprocess * @param stream The cuda stream to use while preprocessing. + * @return A preprocessed table as shared pointer */ static std::shared_ptr create(table_view const& table, rmm::cuda_stream_view stream); private: - friend class self_comparator; - friend class two_table_comparator; - friend class hash::row_hasher; + friend class self_comparator; ///< Allow self_comparator to access private members + friend class two_table_comparator; ///< Allow two_table_comparator to access private members + friend class hash::row_hasher; ///< Allow row_hasher to access private members using table_device_view_owner = std::invoke_result_t; @@ -899,6 +928,10 @@ struct preprocessed_table { std::vector _null_buffers; }; +/** + * @brief Comparator for performing equality comparisons between two rows of the same table. + * + */ class self_comparator { public: /** @@ -932,11 +965,14 @@ class self_comparator { * * `F(i,j)` returns true if and only if row `i` compares equal to row `j`. * - * @tparam Nullate A cudf::nullate type describing whether to check for nulls. + * @tparam Nullate A cudf::nullate type describing whether to check for nulls + * @param nullate Indicates if either input column contains nulls + * @param nulls_are_equal Indicates if nulls are equal + * @return A binary callable object */ template device_row_comparator device_comparator( - Nullate nullate = {}, null_equality nulls_are_equal = null_equality::EQUAL) const + Nullate nullate = {}, null_equality nulls_are_equal = n`ull_equality::EQUAL) const { return device_row_comparator(nullate, *d_t, *d_t, nulls_are_equal); } @@ -945,6 +981,7 @@ class self_comparator { std::shared_ptr d_t; }; +// @cond template struct strong_index_comparator_adapter { __device__ constexpr bool operator()(lhs_index_type const lhs_index, @@ -962,6 +999,7 @@ struct strong_index_comparator_adapter { Comparator const comparator; }; +// @endcond /** * @brief An owning object that can be used to equality compare rows of two different tables. @@ -1022,7 +1060,10 @@ class two_table_comparator { * Similarly, `F(rhs_index_type i, lhs_index_type j)` returns true if and only if row `i` of the * right table compares equal to row `j` of the left table. * - * @tparam Nullate A cudf::nullate type describing whether to check for nulls. + * @tparam Nullate A cudf::nullate type describing whether to check for nulls + * @param nullate Indicates if either input column contains nulls + * @param nulls_are_equal Indicates if nulls are equal + * @return A binary callable object */ template auto device_comparator(Nullate nullate = {}, @@ -1050,6 +1091,13 @@ namespace hash { template