types.hpp
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2019-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3  * SPDX-License-Identifier: Apache-2.0
4  */
5 
11 #pragma once
12 
13 #include <cudf/table/table.hpp>
14 #include <cudf/types.hpp>
15 #include <cudf/utilities/span.hpp>
16 
17 #include <map>
18 #include <memory>
19 #include <optional>
20 #include <span>
21 #include <string>
22 #include <unordered_map>
23 #include <utility>
24 #include <vector>
25 
26 namespace CUDF_EXPORT cudf {
28 namespace io {
29 class data_sink;
30 class datasource;
31 } // namespace io
32 } // namespace CUDF_EXPORT cudf
33 
35 namespace CUDF_EXPORT cudf {
37 namespace io {
46 enum class compression_type : int32_t {
47  NONE,
48  AUTO,
49  SNAPPY,
50  GZIP,
51  BZIP2,
52  BROTLI,
53  ZIP,
54  XZ,
55  ZLIB,
56  LZ4,
57  LZO,
58  ZSTD
59 };
60 
64 enum class io_type : int32_t {
65  FILEPATH,
66  HOST_BUFFER,
68  VOID,
70 };
71 
75 enum class quote_style : int32_t {
76  MINIMAL,
77  ALL,
78  NONNUMERIC,
79  NONE
80 };
81 
85 enum statistics_freq : int32_t {
90 };
91 
95 enum class column_encoding : int32_t {
96  // Common encodings:
97  USE_DEFAULT = -1,
98  DICTIONARY,
99  // Parquet encodings:
100  PLAIN,
101  DELTA_BINARY_PACKED,
102  DELTA_LENGTH_BYTE_ARRAY,
104  DELTA_BYTE_ARRAY,
106  BYTE_STREAM_SPLIT,
107  // ORC encodings:
108  DIRECT,
109  DIRECT_V2,
110  DICTIONARY_V2,
111 };
112 
117  public:
122 
131  writer_compression_statistics(size_t num_compressed_bytes,
132  size_t num_failed_bytes,
133  size_t num_skipped_bytes,
134  size_t num_compressed_output_bytes)
135  : _num_compressed_bytes(num_compressed_bytes),
136  _num_failed_bytes(num_failed_bytes),
137  _num_skipped_bytes(num_skipped_bytes),
138  _num_compressed_output_bytes(num_compressed_output_bytes)
139  {
140  }
141 
149  {
150  _num_compressed_bytes += other._num_compressed_bytes;
151  _num_failed_bytes += other._num_failed_bytes;
152  _num_skipped_bytes += other._num_skipped_bytes;
153  _num_compressed_output_bytes += other._num_compressed_output_bytes;
154  return *this;
155  }
156 
165  [[nodiscard]] auto num_compressed_bytes() const noexcept { return _num_compressed_bytes; }
166 
172  [[nodiscard]] auto num_failed_bytes() const noexcept { return _num_failed_bytes; }
173 
179  [[nodiscard]] auto num_skipped_bytes() const noexcept { return _num_skipped_bytes; }
180 
186  [[nodiscard]] auto num_total_input_bytes() const noexcept
187  {
188  return num_compressed_bytes() + num_failed_bytes() + num_skipped_bytes();
189  }
190 
199  [[nodiscard]] auto compression_ratio() const noexcept
200  {
201  return static_cast<double>(num_compressed_bytes()) / _num_compressed_output_bytes;
202  }
203 
204  private:
205  std::size_t _num_compressed_bytes = 0;
206  std::size_t _num_failed_bytes = 0;
207  std::size_t _num_skipped_bytes = 0;
208  std::size_t _num_compressed_output_bytes = 0;
209 };
210 
214 enum dictionary_policy : int32_t {
215  NEVER = 0,
216  ADAPTIVE = 1,
217  ALWAYS = 2
218 };
219 
227  std::string name;
228  std::optional<bool> is_nullable;
229  std::optional<bool> is_binary;
230  std::optional<int32_t> type_length;
231  std::vector<column_name_info> children;
232 
239  bool operator==(column_name_info const& rhs) const = default;
240 };
241 
246  std::vector<column_name_info>
248  std::vector<size_t> num_rows_per_source;
251  std::map<std::string, std::string> user_data;
253  std::vector<std::unordered_map<std::string, std::string>>
255 
256  // The following variables are currently only computed for Parquet reader
257  size_type num_input_row_groups{0};
258  std::optional<size_type>
262  std::optional<size_type>
266 };
267 
272  std::unique_ptr<table> tbl;
274 };
275 
283 template <typename T>
284 constexpr inline auto is_byte_like_type()
285 {
286  using non_cv_T = std::remove_cv_t<T>;
287  return std::is_same_v<non_cv_T, int8_t> || std::is_same_v<non_cv_T, char> ||
288  std::is_same_v<non_cv_T, uint8_t> || std::is_same_v<non_cv_T, unsigned char> ||
289  std::is_same_v<non_cv_T, std::byte>;
290 }
291 
299  std::string path;
300  std::optional<std::size_t> size{};
301 };
302 
306 struct source_info {
310  source_info() = default;
311 
317  explicit source_info(std::vector<std::string> file_paths)
318  : _type(io_type::FILEPATH), _num_sources(file_paths.size())
319  {
320  _filepath_sources.reserve(file_paths.size());
321  for (auto& path : file_paths) {
322  _filepath_sources.push_back({std::move(path), std::nullopt});
323  }
324  rebuild_filepaths();
325  }
326 
332  explicit source_info(std::string file_path)
333  : source_info(std::vector<std::string>{std::move(file_path)})
334  {
335  }
336 
342  explicit source_info(std::vector<filepath_source> sources)
343  : _type(io_type::FILEPATH), _num_sources(sources.size()), _filepath_sources(std::move(sources))
344  {
345  rebuild_filepaths();
346  }
347 
353  template <typename T, CUDF_ENABLE_IF(is_byte_like_type<std::remove_cv_t<T>>())>
354  explicit source_info(cudf::host_span<cudf::host_span<T>> const host_buffers)
355  : _type(io_type::HOST_BUFFER), _num_sources(host_buffers.size())
356  {
357  if constexpr (not std::is_same_v<std::remove_cv_t<T>, std::byte>) {
358  _host_buffers.reserve(host_buffers.size());
359  std::transform(host_buffers.begin(),
360  host_buffers.end(),
361  std::back_inserter(_host_buffers),
362  [](auto const s) {
363  return cudf::host_span<std::byte const>{
364  reinterpret_cast<std::byte const*>(s.data()), s.size()};
365  });
366  } else {
367  _host_buffers.assign(host_buffers.begin(), host_buffers.end());
368  }
369  }
370 
376  template <typename T, CUDF_ENABLE_IF(is_byte_like_type<std::remove_cv_t<T>>())>
377  explicit source_info(cudf::host_span<T> host_data)
378  : _type(io_type::HOST_BUFFER),
379  _num_sources(1),
380  _host_buffers{cudf::host_span<std::byte const>(
381  reinterpret_cast<std::byte const*>(host_data.data()), host_data.size())}
382  {
383  }
384 
391  : _type(io_type::DEVICE_BUFFER),
392  _num_sources(device_buffers.size()),
393  _device_buffers(device_buffers.begin(), device_buffers.end())
394  {
395  }
396 
403  : _type(io_type::DEVICE_BUFFER), _num_sources(1), _device_buffers({{d_buffer}})
404  {
405  }
406 
412  explicit source_info(std::vector<cudf::io::datasource*> const& sources)
413  : _type(io_type::USER_IMPLEMENTED), _num_sources(sources.size()), _user_sources(sources)
414  {
415  }
416 
423  : _type(io_type::USER_IMPLEMENTED), _num_sources(1), _user_sources({source})
424  {
425  }
426 
432  [[nodiscard]] auto type() const { return _type; }
438  [[nodiscard]] auto const& filepath_sources() const { return _filepath_sources; }
444  [[nodiscard]] auto const& filepaths() const { return _filepaths; }
450  [[nodiscard]] auto const& host_buffers() const { return _host_buffers; }
456  [[nodiscard]] auto const& device_buffers() const { return _device_buffers; }
462  [[nodiscard]] auto const& user_sources() const { return _user_sources; }
463 
469  [[nodiscard]] auto num_sources() const { return _num_sources; }
470 
471  private:
472  void rebuild_filepaths()
473  {
474  _filepaths.clear();
475  _filepaths.reserve(_filepath_sources.size());
476  for (auto const& source : _filepath_sources) {
477  _filepaths.push_back(source.path);
478  }
479  }
480 
481  io_type _type = io_type::VOID;
482  size_t _num_sources = 0;
483  std::vector<filepath_source> _filepath_sources;
484  std::vector<std::string> _filepaths;
485  std::vector<cudf::host_span<std::byte const>> _host_buffers;
486  std::vector<cudf::device_span<std::byte const>> _device_buffers;
487  std::vector<cudf::io::datasource*> _user_sources;
488 };
489 
493 struct sink_info {
494  sink_info() = default;
500  sink_info(size_t num_sinks) : _num_sinks(num_sinks) {}
501 
507  explicit sink_info(std::vector<std::string> file_paths)
508  : _type(io_type::FILEPATH), _num_sinks(file_paths.size()), _filepaths(std::move(file_paths))
509  {
510  }
511 
517  explicit sink_info(std::string file_path)
518  : _type(io_type::FILEPATH), _filepaths({std::move(file_path)})
519  {
520  }
521 
527  explicit sink_info(std::vector<std::vector<char>*> buffers)
528  : _type(io_type::HOST_BUFFER), _num_sinks(buffers.size()), _buffers(std::move(buffers))
529  {
530  }
536  explicit sink_info(std::vector<char>* buffer) : _type(io_type::HOST_BUFFER), _buffers({buffer}) {}
537 
543  explicit sink_info(std::vector<cudf::io::data_sink*> const& user_sinks)
544  : _type(io_type::USER_IMPLEMENTED),
545  _num_sinks(user_sinks.size()),
546  _user_sinks(std::move(user_sinks))
547  {
548  }
549 
555  explicit sink_info(class cudf::io::data_sink* user_sink)
556  : _type(io_type::USER_IMPLEMENTED), _user_sinks({user_sink})
557  {
558  }
559 
565  [[nodiscard]] auto type() const { return _type; }
571  [[nodiscard]] auto num_sinks() const { return _num_sinks; }
577  [[nodiscard]] auto const& filepaths() const { return _filepaths; }
583  [[nodiscard]] auto const& buffers() const { return _buffers; }
589  [[nodiscard]] auto const& user_sinks() const { return _user_sinks; }
590 
591  private:
592  io_type _type = io_type::VOID;
593  size_t _num_sinks = 1;
594  std::vector<std::string> _filepaths;
595  std::vector<std::vector<char>*> _buffers;
596  std::vector<cudf::io::data_sink*> _user_sinks;
597 };
598 
599 class table_input_metadata;
600 
605  friend table_input_metadata;
606  std::string _name = "";
607  std::optional<bool> _nullable;
608  bool _list_column_is_map = false;
609  bool _use_int96_timestamp = false;
610  bool _output_as_binary = false;
611  bool _skip_compression = false;
612  std::optional<uint8_t> _decimal_precision;
613  std::optional<int32_t> _parquet_field_id;
614  std::optional<int32_t> _type_length;
615  std::vector<column_in_metadata> children;
616  column_encoding _encoding = column_encoding::USE_DEFAULT;
617 
618  public:
619  column_in_metadata() = default;
625  column_in_metadata(std::string_view name) : _name{name} {}
633  {
634  children.push_back(child);
635  return *this;
636  }
637 
644  column_in_metadata& set_name(std::string const& name) noexcept
645  {
646  _name = name;
647  return *this;
648  }
649 
657  {
658  _nullable = nullable;
659  return *this;
660  }
661 
670  {
671  _list_column_is_map = true;
672  return *this;
673  }
674 
684  {
685  _use_int96_timestamp = req;
686  return *this;
687  }
688 
696  column_in_metadata& set_decimal_precision(uint8_t precision) noexcept
697  {
698  _decimal_precision = precision;
699  return *this;
700  }
701 
709  column_in_metadata& set_type_length(int32_t length) noexcept
710  {
711  _type_length = length;
712  return *this;
713  }
714 
721  column_in_metadata& set_parquet_field_id(int32_t field_id) noexcept
722  {
723  _parquet_field_id = field_id;
724  return *this;
725  }
726 
736  {
737  _output_as_binary = binary;
738  if (_output_as_binary and children.size() == 1) {
739  children.emplace_back();
740  } else if (!_output_as_binary and children.size() == 2) {
741  children.pop_back();
742  }
743  return *this;
744  }
745 
754  {
755  _skip_compression = skip;
756  return *this;
757  }
758 
770  {
771  _encoding = encoding;
772  return *this;
773  }
774 
781  column_in_metadata& child(size_type i) noexcept { return children[i]; }
782 
789  [[nodiscard]] column_in_metadata const& child(size_type i) const noexcept { return children[i]; }
790 
796  [[nodiscard]] std::string const& get_name() const noexcept { return _name; }
797 
803  [[nodiscard]] bool is_nullability_defined() const noexcept { return _nullable.has_value(); }
804 
812  [[nodiscard]] bool nullable() const { return _nullable.value(); }
813 
819  [[nodiscard]] bool is_map() const noexcept { return _list_column_is_map; }
820 
827  [[nodiscard]] bool is_enabled_int96_timestamps() const noexcept { return _use_int96_timestamp; }
828 
834  [[nodiscard]] bool is_decimal_precision_set() const noexcept
835  {
836  return _decimal_precision.has_value();
837  }
838 
846  [[nodiscard]] uint8_t get_decimal_precision() const { return _decimal_precision.value(); }
847 
853  [[nodiscard]] bool is_type_length_set() const noexcept { return _type_length.has_value(); }
854 
862  [[nodiscard]] uint8_t get_type_length() const { return _type_length.value(); }
863 
869  [[nodiscard]] bool is_parquet_field_id_set() const noexcept
870  {
871  return _parquet_field_id.has_value();
872  }
873 
881  [[nodiscard]] int32_t get_parquet_field_id() const { return _parquet_field_id.value(); }
882 
888  [[nodiscard]] size_type num_children() const noexcept { return children.size(); }
889 
895  [[nodiscard]] bool is_enabled_output_as_binary() const noexcept { return _output_as_binary; }
896 
902  [[nodiscard]] bool is_enabled_skip_compression() const noexcept { return _skip_compression; }
903 
909  [[nodiscard]] column_encoding get_encoding() const { return _encoding; }
910 };
911 
916  public:
917  table_input_metadata() = default; // Required by cython
918 
927 
936  explicit table_input_metadata(table_metadata const& metadata);
937 
938  std::vector<column_in_metadata> column_metadata;
939 };
940 
950 
951  partition_info() = default;
958  partition_info(size_type start_row, size_type num_rows) : start_row(start_row), num_rows(num_rows)
959  {
960  }
961 };
962 
968  // Whether to read binary data as a string column
969  bool _convert_binary_to_strings{true};
970  int32_t _type_length{0};
971 
972  std::vector<reader_column_schema> children;
973 
974  public:
975  reader_column_schema() = default;
976 
982  reader_column_schema(size_type number_of_children) { children.resize(number_of_children); }
983 
989  reader_column_schema(std::span<reader_column_schema> const& child_span)
990  {
991  children.assign(child_span.begin(), child_span.end());
992  }
993 
1001  {
1002  children.push_back(child);
1003  return *this;
1004  }
1005 
1012  [[nodiscard]] reader_column_schema& child(size_type i) { return children[i]; }
1013 
1020  [[nodiscard]] reader_column_schema const& child(size_type i) const { return children[i]; }
1021 
1031  {
1032  _convert_binary_to_strings = convert_to_string;
1033  return *this;
1034  }
1035 
1043  {
1044  _type_length = type_length;
1045  return *this;
1046  }
1047 
1053  [[nodiscard]] bool is_enabled_convert_binary_to_strings() const
1054  {
1055  return _convert_binary_to_strings;
1056  }
1057 
1063  [[nodiscard]] int32_t get_type_length() const { return _type_length; }
1064 
1070  [[nodiscard]] size_t get_num_children() const { return children.size(); }
1071 };
1072  // end of group
1074 } // namespace io
1075 } // namespace CUDF_EXPORT cudf
Metadata for a column.
Definition: types.hpp:604
column_in_metadata & set_name(std::string const &name) noexcept
Set the name of this column.
Definition: types.hpp:644
column_in_metadata & add_child(column_in_metadata const &child)
Add the children metadata of this column.
Definition: types.hpp:632
bool is_enabled_output_as_binary() const noexcept
Get whether to encode this column as binary or string data.
Definition: types.hpp:895
column_in_metadata & set_parquet_field_id(int32_t field_id) noexcept
Set the parquet field id of this column.
Definition: types.hpp:721
column_in_metadata & set_int96_timestamps(bool req) noexcept
Specifies whether this timestamp column should be encoded using the deprecated int96 physical type....
Definition: types.hpp:683
column_in_metadata & set_decimal_precision(uint8_t precision) noexcept
Set the decimal precision of this column. Only valid if this column is a decimal (fixed-point) type.
Definition: types.hpp:696
bool is_enabled_int96_timestamps() const noexcept
Get whether to encode this timestamp column using deprecated int96 physical type.
Definition: types.hpp:827
bool is_parquet_field_id_set() const noexcept
Get whether parquet field id has been set for this column.
Definition: types.hpp:869
bool is_decimal_precision_set() const noexcept
Get whether precision has been set for this decimal column.
Definition: types.hpp:834
bool is_type_length_set() const noexcept
Get whether type length has been set for this column.
Definition: types.hpp:853
bool nullable() const
Gets the explicitly set nullability for this column.
Definition: types.hpp:812
size_type num_children() const noexcept
Get the number of children of this column.
Definition: types.hpp:888
bool is_map() const noexcept
If this is the metadata of a list column, returns whether it is to be encoded as a map.
Definition: types.hpp:819
uint8_t get_decimal_precision() const
Get the decimal precision that was set for this column.
Definition: types.hpp:846
column_in_metadata & set_encoding(column_encoding encoding) noexcept
Sets the encoding to use for this column.
Definition: types.hpp:769
column_encoding get_encoding() const
Get the encoding that was set for this column.
Definition: types.hpp:909
uint8_t get_type_length() const
Get the type length that was set for this column.
Definition: types.hpp:862
column_in_metadata & set_output_as_binary(bool binary) noexcept
Specifies whether this column should be written as binary or string data Only valid for the following...
Definition: types.hpp:735
column_in_metadata & child(size_type i) noexcept
Get reference to a child of this column.
Definition: types.hpp:781
column_in_metadata & set_type_length(int32_t length) noexcept
Set the data length of the column. Only valid if this column is a fixed-length byte array.
Definition: types.hpp:709
bool is_enabled_skip_compression() const noexcept
Get whether to skip compressing this column.
Definition: types.hpp:902
int32_t get_parquet_field_id() const
Get the parquet field id that was set for this column.
Definition: types.hpp:881
column_in_metadata & set_list_column_as_map() noexcept
Specify that this list column should be encoded as a map in the written file.
Definition: types.hpp:669
column_in_metadata(std::string_view name)
Construct a new column in metadata object.
Definition: types.hpp:625
std::string const & get_name() const noexcept
Get the name of this column.
Definition: types.hpp:796
column_in_metadata & set_nullability(bool nullable) noexcept
Set the nullability of this column.
Definition: types.hpp:656
bool is_nullability_defined() const noexcept
Get whether nullability has been explicitly set for this column.
Definition: types.hpp:803
column_in_metadata const & child(size_type i) const noexcept
Get const reference to a child of this column.
Definition: types.hpp:789
column_in_metadata & set_skip_compression(bool skip) noexcept
Specifies whether this column should not be compressed regardless of the compression codec specified ...
Definition: types.hpp:753
Interface class for storing the output data from the writers.
Definition: data_sink.hpp:36
Interface class for providing input data to the readers.
Definition: datasource.hpp:37
schema element for reader
Definition: types.hpp:967
reader_column_schema const & child(size_type i) const
Get const reference to a child of this column.
Definition: types.hpp:1020
reader_column_schema & set_type_length(int32_t type_length)
Sets the length of fixed length data.
Definition: types.hpp:1042
bool is_enabled_convert_binary_to_strings() const
Get whether to encode this column as binary or string data.
Definition: types.hpp:1053
int32_t get_type_length() const
Get the length in bytes of this fixed length data.
Definition: types.hpp:1063
reader_column_schema & set_convert_binary_to_strings(bool convert_to_string)
Specifies whether this column should be written as binary or string data Only valid for the following...
Definition: types.hpp:1030
size_t get_num_children() const
Get the number of child objects.
Definition: types.hpp:1070
reader_column_schema & add_child(reader_column_schema const &child)
Add the children metadata of this column.
Definition: types.hpp:1000
reader_column_schema(std::span< reader_column_schema > const &child_span)
Construct a new reader column schema object with a span defining the children.
Definition: types.hpp:989
reader_column_schema & child(size_type i)
Get reference to a child of this column.
Definition: types.hpp:1012
reader_column_schema(size_type number_of_children)
Construct a new reader column schema object.
Definition: types.hpp:982
Metadata for a table.
Definition: types.hpp:915
table_input_metadata(table_view const &table)
Construct a new table_input_metadata from a table_view.
table_input_metadata(table_metadata const &metadata)
Construct a new table_input_metadata from a table_metadata object.
std::vector< column_in_metadata > column_metadata
List of column metadata.
Definition: types.hpp:938
Statistics about compression performed by a writer.
Definition: types.hpp:116
auto compression_ratio() const noexcept
Returns the compression ratio for the successfully compressed blocks.
Definition: types.hpp:199
auto num_total_input_bytes() const noexcept
Returns the total size of compression inputs.
Definition: types.hpp:186
writer_compression_statistics & operator+=(writer_compression_statistics const &other) noexcept
Adds the values from another writer_compression_statistics object.
Definition: types.hpp:148
auto num_failed_bytes() const noexcept
Returns the number of bytes in blocks that failed to compress.
Definition: types.hpp:172
writer_compression_statistics()=default
Default constructor.
auto num_skipped_bytes() const noexcept
Returns the number of bytes in blocks that were skipped during compression.
Definition: types.hpp:179
writer_compression_statistics(size_t num_compressed_bytes, size_t num_failed_bytes, size_t num_skipped_bytes, size_t num_compressed_output_bytes)
Constructor with initial values.
Definition: types.hpp:131
auto num_compressed_bytes() const noexcept
Returns the number of bytes in blocks that were successfully compressed.
Definition: types.hpp:165
A set of cudf::column_view's of the same size.
Definition: table_view.hpp:206
A set of cudf::column's of the same size.
Definition: table.hpp:31
statistics_freq
Column statistics granularity type for parquet/orc writers.
Definition: types.hpp:85
column_encoding
Valid encodings for use with column_in_metadata::set_encoding()
Definition: types.hpp:95
quote_style
Behavior when handling quotations in field data.
Definition: types.hpp:75
constexpr auto is_byte_like_type()
Returns true if the type is byte-like, meaning it is reasonable to pass as a pointer to bytes.
Definition: types.hpp:284
dictionary_policy
Control use of dictionary encoding for parquet writer.
Definition: types.hpp:214
compression_type
Compression algorithms.
Definition: types.hpp:46
io_type
Data source or destination types.
Definition: types.hpp:64
@ STATISTICS_COLUMN
Full column and offset indices. Implies STATISTICS_ROWGROUP.
Definition: types.hpp:89
@ STATISTICS_ROWGROUP
Per-Rowgroup column statistics.
Definition: types.hpp:87
@ STATISTICS_NONE
No column statistics.
Definition: types.hpp:86
@ STATISTICS_PAGE
Per-page column statistics.
Definition: types.hpp:88
@ USE_DEFAULT
No encoding has been requested, use default encoding.
@ MINIMAL
Quote only fields which contain special characters.
@ NONNUMERIC
Quote all non-numeric fields.
@ ALWAYS
Use dictionary regardless of impact on compression.
Definition: types.hpp:217
@ ADAPTIVE
Use dictionary when it will not impact compression.
Definition: types.hpp:216
@ NEVER
Never use dictionary encoding.
Definition: types.hpp:215
@ XZ
XZ format, using LZMA(2) algorithm.
@ ZIP
ZIP format, using DEFLATE algorithm.
@ BZIP2
BZIP2 format, using Burrows-Wheeler transform.
@ AUTO
Automatically detect or select compression format.
@ HOST_BUFFER
Input/output is a buffer in host memory.
@ USER_IMPLEMENTED
Input/output is handled by a custom user class.
@ VOID
Input/output is nothing. No work is done. Useful for benchmarking.
@ FILEPATH
Input/output is a file path.
@ DEVICE_BUFFER
Input/output is a buffer in device memory.
std::unique_ptr< column > transform(std::vector< column_view > const &inputs, std::string const &transform_udf, data_type output_type, bool is_ptx, std::optional< void * > user_data=std::nullopt, null_aware is_null_aware=null_aware::NO, output_nullability null_policy=output_nullability::PRESERVE, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
Creates a new column by applying a transform function against every element of the input columns.
cuda::std::span< T, Extent > device_span
Device span is an alias of cuda::std::span.
Definition: span.hpp:296
int32_t size_type
Row index type for columns and tables.
Definition: types.hpp:84
cuDF interfaces
Definition: host_udf.hpp:26
bool nullable(table_view const &view)
Returns True if any of the columns in the table is nullable. (not entire hierarchy)
@ ALL
All initialization steps (default behavior)
APIs for spans.
Host span, a non-owning view over a contiguous sequence of host-accessible elements.
Definition: span.hpp:65
Detailed name (and optionally nullability) information for output columns.
Definition: types.hpp:226
std::optional< bool > is_nullable
Column nullability.
Definition: types.hpp:228
std::optional< bool > is_binary
Column is binary (i.e. not a list)
Definition: types.hpp:229
std::vector< column_name_info > children
Child column names.
Definition: types.hpp:231
bool operator==(column_name_info const &rhs) const =default
Compares two column name info structs for equality.
std::optional< int32_t > type_length
Byte width of data (for fixed length data)
Definition: types.hpp:230
std::string name
Column name.
Definition: types.hpp:227
A file path with an optional known size in bytes.
Definition: types.hpp:298
std::string path
Path or URL of the input file.
Definition: types.hpp:299
Information used while writing partitioned datasets.
Definition: types.hpp:947
partition_info(size_type start_row, size_type num_rows)
Construct a new partition_info.
Definition: types.hpp:958
size_type start_row
The start row of the partition.
Definition: types.hpp:948
size_type num_rows
The number of rows in the partition.
Definition: types.hpp:949
Destination information for write interfaces.
Definition: types.hpp:493
auto const & buffers() const
Get the host buffers of the input.
Definition: types.hpp:583
sink_info(std::vector< std::vector< char > * > buffers)
Construct a new sink info object for multiple host buffers.
Definition: types.hpp:527
auto const & filepaths() const
Get the filepaths of the input.
Definition: types.hpp:577
sink_info(std::string file_path)
Construct a new sink info object for a single file.
Definition: types.hpp:517
sink_info(class cudf::io::data_sink *user_sink)
Construct a new sink info object for a single user-implemented sink.
Definition: types.hpp:555
sink_info(std::vector< cudf::io::data_sink * > const &user_sinks)
Construct a new sink info object for multiple user-implemented sinks.
Definition: types.hpp:543
auto num_sinks() const
Get the number of sinks.
Definition: types.hpp:571
auto const & user_sinks() const
Get the user sinks of the input.
Definition: types.hpp:589
sink_info(size_t num_sinks)
Construct a new sink info object.
Definition: types.hpp:500
auto type() const
Get the type of the input.
Definition: types.hpp:565
sink_info(std::vector< char > *buffer)
Construct a new sink info object for a single host buffer.
Definition: types.hpp:536
sink_info(std::vector< std::string > file_paths)
Construct a new sink info object for multiple files.
Definition: types.hpp:507
Source information for read interfaces.
Definition: types.hpp:306
auto const & device_buffers() const
Get the device buffers of the input.
Definition: types.hpp:456
source_info()=default
Default constructor for the next-gen parquet reader.
source_info(std::vector< std::string > file_paths)
Construct a new source info object for multiple files.
Definition: types.hpp:317
auto const & filepath_sources() const
Get the filepath sources of the input.
Definition: types.hpp:438
auto const & filepaths() const
Get the filepaths of the input.
Definition: types.hpp:444
source_info(cudf::host_span< T > host_data)
Construct a new source info object for a single buffer.
Definition: types.hpp:377
source_info(std::vector< filepath_source > sources)
Construct a new source info object from filepath sources with optional known sizes.
Definition: types.hpp:342
auto num_sources() const
Get the number of input sources.
Definition: types.hpp:469
source_info(cudf::host_span< cudf::host_span< T >> const host_buffers)
Construct a new source info object for multiple buffers in host memory.
Definition: types.hpp:354
source_info(cudf::device_span< std::byte const > d_buffer)
Construct a new source info object from a device buffer.
Definition: types.hpp:402
source_info(cudf::io::datasource *source)
Construct a new source info object for a single user-implemented source.
Definition: types.hpp:422
source_info(std::vector< cudf::io::datasource * > const &sources)
Construct a new source info object for multiple user-implemented sources.
Definition: types.hpp:412
source_info(cudf::host_span< cudf::device_span< std::byte const >> device_buffers)
Construct a new source info object for multiple buffers in device memory.
Definition: types.hpp:390
auto const & host_buffers() const
Get the host buffers of the input.
Definition: types.hpp:450
auto type() const
Get the type of the input.
Definition: types.hpp:432
source_info(std::string file_path)
Construct a new source info object for a single file.
Definition: types.hpp:332
auto const & user_sources() const
Get the user sources of the input.
Definition: types.hpp:462
Table metadata returned by IO readers.
Definition: types.hpp:245
std::vector< std::unordered_map< std::string, std::string > > per_file_user_data
Per file format-dependent metadata as key-values pairs.
Definition: types.hpp:254
std::optional< size_type > num_row_groups_after_stats_filter
Definition: types.hpp:259
std::optional< size_type > num_row_groups_after_bloom_filter
Definition: types.hpp:263
std::vector< size_t > num_rows_per_source
Definition: types.hpp:248
std::vector< column_name_info > schema_info
Detailed name information for the entire output hierarchy.
Definition: types.hpp:247
std::map< std::string, std::string > user_data
Definition: types.hpp:251
Table with table metadata used by io readers to return the metadata by value.
Definition: types.hpp:271
std::unique_ptr< table > tbl
Table.
Definition: types.hpp:272
table_metadata metadata
Table metadata.
Definition: types.hpp:273
Class definition for cudf::table.
Type declarations for libcudf.