58 return type_id::EMPTY;
71 struct type_to_name_impl {
73 inline std::string operator()()
79 template <cudf::type_
id t>
80 struct id_to_type_impl {
92 template <cudf::type_
id Id>
93 using id_to_type =
typename id_to_type_impl<Id>::type;
110 template <
typename T>
112 std::conditional_t<std::is_same_v<numeric::decimal32, T>, int32_t,
113 std::conditional_t<std::is_same_v<numeric::decimal64, T>, int64_t,
114 std::conditional_t<std::is_same_v<numeric::decimal128, T>, __int128_t, T>>>;
132 template <
typename T>
135 return base_type_to_id<std::remove_cv_t<T>>();
145 #ifndef CUDF_TYPE_MAPPING
146 #define CUDF_TYPE_MAPPING(Type, Id) \
148 constexpr inline type_id base_type_to_id<Type>() \
153 inline std::string type_to_name_impl::operator()<Type>() \
155 return CUDF_STRINGIFY(Type); \
158 struct id_to_type_impl<Id> { \
204 return type_id::INT8;
216 template <
typename T>
219 return (
id == type_id::DECIMAL32 && std::is_same_v<T, int32_t>) ||
220 (
id == type_id::DECIMAL64 && std::is_same_v<T, int64_t>) ||
221 (
id == type_id::DECIMAL128 && std::is_same_v<T, __int128_t>) ||
id == type_to_id<T>();
232 template <cudf::type_
id Id>
237 template <
typename T>
238 struct type_to_scalar_type_impl {
248 #ifndef MAP_NUMERIC_SCALAR
249 #define MAP_NUMERIC_SCALAR(Type) \
251 struct type_to_scalar_type_impl<Type> { \
252 using ScalarType = cudf::numeric_scalar<Type>; \
253 using ScalarDeviceType = cudf::numeric_scalar_device_view<Type>; \
271 struct type_to_scalar_type_impl<std::string> {
277 struct type_to_scalar_type_impl<
cudf::string_view> {
308 struct type_to_scalar_type_impl<
cudf::list_view> {
314 struct type_to_scalar_type_impl<
cudf::struct_view> {
325 #ifndef MAP_TIMESTAMP_SCALAR
326 #define MAP_TIMESTAMP_SCALAR(Type) \
328 struct type_to_scalar_type_impl<Type> { \
329 using ScalarType = cudf::timestamp_scalar<Type>; \
330 using ScalarDeviceType = cudf::timestamp_scalar_device_view<Type>; \
346 #ifndef MAP_DURATION_SCALAR
347 #define MAP_DURATION_SCALAR(Type) \
349 struct type_to_scalar_type_impl<Type> { \
350 using ScalarType = cudf::duration_scalar<Type>; \
351 using ScalarDeviceType = cudf::duration_scalar_device_view<Type>; \
366 template <
typename T>
374 template <
typename T>
471 #pragma nv_exec_check_disable
474 template <
template <cudf::type_
id>
typename IdTypeMap = id_to_type_impl,
481 switch (dtype.id()) {
483 return f.template operator()<
typename IdTypeMap<type_id::INT8>::type>(
484 std::forward<Ts>(args)...);
486 return f.template operator()<
typename IdTypeMap<type_id::INT16>::type>(
487 std::forward<Ts>(args)...);
489 return f.template operator()<
typename IdTypeMap<type_id::INT32>::type>(
490 std::forward<Ts>(args)...);
492 return f.template operator()<
typename IdTypeMap<type_id::INT64>::type>(
493 std::forward<Ts>(args)...);
495 return f.template operator()<
typename IdTypeMap<type_id::UINT8>::type>(
496 std::forward<Ts>(args)...);
498 return f.template operator()<
typename IdTypeMap<type_id::UINT16>::type>(
499 std::forward<Ts>(args)...);
501 return f.template operator()<
typename IdTypeMap<type_id::UINT32>::type>(
502 std::forward<Ts>(args)...);
504 return f.template operator()<
typename IdTypeMap<type_id::UINT64>::type>(
505 std::forward<Ts>(args)...);
506 case type_id::FLOAT32
507 return f.template operator()<
typename IdTypeMap<type_id::FLOAT32>::type>(
508 std::forward<Ts>(args)...);
509 case type_id::FLOAT64
510 return f.template operator()<
typename IdTypeMap<type_id::FLOAT64>::type>(
511 std::forward<Ts>(args)...);
513 return f.template operator()<
typename IdTypeMap<type_id::BOOL8>::type>(
514 std::forward<Ts>(args)...);
515 case type_id::TIMESTAMP_DAYS
516 return f.template operator()<
typename IdTypeMap<type_id::TIMESTAMP_DAYS>::type>(
517 std::forward<Ts>(args)...);
518 case type_id::TIMESTAMP_SECONDS
519 return f.template operator()<
typename IdTypeMap<type_id::TIMESTAMP_SECONDS>::type>(
520 std::forward<Ts>(args)...);
521 case type_id::TIMESTAMP_MILLISECONDS
522 return f.template operator()<
typename IdTypeMap<type_id::TIMESTAMP_MILLISECONDS>::type>(
523 std::forward<Ts>(args)...);
524 case type_id::TIMESTAMP_MICROSECONDS
525 return f.template operator()<
typename IdTypeMap<type_id::TIMESTAMP_MICROSECONDS>::type>(
526 std::forward<Ts>(args)...);
527 case type_id::TIMESTAMP_NANOSECONDS
528 return f.template operator()<
typename IdTypeMap<type_id::TIMESTAMP_NANOSECONDS>::type>(
529 std::forward<Ts>(args)...);
530 case type_id::DURATION_DAYS
531 return f.template operator()<
typename IdTypeMap<type_id::DURATION_DAYS>::type>(
532 std::forward<Ts>(args)...);
533 case type_id::DURATION_SECONDS
534 return f.template operator()<
typename IdTypeMap<type_id::DURATION_SECONDS>::type>(
535 std::forward<Ts>(args)...);
536 case type_id::DURATION_MILLISECONDS
537 return f.template operator()<
typename IdTypeMap<type_id::DURATION_MILLISECONDS>::type>(
538 std::forward<Ts>(args)...);
539 case type_id::DURATION_MICROSECONDS
540 return f.template operator()<
typename IdTypeMap<type_id::DURATION_MICROSECONDS>::type>(
541 std::forward<Ts>(args)...);
542 case type_id::DURATION_NANOSECONDS
543 return f.template operator()<
typename IdTypeMap<type_id::DURATION_NANOSECONDS>::type>(
544 std::forward<Ts>(args)...);
545 case type_id::DICTIONARY32
546 return f.template operator()<
typename IdTypeMap<type_id::DICTIONARY32>::type>(
547 std::forward<Ts>(args)...);
549 return f.template operator()<
typename IdTypeMap<type_id::STRING>::type>(
550 std::forward<Ts>(args)...);
552 return f.template operator()<
typename IdTypeMap<type_id::LIST>::type>(
553 std::forward<Ts>(args)...);
554 case type_id::DECIMAL32
555 return f.template operator()<
typename IdTypeMap<type_id::DECIMAL32>::type>(
556 std::forward<Ts>(args)...);
557 case type_id::DECIMAL64
558 return f.template operator()<
typename IdTypeMap<type_id::DECIMAL64>::type>(
559 std::forward<Ts>(args)...);
560 case type_id::DECIMAL128
561 return f.template operator()<
typename IdTypeMap<type_id::DECIMAL128>::type>(
562 std::forward<Ts>(args)...);
564 return f.template operator()<
typename IdTypeMap<type_id::STRUCT>::type>(
565 std::forward<Ts>(args)...);
567 #ifndef __CUDA_ARCH__
570 CUDF_UNREACHABLE(
"无效的 type_id。");
577 template <
typename T1>
578 struct double_type_dispatcher_second_type {
580 #pragma nv_exec_check_disable
582 template <
typename T2,
typename F,
typename... Ts>
583 CUDF_HOST_DEVICE __forceinline__ decltype(
auto) operator()(F&& f, Ts&&... args)
const
585 return f.template operator()<T1, T2>(std::forward<Ts>(args)...);
589 template <
template <cudf::type_
id>
typename IdTypeMap>
590 struct double_type_dispatcher_first_type {
592 #pragma nv_exec_check_disable
594 template <
typename T1,
typename F,
typename... Ts>
599 return type_dispatcher<IdTypeMap>(type2,
600 detail::double_type_dispatcher_second_type<T1>{},
602 std::forward<Ts>(args)...);
625 #pragma nv_exec_check_disable
627 template <
template <cudf::type_
id>
typename IdTypeMap = id_to_type_impl,
typename F,
typename... Ts>
631 return type_dispatcher<IdTypeMap>(type1,
632 detail::double_type_dispatcher_first_type<IdTypeMap>{},
635 std::forward<Ts>(args)...);
cudf::data_type
指示列中元素的逻辑数据类型。
cudf::fixed_point_scalar_device_view
一种 scalar_device_view 类型,用于存储指向 fixed_point 值的指针。
cudf::fixed_point_scalar
一个拥有类,用于在设备内存中表示 fixed_point 数字。
cudf::list_scalar
一个拥有类,用于在设备内存中表示列表值。
cudf::list_view
一个非拥有、不可变的设备数据视图,表示任意类型(包括...)的元素列表。
cudf::numeric_scalar_device_view
一种 scalar_device_view 类型,用于存储指向数值的指针。
cudf::numeric_scalar
一个拥有类,用于在设备内存中表示数值。
cudf::scalar
一个拥有类,用于表示单个值。
cudf::string_scalar_device_view
一种 scalar_device_view 类型,用于存储指向字符串值的指针。
cudf::string_scalar
一个拥有类,用于在设备内存中表示字符串。
cudf::string_view
一个非拥有、不可变的设备数据视图,是一个表示 UTF-8... 的可变长度 char 数组。
cudf::struct_scalar
一个拥有类,用于在设备内存中表示结构体值。
cudf::struct_view
一个非拥有、不可变的设备数据视图,表示一个带有任意类型字段(...)的结构体。
numeric::fixed_point
一种表示具有固定精度数字的类型。
cudf::dictionary32
dictionary_wrapper< int32_t > dictionary32
32位整型索引字典包装器
numeric::decimal32
fixed_point< int32_t, Radix::BASE_10 > decimal32
32位十进制定点数
numeric::decimal64
fixed_point< int64_t, Radix::BASE_10 > decimal64
64位十进制定点数
numeric::decimal128
fixed_point< __int128_t, Radix::BASE_10 > decimal128
128位十进制定点数
cudf::timestamp_ms
detail::timestamp< cudf::duration_ms > timestamp_ms
表示自 Unix epoch 以来的 cudf::duration_ms (int64_t) 类型别名。
cudf::timestamp_s
detail::timestamp< cudf::duration_s > timestamp_s
表示自 Unix epoch 以来的 cudf::duration_s (int64_t) 类型别名。
cudf::timestamp_D
detail::timestamp< cudf::duration_D > timestamp_D
表示自 Unix epoch 以来的 cudf::duration_D (int32_t) 类型别名。
cudf::duration_ns
cuda::std::chrono::duration< int64_t, cuda::std::chrono::nanoseconds::period > duration_ns
表示纳秒(int64_t)时长的类型别名。
cudf::duration_D
cuda::std::chrono::duration< int32_t, cuda::std::chrono::days::period > duration_D
表示天(int32_t)时长的类型别名。
cudf::duration_ms
cuda::std::chrono::duration< int64_t, cuda::std::chrono::milliseconds::period > duration_ms
表示毫秒(int64_t)时长的类型别名。
cudf::duration_us
cuda::std::chrono::duration< int64_t, cuda::std::chrono::microseconds::period > duration_us
表示微秒(int64_t)时长的类型别名。
cudf::timestamp_us
detail::timestamp< cudf::duration_us > timestamp_us
表示自 Unix epoch 以来的 cudf::duration_us (int64_t) 类型别名。
cudf::timestamp_ns
detail::timestamp< cudf::duration_ns > timestamp_ns
表示自 Unix epoch 以来的 cudf::duration_ns (int64_t) 类型别名。
cudf::duration_s
cuda::std::chrono::duration< int64_t, cuda::std::chrono::seconds::period > duration_s
表示秒(int64_t)时长的类型别名。
MAP_TIMESTAMP_SCALAR
#define MAP_TIMESTAMP_SCALAR(Type)
用于为时间戳类型定义 cudf::timestamp_scalar 模板类的标量类型和标量设备类型的宏...
cudf::base_type_to_id
constexpr CUDF_HOST_DEVICE type_id base_type_to_id()
将 C++ 类型映射到其对应的 cudf::type_id
cudf::type_to_name
std::string type_to_name(data_type type)
MAP_DURATION_SCALAR
#define MAP_DURATION_SCALAR(Type)
用于为时长类型定义 cudf::duration_scalar 模板类的标量类型和标量设备类型的宏...
cudf::type_dispatcher
CUDF_HOST_DEVICE constexpr decltype(auto) __forceinline__ type_dispatcher(cudf::data_type dtype, Functor f, Ts &&... args)
根据指定的 cudf::data_type 的 ID 调用带有类型实例化的 operator() 模板...
cudf::device_storage_type_t
std::conditional_t< std::is_same_v< numeric::decimal32, T >, int32_t, std::conditional_t< std::is_same_v< numeric::decimal64, T >, int64_t, std::conditional_t< std::is_same_v< numeric::decimal128, T >, __int128_t, T > >> device_storage_type_t
“返回”使用 cudf::column 时存储在设备上的相应类型
cudf::scalar_device_type_t
typename type_to_scalar_type_impl< T >::ScalarDeviceType scalar_device_type_t
将 C++ 类型映射到用于持有其值的标量设备类型。
cudf::base_type_to_id< char >
constexpr type_id base_type_to_id< char >()
将 'char' 类型映射到 type_id::INT8 的特化版本。
CUDF_TYPE_MAPPING
#define CUDF_TYPE_MAPPING(Type, Id)
用于定义具体 C++ 类型和 cudf::type_id 枚举之间映射的宏。
cudf::scalar_type_t
typename type_to_scalar_type_impl< T >::ScalarType scalar_type_t
将 C++ 类型映射到用于持有其值的标量类型。
cudf::type_to_id
constexpr CUDF_HOST_DEVICE type_id base_type_to_id()
constexpr type_id type_to_id()
cudf::double_type_dispatcher
CUDF_HOST_DEVICE constexpr decltype(auto) __forceinline__ double_type_dispatcher(cudf::data_type type1, cudf::data_type type2, F &&f, Ts &&... args)
将两个类型模板参数分派给一个可调用对象。
cudf::id_to_type
将 cudf::type_id 映射到其对应的具体 C++ 类型。
constexpr bool type_id_matches_device_storage_type(type_id id)
检查类似 fixed_point 的类型是否具有与列的存储类型 id 匹配的模板类型 T。
#define MAP_NUMERIC_SCALAR(Type)
用于为 cudf::numeric_scalar 模板类定义标量类型和标量设备类型的宏,用于 n...
#define CUDF_FAIL(...)
表示已执行了错误的执行路径。
一个强类型包装器,用于 DICTIONARY 类型列中的索引。
仅需操作底层存储类型时,请在 type_dispatcher 上使用此特化版本...
device_storage_type_t< id_to_type< Id > > type
底层类型。
针对不同分辨率的 int32_t 和 int64_t 时间戳的具体类型定义,作为自...
#define CUDF_HOST_DEVICE
表示函数或方法可在主机和设备上使用。