stream_compaction.hpp
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2019-2025, NVIDIA CORPORATION.
3  * SPDX-License-Identifier: Apache-2.0
4  */
5 
6 #pragma once
7 
8 #include <cudf/types.hpp>
10 #include <cudf/utilities/export.hpp>
12 
13 #include <memory>
14 #include <optional>
15 #include <vector>
16 
17 namespace CUDF_EXPORT cudf {
25 namespace ast {
26 class expression;
27 }
28 
67 std::unique_ptr<table> drop_nulls(
68  table_view const& input,
69  std::vector<size_type> const& keys,
70  cudf::size_type keep_threshold,
73 
101 std::unique_ptr<table> drop_nulls(
102  table_view const& input,
103  std::vector<size_type> const& keys,
106 
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,
151 
180 std::unique_ptr<table> drop_nans(
181  table_view const& input,
182  std::vector<size_type> const& keys,
185 
208 std::unique_ptr<table> apply_boolean_mask(
209  table_view const& input,
210  column_view const& boolean_mask,
213 
218  KEEP_ANY = 0,
219  KEEP_FIRST,
220  KEEP_LAST,
221  KEEP_NONE
222 };
223 
252 std::unique_ptr<table> unique(
253  table_view const& input,
254  std::vector<size_type> const& keys,
256  null_equality nulls_equal = null_equality::EQUAL,
259 
280 std::unique_ptr<table> distinct(
281  table_view const& input,
282  std::vector<size_type> const& keys,
283  duplicate_keep_option keep = duplicate_keep_option::KEEP_ANY,
284  null_equality nulls_equal = null_equality::EQUAL,
285  nan_equality nans_equal = nan_equality::ALL_EQUAL,
288 
303 std::unique_ptr<column> distinct_indices(
304  table_view const& input,
305  duplicate_keep_option keep = duplicate_keep_option::KEEP_ANY,
306  null_equality nulls_equal = null_equality::EQUAL,
307  nan_equality nans_equal = nan_equality::ALL_EQUAL,
310 
334 std::unique_ptr<table> stable_distinct(
335  table_view const& input,
336  std::vector<size_type> const& keys,
337  duplicate_keep_option keep = duplicate_keep_option::KEEP_ANY,
338  null_equality nulls_equal = null_equality::EQUAL,
339  nan_equality nans_equal = nan_equality::ALL_EQUAL,
342 
360  null_policy null_handling,
361  nan_policy nan_handling,
363 
375  null_equality nulls_equal = null_equality::EQUAL,
377 
400  null_policy null_handling,
401  nan_policy nan_handling,
403 
415  null_equality nulls_equal = null_equality::EQUAL,
417 
451 std::vector<std::unique_ptr<column>> filter(
452  std::vector<column_view> const& predicate_columns,
453  std::string const& predicate_udf,
454  std::vector<column_view> const& filter_columns,
455  bool is_ptx,
456  std::optional<void*> user_data = std::nullopt,
457  null_aware is_null_aware = null_aware::NO,
460 
481 std::unique_ptr<table> filter(
482  table_view const& predicate_table,
483  ast::expression const& predicate_expr,
484  table_view const& filter_table,
487 
489 } // 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:189
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.
detail::cccl_async_resource_ref< cuda::mr::resource_ref< cuda::mr::device_accessible > > device_async_resource_ref
std::unique_ptr< table > filter(table_view const &predicate_table, ast::expression const &predicate_expr, table_view const &filter_table, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
Creates new table by applying a filter function against every element of the input columns.
std::unique_ptr< table > drop_nulls(table_view const &input, std::vector< size_type > const &keys, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
Filters a table to remove null elements.
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=cudf::get_current_device_resource_ref())
Create a column of indices of all distinct rows in the input table.
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::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
Create a new table with consecutive duplicate rows removed.
std::unique_ptr< table > drop_nans(table_view const &input, std::vector< size_type > const &keys, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
Filters a table to remove NANs.
duplicate_keep_option
Choices for drop_duplicates API for retainment of duplicate rows.
std::unique_ptr< table > apply_boolean_mask(table_view const &input, column_view const &boolean_mask, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
Filters input using boolean_mask of boolean values as a mask.
cudf::size_type distinct_count(table_view const &input, null_equality nulls_equal=null_equality::EQUAL, rmm::cuda_stream_view stream=cudf::get_default_stream())
Count the distinct rows in a table.
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=cudf::get_current_device_resource_ref())
Create a new table without duplicate rows, preserving input order.
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::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
Create a new table without duplicate rows.
cudf::size_type unique_count(table_view const &input, null_equality nulls_equal=null_equality::EQUAL, rmm::cuda_stream_view stream=cudf::get_default_stream())
Count the number of consecutive groups of equivalent rows in a 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:140
int32_t size_type
Row index type for columns and tables.
Definition: types.hpp:84
null_policy
Enum to specify whether to include nulls or exclude nulls.
Definition: types.hpp:115
null_aware
Indicates whether a function is null-aware or not.
Definition: types.hpp:227
nan_policy
Enum to treat NaN floating point value as null or non-null element.
Definition: types.hpp:123
nan_equality
Enum to consider different elements (of floating point types) holding NaN value as equal or unequal.
Definition: types.hpp:132
cuDF interfaces
Definition: host_udf.hpp:26
A generic expression that can be evaluated to return a value.
Definition: expressions.hpp:61
Type declarations for libcudf.