22 #include <cudf/utilities/export.hpp>
37 namespace CUDF_EXPORT
cudf {
71 [[nodiscard]]
virtual std::size_t
do_hash()
const
73 return std::hash<int>{}(
static_cast<int>(aggregation::Kind::HOST_UDF));
90 [[nodiscard]]
virtual std::unique_ptr<host_udf_base>
clone()
const = 0;
145 std::optional<std::reference_wrapper<scalar const>> init,
209 std::optional<std::reference_wrapper<scalar const>> init,
215 namespace groupby ::detail {
216 struct aggregate_result_functor;
293 friend struct groupby::detail::aggregate_result_functor;
298 std::function<
column_view(
void)> callback_input_values;
304 std::function<
column_view(
void)> callback_grouped_values;
310 std::function<
column_view(
void)> callback_sorted_grouped_values;
315 std::function<
size_type(
void)> callback_num_groups;
320 std::function<device_span<size_type const>(
void)> callback_group_offsets;
325 std::function<device_span<size_type const>(
void)> callback_group_labels;
330 std::function<
column_view(std::unique_ptr<aggregation>)> callback_compute_aggregation;
340 CUDF_EXPECTS(callback_input_values,
"Uninitialized callback_input_values.");
341 return callback_input_values();
352 CUDF_EXPECTS(callback_grouped_values,
"Uninitialized callback_grouped_values.");
353 return callback_grouped_values();
364 CUDF_EXPECTS(callback_sorted_grouped_values,
"Uninitialized callback_sorted_grouped_values.");
365 return callback_sorted_grouped_values();
375 CUDF_EXPECTS(callback_num_groups,
"Uninitialized callback_num_groups.");
376 return callback_num_groups();
386 CUDF_EXPECTS(callback_group_offsets,
"Uninitialized callback_group_offsets.");
387 return callback_group_offsets();
397 CUDF_EXPECTS(callback_group_labels,
"Uninitialized callback_group_labels.");
398 return callback_group_labels();
412 CUDF_EXPECTS(callback_compute_aggregation,
"Uninitialized callback for computing aggregation.");
413 return callback_compute_aggregation(std::move(other_agg));
Representation for specifying desired aggregations from aggregation-based APIs, e....
A non-owning, immutable view of device data as a column of elements, some of which may be null as ind...
Indicator for the logical data type of an element in a column.
The fundamental interface for host-based UDF implementation.
virtual ~host_udf_base()=default
Default destructor.
virtual bool is_equal(host_udf_base const &other) const =0
Compares two instances of the derived class for equality.
virtual std::unique_ptr< host_udf_base > clone() const =0
Clones the instance.
virtual std::size_t do_hash() const
Computes hash value of the instance.
column view class definitions
cuda::mr::async_resource_ref< cuda::mr::device_accessible > device_async_resource_ref
#define CUDF_EXPECTS(...)
Macro for checking (pre-)conditions that throws an exception when a condition is violated.
int32_t size_type
Row index type for columns and tables.
null_policy
Enum to specify whether to include nulls or exclude nulls.
Device version of C++20 std::span with reduced feature set.
The interface for host-based UDF implementation for groupby aggregation context.
device_span< size_type const > get_group_labels() const
Access the group labels (which is also the same as group indices).
size_type get_num_groups() const
Access the number of groups (i.e., number of distinct keys).
column_view get_grouped_values() const
Access the input values grouped according to the input keys for which the values within each group ma...
column_view get_sorted_grouped_values() const
Access the input values grouped according to the input keys and sorted within each group.
column_view get_input_values() const
Access the input values column.
column_view compute_aggregation(std::unique_ptr< aggregation > other_agg) const
Compute a built-in groupby aggregation and access its result.
virtual std::unique_ptr< column > get_empty_output(rmm::cuda_stream_view stream, rmm::device_async_resource_ref mr) const =0
Get the output when the input values column is empty.
virtual std::unique_ptr< column > operator()(rmm::cuda_stream_view stream, rmm::device_async_resource_ref mr) const =0
Perform the main groupby computation for the host-based UDF.
device_span< size_type const > get_group_offsets() const
Access the offsets separating groups.
The interface for host-based UDF implementation for reduction contexts.
virtual std::unique_ptr< scalar > operator()(column_view const &input, data_type output_dtype, std::optional< std::reference_wrapper< scalar const >> init, rmm::cuda_stream_view stream, rmm::device_async_resource_ref mr) const =0
Perform reduction operations.
The interface for host-based UDF implementation for segmented reduction context.
virtual std::unique_ptr< column > operator()(column_view const &input, device_span< size_type const > offsets, data_type output_dtype, null_policy null_handling, std::optional< std::reference_wrapper< scalar const >> init, rmm::cuda_stream_view stream, rmm::device_async_resource_ref mr) const =0
Perform segmented reduction operations.
Type declarations for libcudf.