io/types.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  * 限制的特定语言。
15  */
16 
22 #pragma once
23 
24 #include <cudf/table/table.hpp>
25 #include <cudf/types.hpp>
26 #include <cudf/utilities/span.hpp>
27 
28 #include <map>
29 #include <memory>
30 #include <optional>
31 #include <string>
32 #include <unordered_map>
33 #include <utility>
34 #include <vector>
35 
36 namespace CUDF_EXPORT cudf {
38 namespace io {
39 class data_sink;
40 class datasource;
41 } // io 命名空间
42 } // CUDF_EXPORT cudf 命名空间
43 
45 namespace CUDF_EXPORT cudf {
47 namespace io {
57 enum class compression_type : int32_t {
58  NONE,
59  AUTO,
60  SNAPPY,
61  GZIP,
62  BZIP2,
63  BROTLI,
64  ZIP,
65  XZ,
66  ZLIB,
67  LZ4,
68  LZO,
69  ZSTD
70 };
71 
75 enum class io_type : int32_t {
76  FILEPATH,
79  VOID,
81 };
82 
86 enum class quote_style : int32_t {
87  MINIMAL,
88  ALL,
89  NONNUMERIC,
90  NONE
91 };
92 
96 enum statistics_freq : int32_t {
101 };
102 
106 enum class column_encoding : int32_t {
107  // 常见编码:
108  USE_DEFAULT = -1,
109  DICTIONARY,
110  // Parquet 编码:
111  PLAIN,
118  // ORC 编码:
119  DIRECT,
120  DIRECT_V2,
121  DICTIONARY_V2,
122 };
123 
128  public
133 
142  /*!
143  * \brief 构造新的压缩统计对象。
144  *
145  * \param num_compressed_bytes 成功压缩的字节数。
146  * \param num_failed_bytes 压缩失败的字节数。
147  * \param num_skipped_bytes 未压缩的字节数(例如太小)。
148  * \param num_compressed_output_bytes 生成的压缩数据的大小。
149  */
150  writer_compression_statistics(size_t num_compressed_bytes,
151  size_t num_failed_bytes,
152  size_t num_skipped_bytes,
159  /*!
160  * \brief 将另一个对象的压缩统计信息添加到此对象。
161  *
162  * \param other 要添加统计信息的另一个对象。
163  * \return 更新了新统计信息的此对象。
164  */
166  {
167  _num_compressed_bytes += other._num_compressed_bytes;
176  /*!
177  * \brief 返回成功压缩的字节数。
183  /*!
184  * \brief 返回压缩失败的字节数。
190  /*!
191  * \brief 返回未压缩的字节数。
197  /*!
198  * \brief 返回考虑进行压缩的总输入字节数。
199  */
200  [[nodiscard]] auto num_total_input_bytes() const noexcept
201  {
210  /*!
211  * \brief 返回总压缩比,即 `num_compressed_bytes / num_compressed_output_bytes`
212  *
213  * \note 如果 `num_compressed_output_bytes` 为零,则返回 0.0。
214  */
215  private
216  std::size_t _num_compressed_bytes = 0;
217  std::size_t _num_failed_bytes = 0;
218  std::size_t _num_skipped_bytes = 0;
219  std::size_t _num_compressed_output_bytes = 0;
220 };
221 
225 /*!
226  * \brief 字典编码策略。
227  *
229  * 这控制何时/是否对字符串列使用字典编码
229  * 在写操作期间。
230  */
237 /*!
238  * \brief 列的 Schema 信息。
239  *
240  * 读操作使用此信息提供 Schema 详细信息,写操作使用此信息
241  * 覆盖列数据本身提供的 Schema 详细信息。
242  */
243 
251  /*!
252  * \brief 从列名和可选属性构造新实例。
253  *
254  * \param _name 列名。
255  * \param _is_nullable 列的可选可为空性。
256  * \param _is_binary 列的可选二进制类型。
257  */
258  column_name_info() = default;
259 
266  /*!
267  * \brief 相等比较运算符。
268  *
269  * \param rhs 要比较的另一个列信息对象。
270  * \return 如果对象相等则返回 True,否则返回 False。
271  */
272 };
273 
277 /*!
278  * \brief 表元数据信息。
279  */
280  /*!< Schema 信息。 */
283  /*!< 每个数据源中的行数。 */
285  /*!< 任意文件级用户定义键值元数据。 */
286  /*!< 每个文件的任意用户定义键值元数据。 */
287 
288  // 以下变量目前仅针对 Parquet 读取器计算
289  /*!< 读取的总输入行组数(仅限 Parquet)。 */
290  std::optional<size_type>
291  /*!< 应用统计过滤器后的行组数(仅限 Parquet)。 */
294  std::optional<size_type>
295  /*!< 应用 Bloom 过滤器后的行组数(仅限 Parquet)。 */
298 };
299 
303 /*!
304  * \brief 带有附加元数据的表。
305  */
306 };
307 
315 /*!
316  * \brief 主机可访问内存缓冲区的视图。
317  * \deprecated 请改用 `cudf::host_span`。
318  */
319  host_buffer() = default;
326  /*!
327  * \brief 从指针和大小构造新实例。
328  *
336  /*!
337  * \brief 检查类型 `T` 是否类似于字节(char, int8_t, unsigned char, uint8_t, std::byte)。
338  */
339  using non_cv_T = std::remove_cv_t<T>;
340  return std::is_same_v<non_cv_T, int8_t> || std::is_same_v<non_cv_T, char> ||
341  std::is_same_v<non_cv_T, uint8_t> || std::is_same_v<non_cv_T, unsigned char> ||
342  std::is_same_v<non_cv_T, std::byte>;
343 }
344 
348 /*!
349  * \brief 数据源信息。
350  */
356  /*!
357  * \brief 从文件路径列表构造新实例。
358  *
359  * \param file_paths 文件路径列表。
360  */
366  /*!
367  * \brief 从单个文件路径构造新实例。
368  *
369  * \param file_path 单个文件路径。
370  */
378  /*!
379  * \brief 从主机缓冲区列表构造新实例。
380  *
381  * \param host_buffers 主机缓冲区列表。
382  */
383  explicit source_info(std::vector<host_buffer> const& host_buffers) : _type(io_type::HOST_BUFFER)
384  {
385  _host_buffers.reserve(host_buffers.size());
386  std::transform(host_buffers.begin(),
387  host_buffers.end(),
388  std::back_inserter(_host_buffers),
389  [](auto const hb) {
398  /*!
399  * \brief 从单个主机缓冲区构造新实例。
400  *
401  * \param host_data 指向数据的指针。
402  * \param size 数据大小(字节)。
403  */
404  explicit source_info(char const* host_data, size_t size)
410  /*!
411  * \brief 从主机 span 列表构造新实例。
412  *
413  * \tparam T 主机 span 的元素类型。必须类似于字节。
414  * \param host_buffers 主机 span 列表。
415  */
416  explicit source_info(cudf::host_span<cudf::host_span<T>> const host_buffers)
417  : _type(io_type::HOST_BUFFER)
418  {
419  if constexpr (not std::is_same_v<std::remove_cv_t<T>, std::byte>) {
420  _host_buffers.reserve(host_buffers.size());
421  std::transform(host_buffers.begin(),
422  host_buffers.end(),
423  std::back_inserter(_host_buffers),
424  [](auto const s) {
425  return cudf::host_span<std::byte const>{
426  reinterpret_cast<std::byte const*>(s.data()), s.size()};
427  });
433  /*!
434  * \brief 从单个主机 span 构造新实例。
435  *
436  * \tparam T 主机 span 的元素类型。必须类似于字节。
437  * \param host_data 单个主机 span。
438  */
439  explicit source_info(cudf::host_span<T> host_data)
440  : _type(io_type::HOST_BUFFER),
446  /*!
447  * \brief 从设备 span 列表构造新实例。
448  *
449  * \param device_buffers 设备 span 列表。
450  */
456  /*!
457  * \brief 从单个设备缓冲区构造新实例。
458  *
459  * \param d_buffer 单个设备缓冲区。
460  */
466  /*!
467  * \brief 从用户实现的数据源对象列表构造新实例。
468  *
469  * \param sources 数据源对象列表。
470  */
476  /*!
477  * \brief 从单个用户实现的数据源对象构造新实例。
478  *
479  * \param source 单个数据源对象。
480  */
486  /*!
492  /*!
498  /*!
504  /*!
510  /*!
511  * \brief 如果类型是 `USER_IMPLEMENTED` ,则返回用户实现的数据源对象列表
512  */
513  private
514  io_type _type = io_type::VOID;
515  std::vector<std::string> _filepaths;
516  std::vector<cudf::host_span<std::byte const>> _host_buffers;
517  std::vector<cudf::device_span<std::byte const>> _device_buffers;
518  std::vector<cudf::io::datasource*> _user_sources;
519 };
523 /*!
524  * \brief 数据目标信息。
530  /*!
531  * \brief 构造具有特定数量目标的新实例。
537  /*!
538  * \brief 从文件路径列表构造新实例。
539  *
540  * \param file_paths 文件路径列表。
541  */
547  /*!
548  * \brief 从单个文件路径构造新实例。
549  *
550  * \param file_path 单个文件路径。
551  */
557  /*!
558  * \brief 从主机缓冲区列表构造新实例。
559  *
560  * \param buffers 主机缓冲区列表。
566  /*!
567  * \brief 从单个主机缓冲区构造新实例。
573  /*!
574  * \brief 从用户实现的数据目标对象列表构造新实例。
575  *
576  * \param user_sinks 数据目标对象列表。
577  */
578  : _type(io_type::USER_IMPLEMENTED),
579  _num_sinks(user_sinks.size()),
585  /*!
586  * \brief 从单个用户实现的数据目标对象构造新实例。
587  *
588  * \param user_sink 单个数据目标对象。
589  */
595  /*!
601  /*!
607  /*!
613  /*!
619  /*!
620  * \brief 如果类型是 `USER_IMPLEMENTED` ,则返回用户实现的数据目标对象列表
621  */
622  private
623  io_type _type = io_type::VOID;
624  size_t _num_sinks = 1;
625  std::vector<std::string> _filepaths;
626  std::vector<std::vector<char>*> _buffers;
627  std::vector<cudf::io::data_sink*> _user_sinks;
628 };
629 
630 class table_input_metadata;
634 /*!
635  * \brief 写操作期间用于覆盖列 Schema 详细信息的元数据。
636  */
637  std::optional<bool> _nullable;
638  bool _list_column_is_map = false;
639  bool _use_int96_timestamp = false;
640  bool _output_as_binary = false;
641  bool _skip_compression = false;
642  std::optional<uint8_t> _decimal_precision;
643  std::optional<int32_t> _parquet_field_id;
644  std::optional<int32_t> _type_length;
645  std::vector<column_in_metadata> children;
646  column_encoding _encoding = column_encoding::USE_DEFAULT;
647 
648  public
649  column_in_metadata() = default;
655  /*!
662  /*!
663  * \brief 向元数据添加一个子列。
664  *
665  * \param child 子列元数据。
666  * \return 此对象用于链式 API 调用。
667  */
674  /*!
675  * \brief 设置列名。
676  *
677  * \param name 列名。
678  * \return 此对象用于链式 API 调用。
679  */
686  /*!
687  * \brief 设置列可为空性。
688  *
689  * \param nullable 如果可为空则为 True,否则为 False。
690  * \return 此对象用于链式 API 调用。
691  */
699  /*!
700  * \brief 设置标志,将 list 列视为 map 列。
701  *
702  * \return 此对象用于链式 API 调用。
703  */
713  /*!
714  * \brief 请求将时间戳输出为 INT96。
715  * Applies only to Parquet.
716  * \param req 如果需要 INT96 则为 True,否则为 False。
717  * \return 此对象用于链式 API 调用。
718  */
726  /*!
727  * \brief 设置列十进制精度。
728  * Applies only to Parquet and ORC.
729  * \param precision 列的十进制精度。
730  * \return 此对象用于链式 API 调用。
731  */
739  /*!
740  * \brief 设置列类型长度。
741  * Applies only to Parquet (fixed-width types).
742  * \param length 列的类型长度。
743  * \return 此对象用于链式 API 调用。
744  */
751  /*!
752  * \brief 设置列 Parquet 字段 ID。
753  * Applies only to Parquet.
754  * \param field_id 列的 Parquet 字段 ID。
755  * \return 此对象用于链式 API 调用。
756  */
765  /*!
766  * \brief 将列输出类型设置为二进制。仅限 Parquet。
767  * \param binary 如果输出应为二进制则为 True,否则为 False。
768  * \return 此对象用于链式 API 调用。
769  */
770  column_in_metadata& set_output_as_binary(bool binary) noexcept
771  {
772  _output_as_binary = binary;
773  if (_output_as_binary and children.size() == 1) {
774  children.emplace_back();
775  } else if (!_output_as_binary and children.size() == 2) {
783  /*!
784  * \brief 设置列压缩为禁用。
785  * Applies only to Parquet and ORC.
786  * \param skip 如果应跳过压缩则为 True,否则为 False。
787  * \return 此对象用于链式 API 调用。
788  */
799  /*!
800  * \brief 设置列编码。
801  * \note 某些编码仅适用于特定文件格式(例如,Parquet,ORC)。
802  * \param encoding 用于该列的编码。
803  * \return 此对象用于链式 API 调用。
804  */
811  /*!
812 
819  [[nodiscard]] column_in_metadata const& child(size_type i) const noexcept { return children[i]; }
820 
826  [[nodiscard]] std::string const& get_name() const noexcept { return _name; }
827 
833  [[nodiscard]] bool is_nullability_defined() const noexcept { return _nullable.has_value(); }
834 
842  [[nodiscard]] bool nullable() const { return _nullable.value(); }
843 
849  [[nodiscard]] bool is_map() const noexcept { return _list_column_is_map; }
850 
857  [[nodiscard]] bool is_enabled_int96_timestamps() const noexcept { return _use_int96_timestamp; }
858 
864  [[nodiscard]] bool is_decimal_precision_set() const noexcept
865  {
866  return _decimal_precision.has_value();
867  }
868 
876  [[nodiscard]] uint8_t get_decimal_precision() const { return _decimal_precision.value(); }
877 
883  [[nodiscard]] bool is_type_length_set() const noexcept { return _type_length.has_value(); }
884 
892  [[nodiscard]] uint8_t get_type_length() const { return _type_length.value(); }
893 
899  [[nodiscard]] bool is_parquet_field_id_set() const noexcept
900  {
901  return _parquet_field_id.has_value();
902  }
903 
911  [[nodiscard]] int32_t get_parquet_field_id() const { return _parquet_field_id.value(); }
912 
918  [[nodiscard]] size_type num_children() const noexcept { return children.size(); }
919 
925  [[nodiscard]] bool is_enabled_output_as_binary() const noexcept { return _output_as_binary; }
926 
932  [[nodiscard]] bool is_enabled_skip_compression() const noexcept { return _skip_compression; }
933 
939  [[nodiscard]] column_encoding get_encoding() const { return _encoding; }
940 };
941 
946  public
947  table_input_metadata() = default; // Required by cython
948 
957 
966  explicit table_input_metadata(table_metadata const& metadata);
967 
968  std::vector<column_in_metadata> column_metadata;
969 };
970 
980 
981  partition_info() = default;
988  partition_info(size_type start_row, size_type num_rows) : start_row(start_row), num_rows(num_rows)
989  {
990  }
991 };
992 
998  // Whether to read binary data as a string column
999  bool _convert_binary_to_strings{true};
1000  int32_t _type_length{0};
1001 
1002  std::vector<reader_column_schema> children;
1003 
1004  public
1005  reader_column_schema() = default;
1006 
1012  reader_column_schema(size_type number_of_children) { children.resize(number_of_children); }
1013 
1020  {
1021  children.assign(child_span.begin(), child_span.end());
1022  }
1023 
1031  {
1032  children.push_back(child);
1033  return *this;
1034  }
1035 
1042  [[nodiscard]] reader_column_schema& child(size_type i) { return children[i]; }
1043 
1050  [[nodiscard]] reader_column_schema const& child(size_type i) const { return children[i]; }
1051 
1061  {
1062  _convert_binary_to_strings = convert_to_string;
1063  return *this;
1064  }
1065 
1073  {
1074  _type_length = type_length;
1075  return *this;
1076  }
1077 
1083  [[nodiscard]] bool is_enabled_convert_binary_to_strings() const
1084  {
1085  return _convert_binary_to_strings;
1086  }
1087 
1093  [[nodiscard]] int32_t get_type_length() const { return _type_length; }
1094 
1100  [[nodiscard]] size_t get_num_children() const { return children.size(); }
1101 };
1102  // end of group
1104 } // namespace io
1105 } // namespace CUDF_EXPORT cudf
constexpr CUDF_HOST_DEVICE iterator end() const noexcept
返回指向 span 中最后一个元素之后元素的迭代器。
定义: span.hpp:105
constexpr CUDF_HOST_DEVICE iterator begin() const noexcept
返回指向 span 中第一个元素的迭代器。
定义: span.hpp:97
column_in_metadata & set_name(std::string const &name) noexcept
设置此列的名称。
column_in_metadata & add_child(column_in_metadata const &child)
添加此列的子元数据。
bool is_enabled_output_as_binary() const noexcept
获取此列是否编码为二进制或字符串数据。
column_in_metadata & set_parquet_field_id(int32_t field_id) noexcept
设置此列的 parquet 字段 ID。
column_in_metadata & set_int96_timestamps(bool req) noexcept
指定此时间戳列是否应使用已弃用的 int96 物理类型进行编码...。
column_in_metadata & set_decimal_precision(uint8_t precision) noexcept
设置此列的十进制精度。仅当此列为十进制(定点)类型时有效。
bool is_enabled_int96_timestamps() const noexcept
获取是否使用已弃用的 int96 物理类型对时间戳列进行编码。
bool is_parquet_field_id_set() const noexcept
获取是否已为此列设置了 parquet 字段 ID。
bool is_decimal_precision_set() const noexcept
获取是否已为此十进制列设置精度。
bool is_type_length_set() const noexcept
获取是否已为此列设置类型长度。
bool nullable() const
获取此列显式设置的可空性。
size_type num_children() const noexcept
获取此列的子项数量。
bool is_map() const noexcept
如果这是列表列的元数据,则返回它是否要编码为 map。
uint8_t get_decimal_precision() const
获取为此列设置的十进制精度。
column_in_metadata & set_encoding(column_encoding encoding) noexcept
设置此列使用的编码。
column_encoding get_encoding() const
获取为此列设置的编码。
uint8_t get_type_length() const
获取为此列设置的类型长度。
column_in_metadata & set_output_as_binary(bool binary) noexcept
指定此列应写为二进制还是字符串数据。仅对以下类型有效...
column_in_metadata & child(size_type i) noexcept
获取此列子项的引用。
column_in_metadata & set_type_length(int32_t length) noexcept
设置列的数据长度。仅当此列是固定长度字节数组时有效。
bool is_enabled_skip_compression() const noexcept
获取是否跳过压缩此列。
int32_t get_parquet_field_id() const
获取为此列设置的 parquet 字段 ID。
column_in_metadata & set_list_column_as_map() noexcept
指定此列表列应在写入文件中编码为 map。
column_in_metadata(std::string_view name)
构造一个新的列元数据对象。
std::string const & get_name() const noexcept
获取此列的名称。
column_in_metadata & set_nullability(bool nullable) noexcept
设置此列的可空性。
bool is_nullability_defined() const noexcept
获取此列是否已显式设置可空性。
column_in_metadata const & child(size_type i) const noexcept
获取此列子项的 const 引用。
column_in_metadata & set_skip_compression(bool skip) noexcept
指定此列是否应跳过压缩,无论指定的压缩编解码器是什么...
用于存储 writer 输出数据的接口类。
用于向 reader 提供输入数据的接口类。
reader 的 schema 元素
reader_column_schema const & child(size_type i) const
获取此列子项的 const 引用。
reader_column_schema & set_type_length(int32_t type_length)
设置固定长度数据的长度。
bool is_enabled_convert_binary_to_strings() const
获取此列是否编码为二进制或字符串数据。
int32_t get_type_length() const
获取此固定长度数据的字节长度。
reader_column_schema(host_span< reader_column_schema > const &child_span)
构造一个包含定义子项的 span 的新 reader 列 schema 对象。
reader_column_schema & set_convert_binary_to_strings(bool convert_to_string)
指定此列应写为二进制还是字符串数据。仅对以下类型有效...
size_t get_num_children() const
获取子对象的数量。
reader_column_schema & add_child(reader_column_schema const &child)
添加此列的子元数据。
reader_column_schema & child(size_type i)
获取此列子项的引用。
reader_column_schema(size_type number_of_children)
构造一个新的 reader 列 schema 对象。
table_input_metadata(table_view const &table)
从 table_view 构造新的 table_input_metadata。
table_input_metadata(table_metadata const &metadata)
从 table_metadata 对象构造新的 table_input_metadata。
std::vector< column_in_metadata > column_metadata
列元数据列表。
writer 执行的压缩统计信息。
auto compression_ratio() const noexcept
返回成功压缩块的压缩比。
auto num_total_input_bytes() const noexcept
返回压缩输入的总大小。
writer_compression_statistics & operator+=(writer_compression_statistics const &other) noexcept
添加另一个 writer_compression_statistics 对象的值。
auto num_failed_bytes() const noexcept
返回压缩失败块中的字节数。
writer_compression_statistics()=default
默认构造函数。
auto num_skipped_bytes() const noexcept
返回压缩过程中跳过块中的字节数。
writer_compression_statistics(size_t num_compressed_bytes, size_t num_failed_bytes, size_t num_skipped_bytes, size_t num_compressed_output_bytes)
带初始值的构造函数。
auto num_compressed_bytes() const noexcept
返回成功压缩块中的字节数。
一组相同大小的 cudf::column_view。
一组相同大小的 cudf::column。
定义: table.hpp:40
statistics_freq
parquet/orc writer 的列统计信息粒度类型。
定义: io/types.hpp:96
column_encoding
可与 column_in_metadata::set_encoding() 一起使用的有效编码。
quote_style
处理字段数据中的引号时的行为。
定义: io/types.hpp:86
constexpr auto is_byte_like_type()
如果类型是字节类(即合理地可以作为字节指针传递),则返回 true。
dictionary_policy
控制 parquet writer 使用字典编码。
compression_type
压缩算法。
定义: io/types.hpp:57
io_type
数据源或目的地类型。
定义: io/types.hpp:75
@ STATISTICS_COLUMN
完整的列和偏移量索引。意味着 STATISTICS_ROWGROUP。
@ STATISTICS_ROWGROUP
每行组列统计信息。
定义: io/types.hpp:98
@ STATISTICS_NONE
无列统计信息。
定义: io/types.hpp:97
@ STATISTICS_PAGE
每页列统计信息。
定义: io/types.hpp:99
@ DELTA_BINARY_PACKED
使用 DELTA_BINARY_PACKED 编码(仅对整数列有效)
@ USE_DEFAULT
未请求编码,使用默认编码。
@ PLAIN
使用 plain 编码。
@ BYTE_STREAM_SPLIT
使用 BYTE_STREAM_SPLIT 编码(对所有固定宽度类型有效)
@ MINIMAL
仅引用包含特殊字符的字段。
@ ALL
引用所有字段。
@ NONNUMERIC
引用所有非数字字段。
@ ALWAYS
无论对压缩的影响如何,都使用字典。
@ ADAPTIVE
在不影响压缩的情况下使用字典。
@ NEVER
从不使用字典编码。
@ BROTLI
BROTLI 格式,使用 LZ77 + Huffman + 二阶上下文建模。
@ XZ
XZ 格式,使用 LZMA(2) 算法。
@ ZIP
ZIP 格式,使用 DEFLATE 算法。
@ BZIP2
BZIP2 格式,使用 Burrows-Wheeler 变换。
@ AUTO
自动检测或选择压缩格式。
@ HOST_BUFFER
输入/输出是主机内存中的缓冲区。
@ USER_IMPLEMENTED
输入/输出由自定义用户类处理。
@ VOID
无输入/输出。不执行任何工作。适用于基准测试。
@ FILEPATH
输入/输出是文件路径。
@ DEVICE_BUFFER
输入/输出是设备内存中的缓冲区。
std::unique_ptr< column > transform(std::vector< column_view > const &inputs, std::string const &transform_udf, data_type output_type, bool is_ptx, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
通过对输入列的每个元素应用转换函数来创建新列。
int32_t size_type
列和表的行索引类型。
定义: types.hpp:95
cuDF 接口
定义: host_udf.hpp:37
bool nullable(table_view const &view)
如果表中的任何列是可空的(而不是整个层级结构),则返回 True。
span 的 API。
C++20 std::span 的设备版本,功能集有所减少。
定义: span.hpp:355
C++20 std::span,功能集有所减少。
定义: span.hpp:194
输出列的详细名称(以及可选的可空性)信息。
std::optional< bool > is_nullable
列的可空性。
std::optional< bool > is_binary
列是二进制的(即不是列表)
std::vector< column_name_info > children
子列名称。
bool operator==(column_name_info const &rhs) const
比较两个列名称信息结构是否相等。
std::optional< int32_t > type_length
数据字节宽度(针对固定长度数据)
std::string name
列名。
column_name_info(std::string _name, std::optional< bool > _is_nullable=std::nullopt, std::optional< bool > _is_binary=std::nullopt)
构造一个带有名称、可选可空性且无子项的列名称信息。
主机内存缓冲区的非拥有视图。
host_buffer(char const *data, size_t size)
构造一个新的主机缓冲区对象。
写入分区数据集时使用的信息。
partition_info(size_type start_row, size_type num_rows)
构造一个新的 partition_info。
size_type start_row
分区的起始行。
size_type num_rows
分区中的行数。
写入接口的目的地信息。
auto const & buffers() const
获取输入的宿主缓冲区。
sink_info(std::vector< std::vector< char > * > buffers)
为多个宿主缓冲区构造新的 sink info 对象。
auto const & filepaths() const
获取输入的的文件路径。
sink_info(std::string file_path)
为单个文件构造新的 sink info 对象。
sink_info(class cudf::io::data_sink *user_sink)
为单个用户实现的 sink 构造新的 sink info 对象。
sink_info(std::vector< cudf::io::data_sink * > const &user_sinks)
为多个用户实现的 sink 构造新的 sink info 对象。
auto num_sinks() const
获取 sink 的数量。
auto const & user_sinks() const
获取输入的的用户 sink。
sink_info(size_t num_sinks)
构造新的 sink info 对象。
auto type() const
获取输入的类型。
sink_info(std::vector< char > *buffer)
为单个宿主缓冲区构造新的 sink info 对象。
sink_info(std::vector< std::string > file_paths)
为多个文件构造新的 sink info 对象。
读取接口的源信息。
auto const & device_buffers() const
获取输入的设备缓冲区。
source_info(char const *host_data, size_t size)
为单个缓冲区构造新的 source info 对象。
source_info(std::vector< std::string > file_paths)
为多个文件构造新的 source info 对象。
auto const & filepaths() const
获取输入的的文件路径。
source_info(cudf::host_span< T > host_data)
为单个缓冲区构造新的 source info 对象。
source_info(cudf::host_span< cudf::host_span< T >> const host_buffers)
为宿主内存中的多个缓冲区构造新的 source info 对象。
source_info(cudf::device_span< std::byte const > d_buffer)
从设备缓冲区构造新的 source info 对象。
source_info(cudf::io::datasource *source)
为单个用户实现的 source 构造新的 source info 对象。
source_info(std::vector< cudf::io::datasource * > const &sources)
为多个用户实现的 source 构造新的 source info 对象。
source_info(cudf::host_span< cudf::device_span< std::byte const >> device_buffers)
为设备内存中的多个缓冲区构造新的 source info 对象。
auto const & host_buffers() const
获取输入的宿主缓冲区。
auto type() const
获取输入的类型。
source_info(std::string file_path)
为单个文件构造新的 source info 对象。
auto const & user_sources() const
获取输入的的用户 source。
source_info(std::vector< host_buffer > const &host_buffers)
为宿主内存中的多个缓冲区构造新的 source info 对象。
IO reader 返回的表元数据。
std::vector< std::unordered_map< std::string, std::string > > per_file_user_data
每文件格式相关的元数据,以键值对形式呈现。
std::optional< size_type > num_row_groups_after_stats_filter
std::optional< size_type > num_row_groups_after_bloom_filter
std::vector< size_t > num_rows_per_source
std::vector< column_name_info > schema_info
整个输出层级的详细名称信息。
std::map< std::string, std::string > user_data
带有表元数据的表,IO reader 使用它按值返回元数据。
std::unique_ptr< table > tbl
表。
table_metadata metadata
表元数据。
cudf::table 的类定义。
libcudf 的类型声明。