libcudf  23.12.00
stream_compaction.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2019-2023, 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/types.hpp>
20 
22 
23 #include <memory>
24 #include <vector>
25 
26 namespace cudf {
71 std::unique_ptr<table> drop_nulls(
72  table_view const& input,
73  std::vector<size_type> const& keys,
74  cudf::size_type keep_threshold,
76 
103 std::unique_ptr<table> drop_nulls(
104  table_view const& input,
105  std::vector<size_type> const& keys,
107 
145 std::unique_ptr<table> drop_nans(
146  table_view const& input,
147  std::vector<size_type> const& keys,
148  cudf::size_type keep_threshold,
150 
178 std::unique_ptr<table> drop_nans(
179  table_view const& input,
180  std::vector<size_type> const& keys,
182 
204 std::unique_ptr<table> apply_boolean_mask(
205  table_view const& input,
206  column_view const& boolean_mask,
208 
213  KEEP_ANY = 0,
214  KEEP_FIRST,
215  KEEP_LAST,
216  KEEP_NONE
217 };
218 
246 std::unique_ptr<table> unique(
247  table_view const& input,
248  std::vector<size_type> const& keys,
250  null_equality nulls_equal = null_equality::EQUAL,
252 
272 std::unique_ptr<table> distinct(
273  table_view const& input,
274  std::vector<size_type> const& keys,
276  null_equality nulls_equal = null_equality::EQUAL,
279 
302 std::unique_ptr<table> stable_distinct(
303  table_view const& input,
304  std::vector<size_type> const& keys,
306  null_equality nulls_equal = null_equality::EQUAL,
309 
326  null_policy null_handling,
327  nan_policy nan_handling);
328 
339  null_equality nulls_equal = null_equality::EQUAL);
340 
362  null_policy null_handling,
363  nan_policy nan_handling);
364 
375  null_equality nulls_equal = null_equality::EQUAL);
376 
378 } // namespace cudf
A non-owning, immutable view of device data as a column of elements, some of which may be null as ind...
A set of cudf::column_view's of the same size.
Definition: table_view.hpp:187
device_memory_resource * get_current_device_resource()
std::unique_ptr< table > stable_distinct(table_view const &input, std::vector< size_type > const &keys, duplicate_keep_option keep=duplicate_keep_option::KEEP_ANY, null_equality nulls_equal=null_equality::EQUAL, nan_equality nans_equal=nan_equality::ALL_EQUAL, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
Create a new table without duplicate rows, preserving input order.
std::unique_ptr< table > unique(table_view const &input, std::vector< size_type > const &keys, duplicate_keep_option keep, null_equality nulls_equal=null_equality::EQUAL, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
Create a new table with consecutive duplicate rows removed.
cudf::size_type unique_count(column_view const &input, null_policy null_handling, nan_policy nan_handling)
Count the number of consecutive groups of equivalent rows in a column.
duplicate_keep_option
Choices for drop_duplicates API for retainment of duplicate rows.
std::unique_ptr< table > distinct(table_view const &input, std::vector< size_type > const &keys, duplicate_keep_option keep=duplicate_keep_option::KEEP_ANY, null_equality nulls_equal=null_equality::EQUAL, nan_equality nans_equal=nan_equality::ALL_EQUAL, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
Create a new table without duplicate rows.
std::unique_ptr< table > apply_boolean_mask(table_view const &input, column_view const &boolean_mask, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
Filters input using boolean_mask of boolean values as a mask.
cudf::size_type distinct_count(column_view const &input, null_policy null_handling, nan_policy nan_handling)
Count the distinct elements in the column_view.
std::unique_ptr< table > drop_nulls(table_view const &input, std::vector< size_type > const &keys, cudf::size_type keep_threshold, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
Filters a table to remove null elements with threshold count.
std::unique_ptr< table > drop_nans(table_view const &input, std::vector< size_type > const &keys, cudf::size_type keep_threshold, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
Filters a table to remove NANs with threshold count.
@ KEEP_ANY
Keep an unspecified occurrence.
@ KEEP_NONE
Keep no (remove all) occurrences of duplicates.
@ KEEP_LAST
Keep last occurrence.
@ KEEP_FIRST
Keep first occurrence.
null_equality
Enum to consider two nulls as equal or unequal.
Definition: types.hpp:135
int32_t size_type
Row index type for columns and tables.
Definition: types.hpp:80
null_policy
Enum to specify whether to include nulls or exclude nulls.
Definition: types.hpp:110
nan_policy
Enum to treat NaN floating point value as null or non-null element.
Definition: types.hpp:118
nan_equality
Enum to consider different elements (of floating point types) holding NaN value as equal or unequal.
Definition: types.hpp:127
@ EQUAL
nulls compare equal
@ ALL_EQUAL
All NaNs compare equal, regardless of sign.
cuDF interfaces
Definition: aggregation.hpp:34
Type declarations for libcudf.