stream_compaction.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/types.hpp>
21 #include <cudf/utilities/export.hpp>
22 
24 #include <rmm/resource_ref.hpp>
25 
26 #include <memory>
27 #include <vector>
28 
29 namespace CUDF_EXPORT cudf {
74 std::unique_ptr<table> drop_nulls(
75  table_view const& input,
76  std::vector<size_type> const& keys,
77  cudf::size_type keep_threshold,
79 
106 std::unique_ptr<table> drop_nulls(
107  table_view const& input,
108  std::vector<size_type> const& keys,
110 
148 std::unique_ptr<table> drop_nans(
149  table_view const& input,
150  std::vector<size_type> const& keys,
151  cudf::size_type keep_threshold,
153 
181 std::unique_ptr<table> drop_nans(
182  table_view const& input,
183  std::vector<size_type> const& keys,
185 
207 std::unique_ptr<table> apply_boolean_mask(
208  table_view const& input,
209  column_view const& boolean_mask,
211 
216  KEEP_ANY = 0,
217  KEEP_FIRST,
218  KEEP_LAST,
219  KEEP_NONE
220 };
221 
249 std::unique_ptr<table> unique(
250  table_view const& input,
251  std::vector<size_type> const& keys,
253  null_equality nulls_equal = null_equality::EQUAL,
255 
275 std::unique_ptr<table> distinct(
276  table_view const& input,
277  std::vector<size_type> const& keys,
278  duplicate_keep_option keep = duplicate_keep_option::KEEP_ANY,
279  null_equality nulls_equal = null_equality::EQUAL,
280  nan_equality nans_equal = nan_equality::ALL_EQUAL,
282 
297 std::unique_ptr<column> distinct_indices(
298  table_view const& input,
299  duplicate_keep_option keep = duplicate_keep_option::KEEP_ANY,
300  null_equality nulls_equal = null_equality::EQUAL,
301  nan_equality nans_equal = nan_equality::ALL_EQUAL,
304 
328 std::unique_ptr<table> stable_distinct(
329  table_view const& input,
330  std::vector<size_type> const& keys,
331  duplicate_keep_option keep = duplicate_keep_option::KEEP_ANY,
332  null_equality nulls_equal = null_equality::EQUAL,
333  nan_equality nans_equal = nan_equality::ALL_EQUAL,
336 
353  null_policy null_handling,
354  nan_policy nan_handling);
355 
366  null_equality nulls_equal = null_equality::EQUAL);
367 
389  null_policy null_handling,
390  nan_policy nan_handling);
391 
402  null_equality nulls_equal = null_equality::EQUAL);
403 
405 } // 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...
A set of cudf::column_view's of the same size.
Definition: table_view.hpp:200
rmm::cuda_stream_view const get_default_stream()
Get the current default stream.
cuda::mr::async_resource_ref< cuda::mr::device_accessible > device_async_resource_ref
device_memory_resource * get_current_device_resource()
std::unique_ptr< table > drop_nans(table_view const &input, std::vector< size_type > const &keys, rmm::device_async_resource_ref mr=rmm::mr::get_current_device_resource())
Filters a table to remove NANs.
std::unique_ptr< table > drop_nulls(table_view const &input, std::vector< size_type > const &keys, rmm::device_async_resource_ref mr=rmm::mr::get_current_device_resource())
Filters a table to remove null elements.
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::device_async_resource_ref mr=rmm::mr::get_current_device_resource())
Create a new table with consecutive duplicate rows removed.
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::device_async_resource_ref 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::device_async_resource_ref mr=rmm::mr::get_current_device_resource())
Filters input using boolean_mask of boolean values as a mask.
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::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=rmm::mr::get_current_device_resource())
Create a new table without duplicate rows, preserving input order.
cudf::size_type distinct_count(table_view const &input, null_equality nulls_equal=null_equality::EQUAL)
Count the distinct rows in a table.
cudf::size_type unique_count(table_view const &input, null_equality nulls_equal=null_equality::EQUAL)
Count the number of consecutive groups of equivalent rows in a table.
std::unique_ptr< column > distinct_indices(table_view const &input, 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::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=rmm::mr::get_current_device_resource())
Create a column of indices of all distinct rows in the input table.
@ 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:151
int32_t size_type
Row index type for columns and tables.
Definition: types.hpp:95
null_policy
Enum to specify whether to include nulls or exclude nulls.
Definition: types.hpp:126
nan_policy
Enum to treat NaN floating point value as null or non-null element.
Definition: types.hpp:134
nan_equality
Enum to consider different elements (of floating point types) holding NaN value as equal or unequal.
Definition: types.hpp:143
cuDF interfaces
Definition: aggregation.hpp:35
Type declarations for libcudf.