32 #include <unordered_map>
143 size_t num_compressed_output_bytes)
147 _num_compressed_output_bytes(num_compressed_output_bytes)
159 _num_compressed_bytes += other._num_compressed_bytes;
160 _num_failed_bytes += other._num_failed_bytes;
161 _num_skipped_bytes += other._num_skipped_bytes;
162 _num_compressed_output_bytes += other._num_compressed_output_bytes;
214 std::size_t _num_compressed_bytes = 0;
215 std::size_t _num_failed_bytes = 0;
216 std::size_t _num_skipped_bytes = 0;
217 std::size_t _num_compressed_output_bytes = 0;
246 column_name_info(std::string
const& _name, std::optional<bool> _is_nullable = std::nullopt)
258 std::vector<column_name_info>
262 std::vector<std::unordered_map<std::string, std::string>>
270 std::unique_ptr<table>
tbl;
302 template <
typename T>
305 using non_cv_T = std::remove_cv_t<T>;
306 return std::is_same_v<non_cv_T, int8_t> || std::is_same_v<non_cv_T, char> ||
307 std::is_same_v<non_cv_T, uint8_t> || std::is_same_v<non_cv_T, unsigned char> ||
308 std::is_same_v<non_cv_T, std::byte>;
349 std::back_inserter(_host_buffers),
351 return cudf::host_span<std::byte const>{
352 reinterpret_cast<std::byte const*>(hb.data), hb.size};
376 template <
typename T, CUDF_ENABLE_IF(is_
byte_like_type<std::remove_cv_t<T>>())>
380 if constexpr (not std::is_same_v<std::remove_cv_t<T>, std::byte>) {
381 _host_buffers.reserve(host_buffers.size());
384 std::back_inserter(_host_buffers),
386 return cudf::host_span<std::byte const>{
387 reinterpret_cast<std::byte const*>(s.data()), s.size()};
390 _host_buffers.assign(host_buffers.begin(), host_buffers.end());
399 template <
typename T, CUDF_ENABLE_IF(is_
byte_like_type<std::remove_cv_t<T>>())>
403 reinterpret_cast<std::byte const*>(host_data.data()), host_data.size())}
432 explicit source_info(std::vector<cudf::io::datasource*>
const& sources)
452 [[nodiscard]]
auto type()
const {
return _type; }
458 [[nodiscard]]
auto const&
filepaths()
const {
return _filepaths; }
464 [[nodiscard]]
auto const&
host_buffers()
const {
return _host_buffers; }
476 [[nodiscard]]
auto const&
user_sources()
const {
return _user_sources; }
480 std::vector<std::string> _filepaths;
481 std::vector<cudf::host_span<std::byte const>> _host_buffers;
482 std::vector<cudf::device_span<std::byte const>> _device_buffers;
483 std::vector<cudf::io::datasource*> _user_sources;
503 explicit sink_info(std::vector<std::string>
const& file_paths)
504 : _type(
io_type::
FILEPATH), _num_sinks(file_paths.size()), _filepaths(file_paths)
523 explicit sink_info(std::vector<std::vector<char>*>
const& buffers)
539 explicit sink_info(std::vector<cudf::io::data_sink*>
const& user_sinks)
559 [[nodiscard]]
auto type()
const {
return _type; }
565 [[nodiscard]]
auto num_sinks()
const {
return _num_sinks; }
571 [[nodiscard]]
auto const&
filepaths()
const {
return _filepaths; }
577 [[nodiscard]]
auto const&
buffers()
const {
return _buffers; }
583 [[nodiscard]]
auto const&
user_sinks()
const {
return _user_sinks; }
587 size_t _num_sinks = 1;
588 std::vector<std::string> _filepaths;
589 std::vector<std::vector<char>*> _buffers;
590 std::vector<cudf::io::data_sink*> _user_sinks;
593 class table_input_metadata;
600 std::string _name =
"";
601 std::optional<bool> _nullable;
602 bool _list_column_is_map =
false;
603 bool _use_int96_timestamp =
false;
604 bool _output_as_binary =
false;
605 std::optional<uint8_t> _decimal_precision;
606 std::optional<int32_t> _parquet_field_id;
607 std::vector<column_in_metadata> children;
626 children.push_back(child);
663 _list_column_is_map =
true;
677 _use_int96_timestamp = req;
690 _decimal_precision = precision;
702 _parquet_field_id = field_id;
716 _output_as_binary = binary;
717 if (_output_as_binary and children.size() == 1) {
718 children.emplace_back();
719 }
else if (!_output_as_binary and children.size() == 2) {
737 _encoding = encoding;
762 [[nodiscard]] std::string
get_name() const noexcept {
return _name; }
778 [[nodiscard]]
bool nullable()
const {
return _nullable.value(); }
785 [[nodiscard]]
bool is_map() const noexcept {
return _list_column_is_map; }
802 return _decimal_precision.has_value();
821 return _parquet_field_id.has_value();
912 bool _convert_binary_to_strings{
true};
914 std::vector<reader_column_schema> children;
933 children.assign(child_span.
begin(), child_span.
end());
944 children.push_back(child);
974 _convert_binary_to_strings = convert_to_string;
985 return _convert_binary_to_strings;
constexpr iterator end() const noexcept
Returns an iterator to the element following the last element of the span.
constexpr iterator begin() const noexcept
Returns an iterator to the first element of the span.
Interface class for storing the output data from the writers.
Interface class for providing input data to the readers.
schema element for reader
reader_column_schema const & child(size_type i) const
Get const reference to a child of this column.
bool is_enabled_convert_binary_to_strings() const
Get whether to encode this column as binary or string data.
reader_column_schema(host_span< reader_column_schema > const &child_span)
Construct a new reader column schema object with a span defining the children.
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...
size_t get_num_children() const
Get the number of child objects.
reader_column_schema & add_child(reader_column_schema const &child)
Add the children metadata of this column.
reader_column_schema & child(size_type i)
Get reference to a child of this column.
reader_column_schema(size_type number_of_children)
Construct a new reader column schema object.
Statistics about compression performed by a writer.
auto compression_ratio() const noexcept
Returns the compression ratio for the successfully compressed blocks.
auto num_total_input_bytes() const noexcept
Returns the total size of compression inputs.
writer_compression_statistics & operator+=(writer_compression_statistics const &other) noexcept
Adds the values from another writer_compression_statistics object.
auto num_failed_bytes() const noexcept
Returns the number of bytes in blocks that failed to compress.
writer_compression_statistics()=default
Default constructor.
auto num_skipped_bytes() const noexcept
Returns the number of bytes in blocks that were skipped during compression.
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.
auto num_compressed_bytes() const noexcept
Returns the number of bytes in blocks that were successfully compressed.
A set of cudf::column_view's of the same size.
A set of cudf::column's of the same size.
io_type
Data source or destination types.
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.
compression_type
Compression algorithms.
quote_style
Behavior when handling quotations in field data.
column_encoding
Valid encodings for use with column_in_metadata::set_encoding()
statistics_freq
Column statistics granularity type for parquet/orc writers.
dictionary_policy
Control use of dictionary encoding for parquet writer.
@ 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.
@ BROTLI
BROTLI format, using LZ77 + Huffman + 2nd order context modeling.
@ SNAPPY
Snappy format, using byte-oriented LZ77.
@ XZ
XZ format, using LZMA(2) algorithm.
@ ZIP
ZIP format, using DEFLATE algorithm.
@ LZO
Lempel–Ziv–Oberhumer format.
@ BZIP2
BZIP2 format, using Burrows-Wheeler transform.
@ ZLIB
ZLIB format, using DEFLATE algorithm.
@ LZ4
LZ4 format, using LZ77.
@ AUTO
Automatically detect or select compression format.
@ GZIP
GZIP format, using DEFLATE algorithm.
@ MINIMAL
Quote only fields which contain special characters.
@ NONE
Never quote fields; disable quotation parsing.
@ NONNUMERIC
Quote all non-numeric fields.
@ DELTA_BINARY_PACKED
Use DELTA_BINARY_PACKED encoding (only valid for integer columns)
@ DIRECT
Use DIRECT encoding.
@ DIRECT_V2
Use DIRECT_V2 encoding.
@ DICTIONARY
Use dictionary encoding.
@ USE_DEFAULT
No encoding has been requested, use default encoding.
@ DELTA_LENGTH_BYTE_ARRAY
@ DICTIONARY_V2
Use DICTIONARY_V2 encoding.
@ PLAIN
Use plain encoding.
@ STATISTICS_COLUMN
Full column and offset indices. Implies STATISTICS_ROWGROUP.
@ STATISTICS_ROWGROUP
Per-Rowgroup column statistics.
@ STATISTICS_NONE
No column statistics.
@ STATISTICS_PAGE
Per-page column statistics.
@ ALWAYS
Use dictionary regardless of impact on compression.
@ ADAPTIVE
Use dictionary when it will not impact compression.
@ NEVER
Never use dictionary encoding.
int32_t size_type
Row index type for columns and tables.
bool nullable(table_view const &view)
Returns True if any of the columns in the table is nullable. (not entire hierarchy)
Device version of C++20 std::span with reduced feature set.
C++20 std::span with reduced feature set.
Detailed name (and optionally nullability) information for output columns.
std::optional< bool > is_nullable
Column nullability.
std::vector< column_name_info > children
Child column names.
column_name_info(std::string const &_name, std::optional< bool > _is_nullable=std::nullopt)
Construct a column name info with a name, optional nullabilty, and no children.
std::string name
Column name.
Non-owning view of a host memory buffer.
char const * data
Pointer to the buffer.
size_t size
Size of the buffer.
host_buffer(char const *data, size_t size)
Construct a new host buffer object.
Information used while writing partitioned datasets.
partition_info(size_type start_row, size_type num_rows)
Construct a new partition_info.
size_type start_row
The start row of the partition.
size_type num_rows
The number of rows in the partition.
Destination information for write interfaces.
auto const & buffers() const
Get the host buffers of the input.
sink_info(std::vector< std::vector< char > * > const &buffers)
Construct a new sink info object for multiple host buffers.
sink_info(std::string const &file_path)
Construct a new sink info object for a single file.
auto const & filepaths() const
Get the filepaths of the input.
sink_info(class cudf::io::data_sink *user_sink)
Construct a new sink info object for a single user-implemented sink.
sink_info(std::vector< cudf::io::data_sink * > const &user_sinks)
Construct a new sink info object for multiple user-implemented sinks.
auto num_sinks() const
Get the number of sinks.
auto const & user_sinks() const
Get the user sinks of the input.
sink_info(std::vector< std::string > const &file_paths)
Construct a new sink info object for multiple files.
sink_info(size_t num_sinks)
Construct a new sink info object.
auto type() const
Get the type of the input.
sink_info(std::vector< char > *buffer)
Construct a new sink info object for a single host buffer.
Source information for read interfaces.
auto const & device_buffers() const
Get the device buffers of the input.
source_info(char const *host_data, size_t size)
Construct a new source info object for a single buffer.
auto const & filepaths() const
Get the filepaths of the input.
source_info(cudf::host_span< T > host_data)
Construct a new source info object for a single buffer.
source_info(std::string const &file_path)
Construct a new source info object for a single file.
source_info(cudf::host_span< cudf::host_span< T >> const host_buffers)
Construct a new source info object for multiple buffers in host memory.
source_info(cudf::device_span< std::byte const > d_buffer)
Construct a new source info object from a device buffer.
source_info(cudf::io::datasource *source)
Construct a new source info object for a single user-implemented source.
source_info(std::vector< cudf::io::datasource * > const &sources)
Construct a new source info object for multiple user-implemented sources.
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.
auto const & host_buffers() const
Get the host buffers of the input.
auto type() const
Get the type of the input.
source_info(std::vector< std::string > const &file_paths)
Construct a new source info object for multiple files.
auto const & user_sources() const
Get the user sources of the input.
source_info(std::vector< host_buffer > const &host_buffers)
Construct a new source info object for multiple buffers in host memory.
Class definition for cudf::table.
Type declarations for libcudf.