文件 | 枚举 | 函数
流式压缩

文件

文件  stream_compaction.hpp
 用于过滤行的列 API。
 

枚举

枚举类  cudf::duplicate_keep_option { cudf::KEEP_ANY = 0 , cudf::KEEP_FIRST , cudf::KEEP_LAST , cudf::KEEP_NONE }
 用于 drop_duplicates API 的选项,指定保留重复行的策略。 更多...
 

函数

std::unique_ptr< tablecudf::drop_nulls (table_view const &input, std::vector< size_type > const &keys, cudf::size_type keep_threshold, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
 按阈值计数过滤表以移除 null 元素。 更多...
 
std::unique_ptr< tablecudf::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())
 过滤表以移除 null 元素。 更多...
 
std::unique_ptr< tablecudf::drop_nans (table_view const &input, std::vector< size_type > const &keys, cudf::size_type keep_threshold, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
 按阈值计数过滤表以移除 NaN。 更多...
 
std::unique_ptr< tablecudf::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())
 过滤表以移除 NaN。 更多...
 
std::unique_ptr< tablecudf::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())
 使用布尔值组成的 boolean_mask 作为掩码过滤 input更多...
 
std::unique_ptr< tablecudf::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())
 创建一个移除连续重复行的新表。 更多...
 
std::unique_ptr< tablecudf::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())
 创建一个不含重复行的新表。 更多...
 
std::unique_ptr< columncudf::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())
 创建一个包含输入表中所有唯一行索引的列。 更多...
 
std::unique_ptr< tablecudf::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())
 创建一个不含重复行且保留输入顺序的新表。 更多...
 
cudf::size_type cudf::unique_count (column_view const &input, null_policy null_handling, nan_policy nan_handling, rmm::cuda_stream_view stream=cudf::get_default_stream())
 计算列中连续等效行的组数。 更多...
 
cudf::size_type cudf::unique_count (table_view const &input, null_equality nulls_equal=null_equality::EQUAL, rmm::cuda_stream_view stream=cudf::get_default_stream())
 计算表中连续等效行的组数。 更多...
 
cudf::size_type cudf::distinct_count (column_view const &input, null_policy null_handling, nan_policy nan_handling, rmm::cuda_stream_view stream=cudf::get_default_stream())
 计算 column_view 中的唯一元素数量。 更多...
 
cudf::size_type cudf::distinct_count (table_view const &input, null_equality nulls_equal=null_equality::EQUAL, rmm::cuda_stream_view stream=cudf::get_default_stream())
 计算表中的唯一行数量。 更多...
 

详细描述

枚举类型文档

◆ duplicate_keep_option

用于 drop_duplicates API 的选项,指定保留重复行的策略。

枚举成员
KEEP_ANY 

保留任意一个出现。

KEEP_FIRST 

保留第一个出现。

KEEP_LAST 

保留最后一个出现。

KEEP_NONE 

不保留(移除所有)重复出现。

定义于文件 stream_compaction.hpp 的第 223 行。

函数文档

◆ apply_boolean_mask()

std::unique_ptr<table> cudf::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() 
)

使用布尔值组成的 boolean_mask 作为掩码过滤 input

给定一个输入 table_view 和一个掩码 column_view,如果掩码中的对应元素 i 非空且为 true,则将输入中每个 column_view 的元素 i 复制到相应的输出列。此操作是稳定的:保留输入顺序。

注意
如果 input.num_rows() 为零,则不会出错,并返回一个空表。
异常
cudf::logic_error如果 input.num_rows() != boolean_mask.size()
cudf::logic_error如果 boolean_mask 不是 type_id::BOOL8 类型。
参数
[in]input要过滤的输入 table_view
[in]boolean_mask一个类型为 type_id::BOOL8 的可空 column_view,用作过滤 input 的掩码。
[in]stream用于设备内存操作和内核启动的 CUDA 流
[in]mr用于分配返回表的设备内存的设备内存资源
返回
包含通过 boolean_mask 定义的过滤器过滤后的 input 所有行的副本的表。

