实用类型#
- group utility_types
定义
-
CUDF_ENABLE_IF(...)#
作为未命名模板参数的SFINAE便利宏。
示例:
// This function will participate in overload resolution only if T is an integral type template <typename T, CUDF_ENABLE_IF(std::is_integral_v<T> )> void foo();
类型定义
-
using size_type = int32_t#
行索引类型用于列和表。
-
using bitmask_type = uint32_t#
位掩码类型存储为32位无符号整数。
-
using valid_type = uint8_t#
主机内存中的有效类型。
-
using thread_index_type = int64_t#
内核中的线程索引类型。
-
typedef uint32_t char_utf8#
UTF-8 字符占用 1-4 个字节。
-
template<typename...>
using void_t = void# 实用元函数,将任何类型的序列映射到void类型。
-
template<typename L, typename R>
using less_comparable = decltype(std::declval<L>() < std::declval<R>())# 检查两种类型是否可以使用小于运算符进行比较(即 <)。
-
template<typename L, typename R>
using greater_comparable = decltype(std::declval<L>() > std::declval<R>())# 检查两种类型是否可以使用大于运算符进行比较(即 >)。
-
template<typename L, typename R>
using equality_comparable = decltype(std::declval<L>() == std::declval<R>())# 检查两种类型是否可以使用相等运算符(即 ==)进行比较。
-
template<typename ...Ts>
using has_common_type = typename detail::has_common_type_impl<void, Ts...>::type# 检查类型是否具有共同类型。
-
template<typename T>
using is_timestamp_t = cuda::std::disjunction<std::is_same<cudf::timestamp_D, T>, std::is_same<cudf::timestamp_s, T>, std::is_same<cudf::timestamp_ms, T>, std::is_same<cudf::timestamp_us, T>, std::is_same<cudf::timestamp_ns, T>># 检查类型是否为时间戳类型。
-
template<typename T>
using is_duration_t = cuda::std::disjunction<std::is_same<cudf::duration_D, T>, std::is_same<cudf::duration_s, T>, std::is_same<cudf::duration_ms, T>, std::is_same<cudf::duration_us, T>, std::is_same<cudf::duration_ns, T>># 检查类型是否为持续时间类型。
枚举
-
enum class order : bool#
指示元素应按何种顺序排序。
值:
-
enumerator ASCENDING#
元素按从小到大排序。
-
enumerator DESCENDING#
元素按从大到小排序。
-
enumerator ASCENDING#
-
enum class null_policy : bool#
枚举用于指定是包含空值还是排除空值。
值:
-
enumerator EXCLUDE#
排除空元素
-
enumerator INCLUDE#
包含空元素
-
enumerator EXCLUDE#
-
enum class nan_policy : bool#
枚举将NaN浮点值视为空或非空元素。
值:
-
enumerator NAN_IS_NULL#
将nans视为空元素
-
enumerator NAN_IS_VALID#
将nans视为有效元素(非空)
-
enumerator NAN_IS_NULL#
-
enum class nan_equality#
枚举以考虑将持有NaN值的不同元素(浮点类型)视为相等或不相等。
值:
-
enumerator ALL_EQUAL#
所有的NaN值在比较时被视为相等,无论符号如何。
-
enumerator UNEQUAL#
所有NaN比较不相等(IEEE754行为)
-
enumerator ALL_EQUAL#
-
enum class null_equality : bool#
枚举以考虑两个空值是否相等或不相等。
值:
-
enumerator EQUAL#
空值比较相等
-
enumerator UNEQUAL#
空值比较不相等
-
enumerator EQUAL#
-
enum class null_order : bool#
指示空值如何与所有其他值进行比较。
值:
-
enumerator AFTER#
NULL值在所有其他值之后排序。
-
enumerator BEFORE#
NULL值在所有其他值之前排序。
-
enumerator AFTER#
-
enum class mask_state : int32_t#
控制空掩码的分配/初始化。
值:
-
enumerator UNALLOCATED#
未分配空掩码,(所有元素均有效)
-
enumerator UNINITIALIZED#
空掩码已分配,但未初始化。
-
enumerator ALL_VALID#
空掩码已分配,初始化为所有元素有效。
-
enumerator ALL_NULL#
空掩码已分配,初始化为所有元素为空。
-
enumerator UNALLOCATED#
-
enum class interpolation : int32_t#
当所需的分位数位于两个数据点i和j之间时使用的插值方法。
值:
-
enumerator LINEAR#
在i和j之间进行线性插值。
-
enumerator LOWER#
较低的数据点 (i)
-
enumerator HIGHER#
更高的数据点 (j)
-
enumerator MIDPOINT#
(i + j)/2
-
enumerator NEAREST#
i 或 j,取最接近的那个
-
enumerator LINEAR#
-
enum class type_id : int32_t#
标识列的逻辑元素类型。
值:
-
enumerator EMPTY#
始终为空,没有基础数据。
-
enumerator INT8#
1 字节有符号整数
-
enumerator INT16#
2字节有符号整数
-
enumerator INT32#
4字节有符号整数
-
enumerator INT64#
8字节有符号整数
-
enumerator UINT8#
1 字节无符号整数
-
enumerator UINT16#
2字节无符号整数
-
enumerator UINT32#
4字节无符号整数
-
enumerator UINT64#
8字节无符号整数
-
enumerator FLOAT32#
4字节浮点数
-
enumerator FLOAT64#
8字节浮点数
-
enumerator BOOL8#
布尔值每个值使用一个字节,0 == 假,其他为真。
-
enumerator TIMESTAMP_DAYS#
自Unix纪元以来的天数,以int32表示
-
enumerator TIMESTAMP_SECONDS#
自Unix纪元以来的时间点,以秒为单位,类型为int64
-
enumerator TIMESTAMP_MILLISECONDS#
自Unix纪元以来的时间点,以毫秒为单位,类型为int64
-
enumerator TIMESTAMP_MICROSECONDS#
自Unix纪元以来的微秒时间点,以int64表示
-
enumerator TIMESTAMP_NANOSECONDS#
自Unix纪元以来的纳秒时间点,以int64表示
-
enumerator DURATION_DAYS#
时间间隔,以天为单位,数据类型为int32
-
enumerator DURATION_SECONDS#
时间间隔,以秒为单位,类型为int64
-
enumerator DURATION_MILLISECONDS#
以int64表示的毫秒时间间隔
-
enumerator DURATION_MICROSECONDS#
以int64表示的微秒时间间隔
-
enumerator DURATION_NANOSECONDS#
以int64表示的纳秒时间间隔
-
enumerator DICTIONARY32#
使用int32索引的字典类型。
-
enumerator STRING#
字符串元素。
-
enumerator LIST#
列出元素。
-
enumerator DECIMAL32#
使用int32_t的定点类型。
-
enumerator DECIMAL64#
使用 int64_t 的定点类型。
-
enumerator DECIMAL128#
使用 __int128_t 的定点类型。
-
enumerator STRUCT#
结构元素。
-
enumerator NUM_TYPE_IDS#
类型ID的总数。
-
enumerator EMPTY#
函数
-
template<typename T>
size_type distance(T f, T l)# 类似于
std::distance但返回cudf::size_type并执行static_cast- Template Parameters:
T – 迭代器类型
- Parameters:
f – “第一个”迭代器
l – “最后”迭代器
- Returns:
第一个和最后一个之间的距离
-
constexpr bool operator==(data_type const &lhs, data_type const &rhs)#
比较两个
data_type对象是否相等。// TODO 准确定义两个
data_type相等意味着什么。例如,具有不同分辨率的时间戳是否相等?具有不同比例/精度的十进制数又如何?
-
inline bool operator!=(data_type const &lhs, data_type const &rhs)#
比较两个
data_type对象是否不相等。// TODO 准确定义两个
data_type相等意味着什么。例如,具有不同分辨率的时间戳是否相等?具有不同比例/精度的十进制数又如何?
-
std::size_t size_of(data_type t)#
返回指定
data_type元素的大小(以字节为单位)注意
仅支持固定宽度类型
- Throws:
cudf::logic_error – 如果
is_fixed_width(element_type) == false- Parameters:
t – 要获取大小的
data_type- Returns:
指定
data_type元素的大小(以字节为单位)
-
template<typename T>
inline constexpr bool has_atomic_support()# 指示类型
T是否支持原子操作。- Template Parameters:
T – 要验证的类型
- Returns:
true
T支持原子操作- Returns:
false
T不支持原子操作
-
inline constexpr bool has_atomic_support(data_type type)#
指示
type是否支持原子操作。- Parameters:
type – 要验证的
data_type- Returns:
true
type支持原子操作- Returns:
false
type不支持原子操作
-
template<typename L, typename R>
inline constexpr bool is_relationally_comparable()# 指示类型为
L和R的对象是否可以进行关系比较。给定两个对象
L l和R r,如果l < r和l > r是合法的表达式,则返回 true。- Template Parameters:
L – 第一个对象的类型
R – 第二个对象的类型
- Returns:
true 类型为
L和R的对象可以进行关系比较- Returns:
false 类型为
L和R的对象无法进行比较
-
bool is_relationally_comparable(data_type type)#
检查
data_typetype是否支持关系比较。- Parameters:
type – 用于比较的数据类型。
- Returns:
如果
type支持关系比较,则为 true。- Returns:
如果
type不支持关系比较,则为 false。
-
template<typename L, typename R>
inline constexpr bool is_equality_comparable()# 指示类型为
L和R的对象是否可以进行比较以判断是否相等。给定两个对象
L l和R r,如果l == r是一个格式良好的表达式,则返回 true。- Template Parameters:
L – 第一个对象的类型
R – 第二个对象的类型
- Returns:
true 类型为
L和R的对象可以进行比较以判断是否相等- Returns:
false 类型为
L和R的对象无法进行比较
-
bool is_equality_comparable(data_type type)#
检查
data_typetype是否支持相等比较。- Parameters:
type – 用于比较的数据类型。
- Returns:
如果
type支持相等比较,则为 true。- Returns:
false 如果
type不支持相等比较。
-
template<typename T>
inline constexpr bool is_numeric()# 表示类型
T是否为数值类型。- Template Parameters:
T – 要验证的类型
- Returns:
true
T是数值类型- Returns:
false
T不是数字
-
bool is_numeric(data_type type)#
指示
type是否为数值型data_type。“数值”类型是基本的整数/浮点类型,例如
INT*或FLOAT*。包装数值类型的类型不被视为数值类型,例如TIMESTAMP。- Parameters:
type – 要验证的
data_type- Returns:
true
type是数值型- Returns:
false
type不是数字类型
-
template<typename T>
inline constexpr bool is_index_type()# 指示类型
T是否为索引类型。如果可以使用类型
T的元素来索引列,则类型T被视为索引类型。即,索引类型是除 'bool' 之外的整型类型,如 'INT*'。- Template Parameters:
T – 要验证的类型
- Returns:
true
T是索引类型- Returns:
false
T不是索引类型
-
bool is_index_type(data_type type)#
指示类型
type是否为索引类型。如果可以使用类型
T的元素来索引列,则类型T被视为索引类型。即,索引类型是除了 'bool' 之外的整型类型,例如 'INT*'。- Parameters:
type – 要验证的
data_type- Returns:
true
type是索引类型- Returns:
false
type不是索引类型
-
template<typename T>
inline constexpr bool is_unsigned()# 指示类型
T是否为无符号数字类型。- Template Parameters:
T – 要验证的类型
- Returns:
true
T是无符号数字- Returns:
false
T是有符号数字
-
bool is_unsigned(data_type type)#
指示
type是否为无符号数字data_type。“无符号数字”类型是基本的整数类型,例如
UINT*。- Parameters:
type – 要验证的
data_type- Returns:
true
type是无符号数字类型- Returns:
false
type是有符号数字类型
-
template<typename Iterator>
inline constexpr bool is_signed_iterator()# 指示
Iterator值类型是否为无符号。- Template Parameters:
Iterator – 要验证的类型
- Returns:
如果迭代器的值类型是无符号的,则为true
-
template<typename T>
inline constexpr bool is_integral()# 指示类型
T是否为整数类型。- Template Parameters:
T – 要验证的类型
- Returns:
true
T是整数- Returns:
false
T不是整数
-
bool is_integral(data_type type)#
指示
type是否为整数data_type。“整数”类型是基本的整数类型,例如
INT*和UINT*。- Parameters:
type – 要验证的
data_type- Returns:
true
type是整数类型- Returns:
false
type是整数类型
-
template<typename T>
inline constexpr bool is_integral_not_bool()# 指示类型
T是否为整数类型但不是布尔类型。- Template Parameters:
T – 要验证的类型
- Returns:
true
T是整数类型但不是布尔类型- Returns:
false
T不是整数类型或是布尔类型
-
bool is_integral_not_bool(data_type type)#
指示
type是否为整数data_type且不是BOOL8。“整数”类型是基本的整数类型,例如
INT*和UINT*。- Parameters:
type – 要验证的
data_type- Returns:
true
type是整数类型但不是布尔类型- Returns:
false
type是整数类型或是布尔类型
-
template<typename T>
inline constexpr bool is_numeric_not_bool()# 指示类型
T是否为数值类型但不是布尔类型。- Template Parameters:
T – 要验证的类型
- Returns:
true
T是数字类型但不是布尔类型- Returns:
false
T不是数字或为布尔值
-
bool is_numeric_not_bool(data_type type)#
指示
type是否为数值型data_type,但不包括BOOL8。“数值”类型是整数/浮点类型,例如
INT*或FLOAT*。- Parameters:
type – 要验证的
data_type- Returns:
true
type是数字类型但不是布尔类型- Returns:
false
type不是数字类型或是布尔类型
-
template<typename T>
inline constexpr bool is_floating_point()# 表示类型
T是否为浮点类型。- Template Parameters:
T – 要验证的类型
- Returns:
true
T是浮点数- Returns:
false
T不是浮点数
-
bool is_floating_point(data_type type)#
指示
type是否为浮点data_type。“浮点”类型是基本的浮点类型,例如
FLOAT*。- Parameters:
type – 要验证的
data_type- Returns:
true
type是浮点类型- Returns:
false
type不是浮点类型
-
template<typename T>
inline constexpr bool is_byte()# 指示
T是否为std::byte类型。- Template Parameters:
T – 要验证的类型
- Returns:
true
type是 std::byte- Returns:
false
type不是 std::byte
-
template<typename T>
inline constexpr bool is_boolean()# 指示
T是否为布尔类型。- Parameters:
type – 要验证的
data_type- Returns:
true
type是布尔类型- Returns:
false
type不是布尔类型
-
bool is_boolean(data_type type)#
指示
type是否为布尔data_type。- Parameters:
type – 要验证的
data_type- Returns:
true
type是一个布尔值- Returns:
false
type不是一个布尔值
-
template<typename T>
inline constexpr bool is_timestamp()# 表示类型
T是否为时间戳类型。- Template Parameters:
T – 要验证的类型
- Returns:
true
T是一个时间戳- Returns:
false
T不是一个时间戳
-
bool is_timestamp(data_type type)#
指示
type是否为时间戳data_type。“Timestamp” 类型是自 Unix 纪元以来的 int32_t 或 int64_t 持续时间。
- Parameters:
type – 要验证的
data_type- Returns:
true
type是一个时间戳- Returns:
false
type不是一个时间戳
-
template<typename T>
inline constexpr bool is_fixed_point()# 指示类型
T是否为定点类型。- Template Parameters:
T – 要验证的类型
- Returns:
true
T是一个定点类型- Returns:
false
T不是一个定点类型
-
bool is_fixed_point(data_type type)#
指示
type是否为固定点data_type。- Parameters:
type – 要验证的
data_type- Returns:
true
type是一个定点类型- Returns:
false
type不是定点类型
-
template<typename T>
inline constexpr bool is_duration()# 指示类型
T是否为持续时间类型。- Template Parameters:
T – 要验证的类型
- Returns:
true
T是一个持续时间- Returns:
false
T不是一个持续时间
-
bool is_duration(data_type type)#
指示
type是否为持续时间data_type。“Duration” 类型是 int32_t 或 int64_t 的 tick 计数,表示一个时间间隔。
- Parameters:
type – 要验证的
data_type- Returns:
true
type是一个持续时间- Returns:
false
type不是一个持续时间
-
template<typename T>
inline constexpr bool is_chrono()# 指示类型
T是否为时间类型。- Template Parameters:
T – 要验证的类型
- Returns:
true
T是一个持续时间或时间戳类型- Returns:
false
T既不是持续时间类型也不是时间戳类型
-
bool is_chrono(data_type type)#
指示
type是否为时间序列data_type。Chrono类型包括cudf时间戳类型,它表示一个时间点,以及cudf持续时间类型,它表示一个时间间隔。
- Parameters:
type – 要验证的
data_type- Returns:
true
type是一个时间类型- Returns:
false
type不是时间类型
-
template<typename T>
constexpr bool is_rep_layout_compatible()# 指示
T是否与其“表示”类型布局兼容。例如,在一列中,
decimal32具体由一个int32_t表示,但decimal32类型本身包含整数表示和比例。因此,decimal32不 与int32_t布局兼容。作为进一步的例子,
duration_ns与其具体的int64_t表示类型不同,但它们在布局上是兼容的。- Returns:
如果
T与其“表示”类型布局兼容,则为 true
-
template<typename T>
inline constexpr bool is_dictionary()# 指示类型
T是否为字典类型。- Template Parameters:
T – 要验证的类型
- Returns:
true
T是一个字典类型- Returns:
false
T不是字典类型
-
bool is_dictionary(data_type type)#
指示
type是否为字典data_type。- Parameters:
type – 要验证的
data_type- Returns:
true
type是一个字典类型- Returns:
false
type不是字典类型
-
template<typename T>
inline constexpr bool is_fixed_width()# 指示类型为
T的元素是否为固定宽度。固定宽度类型的元素在字节大小上都是相同的。
- Template Parameters:
T – 要验证的C++类型
- Returns:
true
T对应于一个固定宽度的元素类型- Returns:
false
T对应一个可变宽度的元素类型
-
bool is_fixed_width(data_type type)#
指示
type的元素是否为固定宽度。固定宽度类型的元素在字节大小上都是相同的。
- Parameters:
type – 要验证的
data_type- Returns:
true
type是固定宽度的- Returns:
false
type是可变宽度的
-
template<typename T>
inline constexpr bool is_compound()# 指示类型
T是否为复合类型。columns 带有“复合”元素的列在逻辑上是单个元素列,但可能具体实现为两个或更多columns。例如,一个STRING列可能包含一个偏移量的column和一个字符的子column。- Template Parameters:
T – 要验证的类型
- Returns:
true
T对应一个“复合”类型- Returns:
false
T对应一个“简单”类型
-
bool is_compound(data_type type)#
指示
type的元素是否为复合类型。columns 带有“复合”元素的列在逻辑上是单个元素列,但可能具体实现为两个或更多columns。例如,一个STRING列可能包含一个偏移量的column和一个字符的子column。- Parameters:
type – 要验证的
data_type- Returns:
true
type是一个复合类型- Returns:
false
type是一个简单的类型
-
template<typename T>
inline constexpr bool is_nested()# 指示
T是否为嵌套类型。“嵌套”类型与复合类型不同,因为它们可以具有相同类型的任意深度的后代列表。字符串不是嵌套类型,但列表是。
- Parameters:
T – 要验证的类型
- Returns:
true T 是一个嵌套类型
- Returns:
false T 不是一个嵌套类型
变量
-
struct order_info#
- #include <types.hpp>
指示一组值的排序方式。
-
class data_type#
- #include <types.hpp>
指示列中元素的逻辑数据类型。
简单类型可以完全通过它们的
id()来描述,但某些类型需要额外的元数据来完全描述该类型的元素。公共函数
-
inline explicit data_type(type_id id, int32_t scale)#
为
numeric::fixed_point构造一个新的data_type对象- Parameters:
id –
fixed_point的标识符scale –
fixed_point的比例(参见fixed_point::_scale)
-
inline constexpr int32_t scale() const noexcept#
返回比例(用于fixed_point类型)
- Returns:
比例尺
-
inline explicit data_type(type_id id, int32_t scale)#
-
CUDF_ENABLE_IF(...)#