scalar.hpp
查看此文件的文档。
1 /*
2  * 版权所有 (c) 2019-2025, NVIDIA CORPORATION.
3  *
4  * 根据 Apache 许可证 2.0 版(“许可证”)获得许可;
5  * 除非遵守许可证的规定,否则不得使用此文件。
6  * 您可以在以下位置获取许可证副本:
7  *
8  * https://apache.ac.cn/licenses/LICENSE-2.0
9  *
10  * 除非适用法律要求或书面同意,根据许可证分发的软件
11  * 按“原样”分发,不附带任何明示或默示的保证或条件。
12  * 请参阅许可证,了解管理权限和限制的特定语言。
13  *
14  * limitations under the License.
15  */
16 #pragma once
17 
18 #include <cudf/column/column.hpp>
19 #include <cudf/detail/device_scalar.hpp>
20 #include <cudf/table/table.hpp>
21 #include <cudf/types.hpp>
25 
26 #include <rmm/cuda_stream_view.hpp>
27 #include <rmm/device_buffer.hpp>
28 #include <rmm/device_scalar.hpp>
29 
30 #include <string_view>
31 
37 namespace CUDF_EXPORT cudf {
51 class scalar {
52  public
53  scalar() = delete;
54  virtual ~scalar() = default;
55  scalar& operator=(scalar const& other) = delete;
56  scalar& operator=(scalar&& other) = delete;
57 
63  [[nodiscard]] data_type type() const noexcept; // 返回标量的类型。
64 
71  void set_valid_async(bool is_valid, rmm::cuda_stream_view stream = cudf::get_default_stream()); // 异步设置有效位。
72 
83  [[nodiscard]] bool is_valid(rmm::cuda_stream_view stream = cudf::get_default_stream()) const; // 获取有效位。
84 
90  bool* validity_data(); // 返回设备内存中有效位的原始指针。
91 
97  [[nodiscard]] bool const* validity_data() const; // 返回设备内存中有效位的常量原始指针。
98 
99  protected
100  data_type _type{type_id::EMPTY}; // 标量类型
101  cudf::detail::device_scalar<bool> _is_valid; // 包含有效位的设备内存
102 
107  scalar(scalar&& other) = default; // 标量的移动构造函数。
108 
116  scalar(scalar const& other,
118  rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref()); // 通过深度复制另一个标量对象来构造新的标量对象。
119 
132  bool is_valid = false,
134  rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref()); // 构造新的标量对象。
135 };
136 
137 namespace detail {
143 template <typename T>
144 class fixed_width_scalar : public scalar {
145  static_assert(is_fixed_width<T>(), "意外的非固定宽度类型。");
146 
147  public
148  using value_type = T; // 标量持有的值的类型。
149 
150  fixed_width_scalar() = delete;
151  ~fixed_width_scalar() override = default;
152 
157  fixed_width_scalar(fixed_width_scalar&& other) = default; // fixed_width_scalar 的移动构造函数。
158 
159  fixed_width_scalar& operator=(fixed_width_scalar const& other) = delete;
160  fixed_width_scalar& operator=(fixed_width_scalar&& other) = delete;
161 
171  rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref()); // 通过深度复制另一个 fixed-width scalar 对象来构造新的 fixed-width scalar 对象。
172 
179  void set_value(T value, rmm::cuda_stream_view stream = cudf::get_default_stream()); // 设置标量的值。
180 
187  [[nodiscard]] T value(rmm::cuda_stream_view stream = cudf::get_default_stream()) const; // 获取标量的值。
188 
193  T* data(); // 返回设备内存中值的原始指针。
194 
199  [[nodiscard]] T const* data() const; // 返回设备内存中值的常量原始指针。
200 
201  protected
202  rmm::device_scalar<T> _data; // 包含值的设备内存
203 
213  bool is_valid = true,
215  rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref()); // 构造新的固定宽度标量对象。
216 
226  bool is_valid = true,
228  rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref()); // 从现有设备内存构造新的固定宽度标量对象。
229 };
230 
231 } // namespace detail
232 
238 template <typename T>
240  static_assert(is_numeric<T>(), "意外的非数值类型。");
241 
242  public
243  numeric_scalar() = delete;
244  ~numeric_scalar() override = default;
245 
250  numeric_scalar(numeric_scalar&& other) = default; // numeric_scalar 的移动构造函数。
251 
252  numeric_scalar& operator=(numeric_scalar const& other) = delete;
253  numeric_scalar& operator=(numeric_scalar&& other) = delete;
254 
264  rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref()); // 通过深度复制另一个 numeric scalar 对象来构造新的 numeric scalar 对象。
265 
274  numeric_scalar(T value,
275  bool is_valid = true,
277  rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref()); // 构造新的数值标量对象。
278 
288  bool is_valid = true,
290  rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref()); // 从现有设备内存构造新的数值标量对象。
291 };
292 
298 template <typename T>
299 class fixed_point_scalar : public scalar {
300  static_assert(is_fixed_point<T>(), "意外的非 fixed_point 类型。");
301 
302  public
303  using rep_type = typename T::rep; // fixed_point 的底层表示类型。
304  using value_type = T; // 标量持有的值的类型。
305 
306  fixed_point_scalar() = delete;
307  ~fixed_point_scalar() override = default;
308 
313  fixed_point_scalar(fixed_point_scalar&& other) = default; // fixed_point_scalar 的移动构造函数。
314 
315  fixed_point_scalar& operator=(fixed_point_scalar const& other) = delete;
316  fixed_point_scalar& operator=(fixed_point_scalar&& other) = delete;
317 
327  rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref()); // 通过深度复制另一个 fixed_point scalar 对象来构造新的 fixed_point scalar 对象。
328 
339  numeric::scale_type scale,
340  bool is_valid = true,
342  rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref()); // 从代表性值和比例构造新的 fixed_point scalar 对象。
343 
353  bool is_valid = true,
355  rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref()); // 从值和默认 0 比例构造新的 fixed_point scalar 对象。
356 
366  bool is_valid = true,
368  rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref()); // 从 fixed_point 数构造新的 fixed_point scalar 对象。
369 
380  numeric::scale_type scale,
381  bool is_valid = true,
383  rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref()); // 从现有设备内存构造新的 fixed_point scalar 对象。
384 
391  [[nodiscard]] rep_type value(rmm::cuda_stream_view stream = cudf::get_default_stream()) const; // 获取 fixed_point scalar 的原始值。
392 
399  [[nodiscard]] T fixed_point_value(// 将 fixed_point scalar 的值作为 fixed_point 类型获取。
401 
406  rep_type* data(); // 返回设备内存中值的原始指针。
407 
412  [[nodiscard]] rep_type const* data() const; // 返回设备内存中值的常量原始指针。
413 
414  protected
415  rmm::device_scalar<rep_type> _data; // 包含原始值的设备内存
416 };
417 
421 class string_scalar : public scalar {
422  public
424 
425  string_scalar() = delete;
426  ~string_scalar() override = default;
427 
432  string_scalar(string_scalar&& other) = default; // string_scalar 的移动构造函数。
433 
434  // string_scalar(string_scalar const& other) = delete;
435  string_scalar& operator=(string_scalar const& other) = delete;
436  string_scalar& operator=(string_scalar&& other) = delete;
437 
447  rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref()); // 通过深度复制另一个 string scalar 对象来构造新的 string scalar 对象。
448 
459  string_scalar(std::string_view string,
460  bool is_valid = true,
462  rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref()); // 从主机 std::string_view 构造新的 string scalar 对象。
463 
474  string_scalar(value_type const& source,
475  bool is_valid = true,
477  rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref()); // 从 cudf::string_view 构造新的 string scalar 对象。
478 
490  bool is_valid = true,
492  rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref()); // 从 string_view 的现有 device_scalar 构造新的 string scalar 对象。
493 
506  bool is_valid = true,
508  rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref()); // 从现有 device_buffer 构造新的 string scalar 对象。
509 
516  [[nodiscard]] std::string to_string(// 将设备字符串转换为主机 std::string。
518 
525  [[nodiscard]] value_type value(rmm::cuda_stream_view stream = cudf::get_default_stream()) const; // 将字符串值获取为 cudf::string_view。
526 
531  [[nodiscard]] size_type size() const; // 获取字符串的大小(以字节为单位)。
532 
537  [[nodiscard]] char const* data() const; // 返回设备内存中值的常量原始指针。
538 
539  protected
540  rmm::device_buffer _data{}; // 包含字符串数据的设备内存
541 };
542 
549 template <typename T>
551  static_assert(is_chrono<T>(), "意外的非 chrono 类型");
552 
553  public
554  chrono_scalar() = delete;
555  ~chrono_scalar() override = default;
556 
561  chrono_scalar(chrono_scalar&& other) = default; // chrono_scalar 的移动构造函数。
562 
563  chrono_scalar& operator=(chrono_scalar const& other) = delete;
564  chrono_scalar& operator=(chrono_scalar&& other) = delete;
565 
575  rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref()); // 通过深度复制另一个 chrono scalar 对象来构造新的 chrono scalar 对象。
576 
585  chrono_scalar(T value,
586  bool is_valid = true,
588  rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref()); // 构造新的 chrono scalar 对象。
589 
599  bool is_valid = true,
601  rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref()); // 从现有设备内存构造新的 chrono scalar 对象。
602 };
603 
610 template <typename T>
611 class timestamp_scalar : public chrono_scalar<T> {
612  public
613  static_assert(is_timestamp<T>(), "意外的非 timestamp 类型");
615  using rep_type = typename T::rep; // timestamp 的底层表示类型。
616 
617  timestamp_scalar() = delete;
618 
623  timestamp_scalar(timestamp_scalar&& other) = default; // timestamp_scalar 的移动构造函数。
624 
634  rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref()); // 通过深度复制另一个 timestamp scalar 对象来构造新的 timestamp scalar 对象。
635 
646  template <typename Duration2>
647  timestamp_scalar(Duration2 const& value,
648  bool is_valid,
650  rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref()); // 从 std::chrono::duration 构造新的 timestamp scalar 对象。
651 
657  rep_type ticks_since_epoch(rmm::cuda_stream_view stream); // 返回自 epoch 以来的时间戳(以 tick 数表示)。
658 };
659 
666 template <typename T>
667 class duration_scalar : public chrono_scalar<T> {
668  public
669  static_assert(is_duration<T>(), "意外的非 duration 类型");
671  using rep_type = typename T::rep; // duration 的底层表示类型。
672 
673  duration_scalar() = delete;
674 
679  duration_scalar(duration_scalar&& other) = default; // duration_scalar 的移动构造函数。
680 
690  rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref()); // 通过深度复制另一个 duration scalar 对象来构造新的 duration scalar 对象。
691 
701  bool is_valid,
703  rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref()); // 从 tick 数构造新的 duration scalar 对象。
704 
710  rep_type count(rmm::cuda_stream_view stream); // 返回 duration(以 tick 数表示)。
711 };
712 
716 class list_scalar : public scalar {
717  public
718  list_scalar() = delete;
719  ~list_scalar() override = default;
720 
725  list_scalar(list_scalar&& other) = default; // list_scalar 的移动构造函数。
726 
727  list_scalar& operator=(list_scalar const& other) = delete;
728  list_scalar& operator=(list_scalar&& other) = delete;
729 
737  list_scalar(list_scalar const& other,
739  rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref()); // 通过深度复制另一个 list scalar 对象来构造新的 list scalar 对象。
740 
752  bool is_valid = true,
754  rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref()); // 从列视图构造新的 list scalar 对象。
755 
765  bool is_valid = true,
767  rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref()); // 从列构造新的 list scalar 对象。
768 
773  [[nodiscard]] column_view view() const; // 返回列表元素的 column_view。
774 
775  private
776  cudf::column _data; // 包含列表元素的设备内存
777 };
778 
782 class struct_scalar : public scalar {
783  public
784  struct_scalar() = delete;
785  ~struct_scalar() override = default;
786 
791  struct_scalar(struct_scalar&& other) = default; // struct_scalar 的移动构造函数。
792  struct_scalar& operator=(struct_scalar const& other) = delete;
793  struct_scalar& operator=(struct_scalar&& other) = delete;
794 
804  rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref()); // 通过深度复制另一个 struct scalar 对象来构造新的 struct scalar 对象。
805 
817  bool is_valid = true,
819  rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref()); // 从表视图构造新的 struct scalar 对象。
820 
832  bool is_valid = true,
834  rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref()); // 从主机列视图跨度构造新的 struct scalar 对象。
835 
848  bool is_valid = true,
850  rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref()); // 从表构造新的 struct scalar 对象。
851 
856  [[nodiscard]] table_view view() const; // 返回结构体字段的 table_view。
857 
858  private
859  table _data; // 包含结构体字段的设备内存
860 
864  void assert_valid_size(); // 断言 _data 包含一个有效的结构体(0 行,N 列)。
865 
875  static table init_data(table&& data,// 初始化表数据,断言它是一个有效的结构体(0 行,N 列)。
876  bool is_valid,
877  rmm::cuda_stream_view stream,
879 };
880  // 组结束
882 } // 命名空间 CUDF_EXPORT cudf
一个拥有类,用于表示设备内存中的时间戳/duration 值。
定义: scalar.hpp:550
chrono_scalar(T value, bool is_valid=true, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
构造新的 chrono scalar 对象。
chrono_scalar(rmm::device_scalar< T > &&data, bool is_valid=true, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
从现有设备内存构造新的 chrono scalar 对象。
chrono_scalar(chrono_scalar const &other, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
通过深度复制另一个 chrono scalar 对象来构造新的 chrono scalar 对象。
chrono_scalar(chrono_scalar &&other)=default
chrono_scalar 的移动构造函数。
设备数据的一个非拥有、不可变视图,作为元素列,其中一些可能为 null,作为指标...
一个可包含 nullable 设备数据的容器,作为元素列。
定义: column.hpp:47
表示列中元素的逻辑数据类型的指示符。
定义: types.hpp:243
一个拥有类,用于表示设备内存中的固定宽度类型值。
定义: scalar.hpp:144
rmm::device_scalar< T > _data
包含值的设备内存
定义: scalar.hpp:202
fixed_width_scalar(fixed_width_scalar const &other, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
通过深度复制另一个 fixed-width scalar 对象来构造新的 fixed-width scalar 对象。
void set_value(T value, rmm::cuda_stream_view stream=cudf::get_default_stream())
设置标量的值。
T value(rmm::cuda_stream_view stream=cudf::get_default_stream()) const
获取标量的值。
fixed_width_scalar(fixed_width_scalar &&other)=default
fixed_width_scalar 的移动构造函数。
fixed_width_scalar(T value, bool is_valid=true, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
构造新的固定宽度标量对象。
fixed_width_scalar(rmm::device_scalar< T > &&data, bool is_valid=true, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
从现有设备内存构造新的固定宽度标量对象。
T const * data() const
返回设备内存中值的常量原始指针。
T value_type
标量持有的值的类型。
定义: scalar.hpp:148
T * data()
返回设备内存中值的原始指针。
一个拥有类,用于表示设备内存中的 duration 值。
定义: scalar.hpp:667
rep_type count(rmm::cuda_stream_view stream)
返回 duration(以 tick 数表示)。
duration_scalar(duration_scalar &&other)=default
duration_scalar 的移动构造函数。
typename T::rep rep_type
duration 的底层表示类型。
定义: scalar.hpp:671
duration_scalar(duration_scalar const &other, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
通过深度复制另一个 duration scalar 对象来构造新的 duration scalar 对象。
duration_scalar(rep_type value, bool is_valid, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
从 tick 数构造新的 duration scalar 对象。
一个拥有类,用于表示设备内存中的 fixed_point 数。
定义: scalar.hpp:299
rmm::device_scalar< rep_type > _data
包含值的设备内存
定义: scalar.hpp:415
fixed_point_scalar(fixed_point_scalar &&other)=default
fixed_point_scalar 的移动构造函数。
fixed_point_scalar(T value, bool is_valid=true, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
从 fixed_point 数构造新的 fixed_point scalar 对象。
fixed_point_scalar(rep_type value, bool is_valid=true, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
从值和默认 0 比例构造新的 fixed_point scalar 对象。
fixed_point_scalar(rmm::device_scalar< rep_type > &&data, numeric::scale_type scale, bool is_valid=true, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
从现有设备内存构造新的 fixed_point scalar 对象。
rep_type value(rmm::cuda_stream_view stream=cudf::get_default_stream()) const
获取标量的值。
T value_type
fixed_point 数值的值类型。
定义: scalar.hpp:304
fixed_point_scalar(rep_type value, numeric::scale_type scale, bool is_valid=true, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
从已偏移的值和比例构造新的 fixed_point scalar 对象。
rep_type const * data() const
返回设备内存中值的常量原始指针。
T fixed_point_value(rmm::cuda_stream_view stream=cudf::get_default_stream()) const
获取 decimal32、decimal64 或 decimal128。
rep_type * data()
返回设备内存中值的原始指针。
typename T::rep rep_type
fixed_point 数值的表示类型。
定义: scalar.hpp:303
fixed_point_scalar(fixed_point_scalar const &other, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
通过深度复制另一个对象来构造新的 fixed_point scalar 对象。
一个拥有类,用于表示设备内存中的列表值。
定义: scalar.hpp:716
column_view view() const
返回底层设备数据的非拥有、不可变视图。
list_scalar(list_scalar const &other, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
通过深度复制另一个对象来构造新的 list scalar 对象。
list_scalar(cudf::column_view const &data, bool is_valid=true, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
从 column_view 构造新的 list scalar 对象。
list_scalar(list_scalar &&other)=default
list_scalar 的移动构造函数。
list_scalar(cudf::column &&data, bool is_valid=true, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
从现有 column 构造新的 list scalar 对象。
一个拥有类,用于表示设备内存中的数值。
定义: scalar.hpp:239
numeric_scalar(rmm::device_scalar< T > &&data, bool is_valid=true, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
从现有设备内存构造新的 numeric scalar 对象。
numeric_scalar(T value, bool is_valid=true, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
构造新的 numeric scalar 对象。
numeric_scalar(numeric_scalar const &other, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
通过深度复制另一个对象来构造新的 numeric scalar 对象。
numeric_scalar(numeric_scalar &&other)=default
numeric_scalar 的移动构造函数。
一个拥有类,用于表示单个值。
定义: scalar.hpp:51
scalar(scalar &&other)=default
scalar 的移动构造函数。
data_type type() const noexcept
返回 scalar 的逻辑值类型。
scalar(scalar const &other, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
通过深度复制另一个对象来构造新的 scalar 对象。
scalar(data_type type, bool is_valid=false, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
构造新的 scalar 对象。
cudf::detail::device_scalar< bool > _is_valid
表示有效性的设备布尔值。
定义: scalar.hpp:101
一个拥有类,用于表示设备内存中的字符串。
定义: scalar.hpp:421
std::string to_string(rmm::cuda_stream_view stream=cudf::get_default_stream()) const
以 host std::string 的形式获取 scalar 的值。
string_scalar(value_type const &source, bool is_valid=true, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
从 string_view 构造新的 string scalar 对象。
string_scalar(rmm::device_scalar< value_type > &data, bool is_valid=true, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
从设备内存中的 string_view 构造新的 string scalar 对象。
size_type size() const
返回字符串的字节大小。
string_scalar(string_scalar &&other)=default
string_scalar 的移动构造函数。
string_scalar(string_scalar const &other, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
通过深度复制另一个 string_scalar 对象来构造新的 string scalar 对象。
string_scalar(rmm::device_buffer &&data, bool is_valid=true, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
通过移动现有字符串数据缓冲区构造新的 string scalar 对象。
string_scalar(std::string_view string, bool is_valid=true, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
构造新的 string scalar 对象。
value_type value(rmm::cuda_stream_view stream=cudf::get_default_stream()) const
以 string_view 的形式获取 scalar 的值。
char const * data() const
返回设备内存中字符串的原始指针。
一个非拥有、不可变的设备数据视图,表示一个可变长度的 char 数组,该数组表示一个 UTF-8...
一个拥有类,用于表示设备内存中的结构体值。
定义: scalar.hpp:782
struct_scalar(host_span< column_view const > data, bool is_valid=true, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
从 column_views 的 host_span 构造新的 struct scalar 对象。
table_view view() const
返回底层设备数据的非拥有、不可变视图。
struct_scalar(table &&data, bool is_valid=true, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
从设备内存中的现有 table 构造新的 struct scalar 对象。
struct_scalar(table_view const &data, bool is_valid=true, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
从 table_view 构造新的 struct scalar 对象。
struct_scalar(struct_scalar const &other, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
通过深度复制另一个对象来构造新的 struct scalar 对象。
struct_scalar(struct_scalar &&other)=default
struct_scalar 的移动构造函数。
一组大小相同的 cudf::column_view。
一组大小相同的 cudf::column。
定义: table.hpp:40
一个拥有类,用于表示设备内存中的时间戳值。
定义: scalar.hpp:611
timestamp_scalar(timestamp_scalar &&other)=default
timestamp_scalar 的移动构造函数。
typename T::rep rep_type
时间戳的底层表示类型。
定义: scalar.hpp:615
rep_type ticks_since_epoch(rmm::cuda_stream_view stream)
返回自 UNIX 纪元以来的时长(以 ticks 数表示)。
timestamp_scalar(Duration2 const &value, bool is_valid, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
从可转换为 T::duration 的时长构造新的 timestamp scalar 对象。
timestamp_scalar(timestamp_scalar const &other, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
通过深度复制另一个对象来构造新的 timestamp scalar 对象。
cudf::column 的类定义。
rmm::cuda_stream_view const get_default_stream()
获取当前默认流。
scale_type
fixed_point 的比例类型。
rmm::device_async_resource_ref get_current_device_resource_ref()
获取当前设备内存资源引用。
cuda::mr::async_resource_ref< cuda::mr::device_accessible > device_async_resource_ref
std::unique_ptr< cudf::column > is_valid(cudf::column_view const &input, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
创建一个 type_id::BOOL8 元素的 column,其中 input 中的每个元素的 true 表示该值...
int32_t size_type
用于 columns 和 tables 的行索引类型。
定义: types.hpp:95
cuDF 接口
定义: host_udf.hpp:37
具有简化功能集的 C++20 std::span。
定义: span.hpp:194
cudf::table 的类定义。
libcudf 的类型声明。