◆ distinct()

创建一个不含重复行的新表。

给定一个输入 table_view,将每行复制到输出表中以创建一组唯一的行。如果存在重复行,复制哪一行取决于 keep 参数。

输出表中的行顺序未指定。

性能提示:如果输入已预排序,cudf::unique 可以产生等效结果(即相同的输出行集),但运行时间比 cudf::distinct 少。

参数
input输入表
keys向量,指示输入表中的关键列索引
keep复制找到的重复项中的任意一个、第一个、最后一个或不复制
nulls_equal标志,指定是否应将 null 元素视为相等
nans_equal标志,指定是否应将 NaN 元素视为相等
stream用于设备内存操作和内核启动的 CUDA 流
mr用于分配返回表的设备内存资源
返回
包含唯一行且顺序未指定的表

◆ distinct_count() [1/2]

cudf::size_type cudf::distinct_count ( column_view const &  input,
null_policy  null_handling,
nan_policy  nan_handling,
rmm::cuda_stream_view  stream = cudf::get_default_stream() 
)

计算 column_view 中的唯一元素数量。

如果 nulls_equal == nulls_equal::UNEQUAL,则所有 null 都是唯一的。

给定一个输入 column_view,返回此 column_view 中唯一元素的数量。

如果 null_handlingnull_policy::EXCLUDEnan_handlingnan_policy::NAN_IS_NULL,则 NaNnull 值都会被忽略。如果 null_handlingnull_policy::EXCLUDEnan_handlingnan_policy::NAN_IS_VALID,则只忽略 nullNaN 会被计入唯一计数。

null 被视为相等处理。

参数
[in]input将计算其唯一元素的 column_view
[in]null_handling计数时包含或忽略 null 的标志
[in]nan_handling标志,指示是否将 NaN 视为 null 相等
[in]stream用于设备内存操作和内核启动的 CUDA 流
返回
表中的唯一行数

◆ distinct_count() [2/2]

cudf::size_type cudf::distinct_count ( table_view const &  input,
null_equality  nulls_equal = null_equality::EQUAL,
rmm::cuda_stream_view  stream = cudf::get_default_stream() 
)

计算表中的唯一行数量。

参数
[in]input将计算其唯一行的表
[in]nulls_equal标志,表示是否应将 null 元素视为相等。如果 null_equality::UNEQUAL,则 null 不相等。
[in]stream用于设备内存操作和内核启动的 CUDA 流
返回
表中的唯一行数

◆ distinct_indices()

创建一个包含输入表中所有唯一行索引的列。

给定一个输入 table_view,生成一个包含所有唯一行索引的输出向量。如果存在重复行,保留哪个索引取决于 keep 参数。

参数
input输入表
keep获取找到的重复项中的任意一个、第一个、最后一个或不获取的索引
nulls_equal标志,指定是否应将 null 元素视为相等
nans_equal标志,指定是否应将 NaN 元素视为相等
stream用于设备内存操作和内核启动的 CUDA 流
mr用于分配返回向量的设备内存资源
返回
包含结果索引的列

◆ drop_nans() [1/2]

std::unique_ptr<table> cudf::drop_nans ( table_view const &  input,
std::vector< size_type > const &  keys,
cudf::size_type  keep_threshold,
rmm::cuda_stream_view  stream = cudf::get_default_stream(),
rmm::device_async_resource_ref  mr = cudf::get_current_device_resource_ref() 
)

按阈值计数过滤表以移除 NaN。

过滤 input 的行,考虑 keys 中指定的列中的 NaN。这些关键列必须是浮点类型。

给定一个输入 table_view,如果 keys 的同一行 i 中至少有 keep_threshold 个非 NaN 元素,则将输入列中的行 i 复制到输出中。

此操作是稳定的:输入顺序在输出中得到保留。

