transform.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2019-2024, NVIDIA CORPORATION.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #pragma once
18 
19 #include <cudf/ast/expressions.hpp>
20 #include <cudf/types.hpp>
21 #include <cudf/utilities/export.hpp>
23 
24 #include <memory>
25 
26 namespace CUDF_EXPORT cudf {
53 std::unique_ptr<column> transform(
54  column_view const& input,
55  std::string const& unary_udf,
56  data_type output_type,
57  bool is_ptx,
60 
73 std::pair<std::unique_ptr<rmm::device_buffer>, size_type> nans_to_nulls(
74  column_view const& input,
77 
92 std::unique_ptr<column> compute_column(
93  table_view const& table,
94  ast::expression const& expr,
97 
114 std::pair<std::unique_ptr<rmm::device_buffer>, cudf::size_type> bools_to_mask(
115  column_view const& input,
118 
144 std::pair<std::unique_ptr<cudf::table>, std::unique_ptr<cudf::column>> encode(
145  cudf::table_view const& input,
148 
177 std::pair<std::unique_ptr<column>, table_view> one_hot_encode(
178  column_view const& input,
179  column_view const& categories,
182 
205 std::unique_ptr<column> mask_to_bools(
206  bitmask_type const* bitmask,
207  size_type begin_bit,
208  size_type end_bit,
211 
238 std::unique_ptr<column> row_bit_count(
239  table_view const& t,
242 
262 std::unique_ptr<column> segmented_row_bit_count(
263  table_view const& t,
264  size_type segment_length,
267  // end of group
269 } // namespace CUDF_EXPORT cudf
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.
Definition: types.hpp:243
A set of cudf::column_view's of the same size.
Definition: table_view.hpp:200
A set of cudf::column's of the same size.
Definition: table.hpp:40
rmm::cuda_stream_view const get_default_stream()
Get the current default stream.
rmm::device_async_resource_ref get_current_device_resource_ref()
Get the current device memory resource reference.
cuda::mr::async_resource_ref< cuda::mr::device_accessible > device_async_resource_ref
std::pair< std::unique_ptr< cudf::table >, std::unique_ptr< cudf::column > > encode(cudf::table_view const &input, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
Encode the rows of the given table as integers.
std::unique_ptr< column > row_bit_count(table_view const &t, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
Returns an approximate cumulative size in bits of all columns in the table_view for each row.
std::pair< std::unique_ptr< rmm::device_buffer >, cudf::size_type > bools_to_mask(column_view const &input, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
Creates a bitmask from a column of boolean elements.
std::pair< std::unique_ptr< column >, table_view > one_hot_encode(column_view const &input, column_view const &categories, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
Encodes input by generating a new column for each value in categories indicating the presence of that...
std::unique_ptr< column > mask_to_bools(bitmask_type const *bitmask, size_type begin_bit, size_type end_bit, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
Creates a boolean column from given bitmask.
std::unique_ptr< column > transform(column_view const &input, std::string const &unary_udf, data_type output_type, bool is_ptx, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
Creates a new column by applying a unary function against every element of an input column.
std::pair< std::unique_ptr< rmm::device_buffer >, size_type > nans_to_nulls(column_view const &input, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
Creates a null_mask from input by converting NaN to null and preserving existing null values and also...
std::unique_ptr< column > compute_column(table_view const &table, ast::expression const &expr, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
Compute a new column by evaluating an expression tree on a table.
std::unique_ptr< column > segmented_row_bit_count(table_view const &t, size_type segment_length, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
Returns an approximate cumulative size in bits of all columns in the table_view for each segment of r...
int32_t size_type
Row index type for columns and tables.
Definition: types.hpp:95
uint32_t bitmask_type
Bitmask type stored as 32-bit unsigned integer.
Definition: types.hpp:96
cuDF interfaces
Definition: host_udf.hpp:39
A generic expression that can be evaluated to return a value.
Definition: expressions.hpp:48
Type declarations for libcudf.