Files | |
file | transform.hpp |
Column APIs for transforming rows. | |
Functions | |
std::unique_ptr< column > | cudf::transform (column_view const &input, std::string const &unary_udf, data_type output_type, bool is_ptx, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource()) |
Creates a new column by applying a unary function against every element of an input column. More... | |
std::pair< std::unique_ptr< rmm::device_buffer >, size_type > | cudf::nans_to_nulls (column_view const &input, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource()) |
Creates a null_mask from input by converting NaN to null and preserving existing null values and also returns new null_count. More... | |
std::pair< std::unique_ptr< rmm::device_buffer >, cudf::size_type > | cudf::bools_to_mask (column_view const &input, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource()) |
Creates a bitmask from a column of boolean elements. More... | |
std::pair< std::unique_ptr< cudf::table >, std::unique_ptr< cudf::column > > | cudf::encode (cudf::table_view const &input, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource()) |
Encode the rows of the given table as integers. More... | |
std::unique_ptr< column > | cudf::mask_to_bools (bitmask_type const *bitmask, size_type begin_bit, size_type end_bit, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource()) |
Creates a boolean column from given bitmask. More... | |
std::pair<std::unique_ptr<rmm::device_buffer>, cudf::size_type> cudf::bools_to_mask | ( | column_view const & | input, |
rmm::mr::device_memory_resource * | mr = rmm::mr::get_current_device_resource() |
||
) |
Creates a bitmask from a column of boolean elements.
If element i
in input
is true
, bit i
in the resulting mask is set (1
). Else, if element i
is false
or null, bit i
is unset (0
).
cudf::logic_error | if input.type() is a non-boolean type |
input | Boolean elements to convert to a bitmask. |
mr | Device memory resource used to allocate the returned bitmask. |
device_buffer
with the new bitmask and it's null count obtained from input considering true
represent valid
/1
and false
represent invalid
/0
. std::pair<std::unique_ptr<cudf::table>, std::unique_ptr<cudf::column> > cudf::encode | ( | cudf::table_view const & | input, |
rmm::mr::device_memory_resource * | mr = rmm::mr::get_current_device_resource() |
||
) |
Encode the rows of the given table as integers.
The encoded values are integers in the range [0, n), where n
is the number of distinct rows in the input table. The result table is such that keys[result[i]] == input[i]
, where keys
is a table containing the distinct rows in input
in sorted ascending order. Nulls, if any, are sorted to the end of the keys
table.
Examples:
input | Table containing values to be encoded |
mr | Device memory resource used to allocate the returned table's device memory |
std::unique_ptr<column> cudf::mask_to_bools | ( | bitmask_type const * | bitmask, |
size_type | begin_bit, | ||
size_type | end_bit, | ||
rmm::mr::device_memory_resource * | mr = rmm::mr::get_current_device_resource() |
||
) |
Creates a boolean column from given bitmask.
Returns a bool
for each bit in [begin_bit, end_bit)
. If bit i
in least-significant bit numbering is set (1), then element i
in the output is true
, otherwise false
.
cudf::logic_error | if bitmask is null and end_bit-begin_bit > 0 |
cudf::logic_error | if begin_bit > end_bit |
Examples:
bitmask | A device pointer to the bitmask which needs to be converted |
begin_bit | position of the bit from which the conversion should start |
end_bit | position of the bit before which the conversion should stop |
mr | Device memory resource used to allocate the returned columns's device memory |
std::pair<std::unique_ptr<rmm::device_buffer>, size_type> cudf::nans_to_nulls | ( | column_view const & | input, |
rmm::mr::device_memory_resource * | mr = rmm::mr::get_current_device_resource() |
||
) |
Creates a null_mask from input
by converting NaN
to null and preserving existing null values and also returns new null_count.
cudf::logic_error | if input.type() is a non-floating type |
input | An immutable view of the input column of floating-point type |
mr | Device memory resource used to allocate the returned bitmask. |
device_buffer
with the new bitmask and it's null count obtained by replacing NaN
in input
with null. std::unique_ptr<column> cudf::transform | ( | column_view const & | input, |
std::string const & | unary_udf, | ||
data_type | output_type, | ||
bool | is_ptx, | ||
rmm::mr::device_memory_resource * | mr = rmm::mr::get_current_device_resource() |
||
) |
Creates a new column by applying a unary function against every element of an input column.
Computes: out[i] = F(in[i])
The output null mask is the same is the input null mask so if input[i] is null then output[i] is also null
input | An immutable view of the input column to transform |
unary_udf | The PTX/CUDA string of the unary function to apply |
outout_type | The output type that is compatible with the output type in the UDF |
is_ptx | true: the UDF is treated as PTX code; false: the UDF is treated as CUDA code |
mr | Device memory resource used to allocate the returned column's device memory |