input {col1: {1.0, 2.0, 3.0, NAN},
col2: {4.0, null, NAN, NAN},
col3: {7.0, NAN, NAN, NAN}}
keys = {0, 1, 2} // 所有列
keep_threshold = 2
output {col1: {1.0, 2.0}
col2: {4.0, null}
col3: {7.0, NAN}}
注意
如果 input.num_rows() 为零,或者 keys 为空,则不会出错,并返回一个空 table
异常
cudf::logic_error如果 keys 列不是浮点类型。
参数
[in]input要过滤的输入 table_view
[in]keys表示 input 中关键列索引的向量
[in]keep_threshold保留一行所需的非 NaN 元素的最小数量。
[in]stream用于设备内存操作和内核启动的 CUDA 流
[in]mr用于分配返回表的设备内存的设备内存资源
返回
包含 input 中所有行,其中 keys 中至少有 keep_threshold 个非 NaN 元素的表。

◆ drop_nans() [2/2]

std::unique_ptr<table> cudf::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() 
)

过滤表以移除 NaN。

过滤 input 的行,考虑 keys 中指定的列中的 NaN。这些关键列必须是浮点类型。

input {col1: {1.0, 2.0, 3.0, NAN},
col2: {4.0, null, NAN, NAN},
col3: {null, NAN, NAN, NAN}}
keys = {0, 1, 2} // 所有列
keep_threshold = 2
output {col1: {1.0}
col2: {4.0}
col3: {null}}

drop_nans 相同,但默认将 keep_threshold 设置为 keys 中的列数。

参数
[in]input要过滤的输入 table_view
[in]keys表示 input 中关键列索引的向量
[in]stream用于设备内存操作和内核启动的 CUDA 流
[in]mr用于分配返回表的设备内存的设备内存资源
返回
包含 input 中所有行,其中 keys 的列中不含 NaN 的表。

◆ drop_nulls() [1/2]

std::unique_ptr<table> cudf::drop_nulls ( table_view const &  input,
std::vector< size_type > const &  keys,
cudf::size_type  keep_threshold,
rmm::cuda_stream_view  stream = cudf::get_default_stream(),
rmm::device_async_resource_ref  mr = cudf::get_current_device_resource_ref() 
)

按阈值计数过滤表以移除 null 元素。

过滤 input 的行,考虑 keys 中指定的列的有效性/null 值。

给定一个输入 table_view,如果 keys 的同一行 i 中至少有 keep_threshold 个非 null 字段,则将输入列中的行 i 复制到输出中。

此操作是稳定的:输入顺序在输出中得到保留。

输入中的任何不可为空列都被视为全部非 null。

input {col1: {1, 2, 3, null},
col2: {4, 5, null, null},
col3: {7, null, null, null}}
keys = {0, 1, 2} // 所有列
keep_threshold = 2
output {col1: {1, 2}
col2: {4, 5}
col3: {7, null}}
注意
如果 input.num_rows() 为零,或者 keys 为空或不含 null,则不会出错,并返回一个空 table
参数
[in]input要过滤的输入 table_view
[in]keys表示 input 中关键列索引的向量
[in]keep_threshold保留一行所需的非 null 字段的最小数量。
[in]stream用于设备内存操作和内核启动的 CUDA 流
[in]mr用于分配返回表的设备内存的设备内存资源
返回
包含 input 中所有行,其中 keys 中至少有 keep_threshold 个非 null 字段的表。

◆ drop_nulls() [2/2]

std::unique_ptr<table> cudf::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() 
)

过滤表以移除 null 元素。

过滤 input 的行,考虑 keys 中指定的列的有效性/null 值。

input {col1: {1, 2, 3, null},
col2: {4, 5, null, null},
col3: {7, null, null, null}}
keys = {0, 1, 2} // 所有列
output {col1: {1}
col2: {4}
col3: {7}}

drop_nulls 相同,但默认将 keep_threshold 设置为 keys 中的列数。

参数
[in]input要过滤的输入 table_view
[in]keys表示 input 中关键列索引的向量
[in]stream用于设备内存操作和内核启动的 CUDA 流
[in]mr用于分配返回表的设备内存的设备内存资源
返回
包含 input 中所有行,其中 keys 的列中不含 null 的表。

