cudftable.hpp
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2025, NVIDIA CORPORATION.
3  * SPDX-License-Identifier: Apache-2.0
4  */
5 
6 #pragma once
7 
8 #include <cudf/io/types.hpp>
9 #include <cudf/packed_types.hpp>
10 #include <cudf/table/table.hpp>
12 #include <cudf/utilities/export.hpp>
14 
15 #include <rmm/cuda_stream_view.hpp>
16 
17 #include <utility>
18 
19 namespace CUDF_EXPORT cudf {
20 namespace io::experimental {
21 
32 class cudftable_writer_options_builder;
33 
38  sink_info _sink;
39  table_view _table;
40 
42 
50  : _sink(std::move(sink)), _table(std::move(table))
51  {
52  }
53 
54  public:
64 
70  [[nodiscard]] sink_info const& get_sink() const noexcept { return _sink; }
71 
77  [[nodiscard]] table_view const& get_table() const noexcept { return _table; }
78 
84  void set_sink(sink_info sink) { _sink = std::move(sink); }
85 };
86 
91  public:
99  : _options(sink, table)
100  {
101  }
102 
108  [[nodiscard]] cudftable_writer_options build() const { return _options; }
109 
110  private:
111  cudftable_writer_options _options;
112 };
113  // end of io_writers group
115 
121 class cudftable_reader_options_builder;
122 
127  source_info _source;
128 
130 
136  explicit cudftable_reader_options(source_info src) : _source{std::move(src)} {}
137 
138  public:
146 
152  [[nodiscard]] source_info const& get_source() const noexcept { return _source; }
153 
159  void set_source(source_info src) { _source = std::move(src); }
160 };
161 
166  public:
172  explicit cudftable_reader_options_builder(source_info src) : _options(std::move(src)) {}
173 
179  [[nodiscard]] cudftable_reader_options build() const { return _options; }
180 
181  private:
182  cudftable_reader_options _options;
183 };
184  // end of io_readers group
186 
204  // end of group
231  cudftable_reader_options const& options,
234  // end of group
236 } // namespace io::experimental
237 } // namespace CUDF_EXPORT cudf
Class to build cudftable_reader_options.
Definition: cudftable.hpp:165
cudftable_reader_options_builder(source_info src)
Constructor from source info.
Definition: cudftable.hpp:172
cudftable_reader_options build() const
Build cudftable_reader_options.
Definition: cudftable.hpp:179
void set_source(source_info src)
Sets source info.
Definition: cudftable.hpp:159
static cudftable_reader_options_builder builder(source_info src=source_info{})
Creates a cudftable_reader_options_builder to build cudftable_reader_options.
source_info const & get_source() const noexcept
Returns source info.
Definition: cudftable.hpp:152
Class to build cudftable_writer_options.
Definition: cudftable.hpp:90
cudftable_writer_options_builder(sink_info const &sink, table_view const &table)
Constructor from sink and table.
Definition: cudftable.hpp:98
cudftable_writer_options build() const
Build cudftable_writer_options.
Definition: cudftable.hpp:108
Settings for write_cudftable().
Definition: cudftable.hpp:37
static cudftable_writer_options_builder builder(sink_info const &sink, table_view const &table)
Create builder to create cudftable_writer_options.
sink_info const & get_sink() const noexcept
Returns sink used for writer output.
Definition: cudftable.hpp:70
table_view const & get_table() const noexcept
Returns table that would be written to output.
Definition: cudftable.hpp:77
void set_sink(sink_info sink)
Sets sink info.
Definition: cudftable.hpp:84
A set of cudf::column_view's of the same size.
Definition: table_view.hpp:189
A set of cudf::column's of the same size.
Definition: table.hpp:29
rmm::cuda_stream_view const get_default_stream()
Get the current default stream.
packed_table read_cudftable(cudftable_reader_options const &options, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
Read a table in CudfTable binary format.
void write_cudftable(cudftable_writer_options const &options, rmm::cuda_stream_view stream=cudf::get_default_stream())
Write a table using the CudfTable binary format.
rmm::device_async_resource_ref get_current_device_resource_ref()
Get the current device memory resource reference.
detail::cccl_async_resource_ref< cuda::mr::resource_ref< cuda::mr::device_accessible > > device_async_resource_ref
cuDF-IO API type definitions
cuDF interfaces
Definition: host_udf.hpp:26
Packed table and column types for serialization.
Destination information for write interfaces.
Definition: io/types.hpp:471
Source information for read interfaces.
Definition: io/types.hpp:316
A table with its data stored in a contiguous, serialized format.
Class definition for cudf::table.