The interface for host-based UDF implementation for groupby aggregation context. More...
#include <host_udf.hpp>
Public Member Functions | |
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. More... | |
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. More... | |
![]() | |
virtual | ~host_udf_base ()=default |
Default destructor. | |
virtual std::size_t | do_hash () const |
Computes hash value of the instance. More... | |
virtual bool | is_equal (host_udf_base const &other) const =0 |
Compares two instances of the derived class for equality. More... | |
virtual std::unique_ptr< host_udf_base > | clone () const =0 |
Clones the instance. More... | |
Protected Member Functions | |
column_view | get_input_values () const |
Access the input values column. More... | |
column_view | get_grouped_values () const |
Access the input values grouped according to the input keys for which the values within each group maintain their original order. More... | |
column_view | get_sorted_grouped_values () const |
Access the input values grouped according to the input keys and sorted within each group. More... | |
size_type | get_num_groups () const |
Access the number of groups (i.e., number of distinct keys). More... | |
device_span< size_type const > | get_group_offsets () const |
Access the offsets separating groups. More... | |
device_span< size_type const > | get_group_labels () const |
Access the group labels (which is also the same as group indices). More... | |
column_view | compute_aggregation (std::unique_ptr< aggregation > other_agg) const |
Compute a built-in groupby aggregation and access its result. More... | |
Friends | |
struct | groupby::detail::aggregate_result_functor |
The interface for host-based UDF implementation for groupby aggregation context.
An implementation of host-based UDF for groupby needs to be derived from this class. In addition to implementing the virtual functions declared in the base class host_udf_base
, such a derived class must also define the functions get_empty_output()
to return result when the input is empty, and operator()
to perform its groupby operations.
During execution, the derived class can access internal data provided by the libcudf groupby framework through a set of get*
accessors, as well as calling other built-in groupby aggregations through the compute_aggregation
function.
Example:
Definition at line 267 of file host_udf.hpp.
|
inlineprotected |
Compute a built-in groupby aggregation and access its result.
This allows the derived class to call any other built-in groupby aggregations on the same input values column and access the output for its operations.
other_agg | An arbitrary built-in groupby aggregation |
column_view
object corresponding to the output result of the given aggregation Definition at line 410 of file host_udf.hpp.
|
pure virtual |
Get the output when the input values column is empty.
This is called in libcudf when the input values column is empty. In such situations libcudf tries to generate the output directly without unnecessarily evaluating the intermediate data.
stream | The CUDA stream to use for any kernel launches |
mr | Device memory resource to use for any allocations |
|
inlineprotected |
Access the group labels (which is also the same as group indices).
Definition at line 395 of file host_udf.hpp.
|
inlineprotected |
Access the offsets separating groups.
Definition at line 384 of file host_udf.hpp.
|
inlineprotected |
Access the input values grouped according to the input keys for which the values within each group maintain their original order.
Definition at line 350 of file host_udf.hpp.
|
inlineprotected |
Access the input values column.
Definition at line 338 of file host_udf.hpp.
|
inlineprotected |
Access the number of groups (i.e., number of distinct keys).
Definition at line 373 of file host_udf.hpp.
|
inlineprotected |
Access the input values grouped according to the input keys and sorted within each group.
Definition at line 362 of file host_udf.hpp.
|
pure virtual |
Perform the main groupby computation for the host-based UDF.
stream | The CUDA stream to use for any kernel launches |
mr | Device memory resource to use for any allocations |