◆ stable_distinct()

std::unique_ptr<table> cudf::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() 
)

创建一个不含重复行且保留输入顺序的新表。

给定一个输入 table_view,将每行复制到输出表中以创建一组唯一的行。保留输入行顺序。如果存在重复行,复制哪一行取决于 keep 参数。

此 API 生成的输出行与 cudf::distinct 相同,但保留了输入顺序。

请注意,当 keepKEEP_ANY 时,保留哪个重复行是任意的,但返回的表将保留输入顺序。也就是说,如果关键列包含 1, 2, 1,另一值列包含 3, 4, 5,结果可能包含值 3, 44, 5,但不会是 4, 35, 4

参数
input输入表
keys向量,指示输入表中的关键列索引
keep复制找到的重复项中的任意一个、第一个、最后一个或不复制
nulls_equal标志,指定是否应将 null 元素视为相等
nans_equal标志,指定是否应将 NaN 元素视为相等
stream用于设备内存操作和内核启动的 CUDA 流。
mr用于分配返回表的设备内存资源
返回
包含唯一行且保留输入顺序的表

◆ unique()

std::unique_ptr<table> cudf::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() 
)

创建一个移除连续重复行的新表。

给定一个输入 table_view,将每行复制到输出表中以创建一组唯一的行。如果存在重复行,复制哪一行取决于 keep 参数。

输出表中的行顺序与输入相同。

如果表中没有等效的行,则该行为“distinct”(唯一)。如果该行没有相邻的等效行,则该行为“unique”(独有,指连续不重复)。也就是说,保留 distinct 行会移除表/列中的所有重复项,而保留 unique 行仅移除连续分组中的重复项。

性能提示:如果输入已预排序,cudf::unique 可以产生等效结果(即相同的输出行集),但运行时间比 cudf::distinct 少。

异常
cudf::logic_error如果 keys 列索引超出输入表的范围。
参数
[in]input只复制独有行的输入 table_view
[in]keys表示 input 中关键列索引的向量
[in]keep保留找到的重复项中的任意一个、第一个、最后一个或不保留
[in]nulls_equal标志,表示如果 null_equality::EQUAL 则 null 相等,如果 null_equality::UNEQUAL 则 null 不相等
[in]stream用于设备内存操作和内核启动的 CUDA 流
[in]mr用于分配返回表的设备内存的设备内存资源
返回
包含根据 keep 指定的每个等效行序列中的独有行的表

◆ unique_count() [1/2]

cudf::size_type cudf::unique_count ( column_view const &  input,
null_policy  null_handling,
nan_policy  nan_handling,
rmm::cuda_stream_view  stream = cudf::get_default_stream() 
)

计算列中连续等效行的组数。

如果 null_handlingnull_policy::EXCLUDEnan_handlingnan_policy::NAN_IS_NULL,则 NaNnull 值都会被忽略。如果 null_handlingnull_policy::EXCLUDEnan_handlingnan_policy::NAN_IS_VALID,则只忽略 nullNaN 会被计入计数。

null 被视为相等处理。

参数
[in]input将计算其连续等效行组数的 column_view
[in]null_handling计数时包含或忽略 null 的标志
[in]nan_handling标志,指示是否将 NaN 视为 null 相等
[in]stream用于设备内存操作和内核启动的 CUDA 流
返回
列中连续等效行的组数

◆ unique_count() [2/2]

cudf::size_type cudf::unique_count ( table_view const &  input,
null_equality  nulls_equal = null_equality::EQUAL,
rmm::cuda_stream_view  stream = cudf::get_default_stream() 
)

计算表中连续等效行的组数。

参数
[in]input将计算其连续等效行组数的表
[in]nulls_equal标志,表示是否应将 null 元素视为相等。如果 null_equality::UNEQUAL,则 null 不相等。
[in]stream用于设备内存操作和内核启动的 CUDA 流
返回
列中连续等效行的组数