orc.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2020-2024, NVIDIA CORPORATION.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #pragma once
18 
19 #include <cudf/io/detail/orc.hpp>
20 #include <cudf/io/types.hpp>
22 #include <cudf/types.hpp>
23 
25 
26 #include <memory>
27 #include <optional>
28 #include <string>
29 #include <unordered_map>
30 #include <vector>
31 
32 namespace cudf {
33 namespace io {
40 constexpr size_t default_stripe_size_bytes = 64 * 1024 * 1024;
41 constexpr size_type default_stripe_size_rows = 1000000;
43 
48 
53  source_info _source;
54 
55  // Names of column to read; `nullopt` is all
56  std::optional<std::vector<std::string>> _columns;
57 
58  // List of individual stripes to read (ignored if empty)
59  std::vector<std::vector<size_type>> _stripes;
60  // Rows to skip from the start; ORC stores the number of rows as uint64_t
61  uint64_t _skip_rows = 0;
62  // Rows to read; `nullopt` is all
63  std::optional<size_type> _num_rows;
64 
65  // Whether to use row index to speed-up reading
66  bool _use_index = true;
67 
68  // Whether to use numpy-compatible dtypes
69  bool _use_np_dtypes = true;
70  // Cast timestamp columns to a specific type
71  data_type _timestamp_type{type_id::EMPTY};
72 
73  // Columns that should be read as Decimal128
74  std::vector<std::string> _decimal128_columns;
75 
77 
83  explicit orc_reader_options(source_info src) : _source{std::move(src)} {}
84 
85  public:
91  orc_reader_options() = default;
92 
100 
106  [[nodiscard]] source_info const& get_source() const { return _source; }
107 
113  [[nodiscard]] auto const& get_columns() const { return _columns; }
114 
120  [[nodiscard]] auto const& get_stripes() const { return _stripes; }
121 
127  uint64_t get_skip_rows() const { return _skip_rows; }
128 
135  std::optional<size_type> const& get_num_rows() const { return _num_rows; }
136 
142  bool is_enabled_use_index() const { return _use_index; }
143 
149  bool is_enabled_use_np_dtypes() const { return _use_np_dtypes; }
150 
156  data_type get_timestamp_type() const { return _timestamp_type; }
157 
163  std::vector<std::string> const& get_decimal128_columns() const { return _decimal128_columns; }
164 
165  // Setters
166 
172  void set_columns(std::vector<std::string> col_names) { _columns = std::move(col_names); }
173 
184  void set_stripes(std::vector<std::vector<size_type>> stripes)
185  {
186  CUDF_EXPECTS(stripes.empty() or (_skip_rows == 0), "Can't set stripes along with skip_rows");
187  CUDF_EXPECTS(stripes.empty() or not _num_rows.has_value(),
188  "Can't set stripes along with num_rows");
189  _stripes = std::move(stripes);
190  }
191 
200  void set_skip_rows(uint64_t rows)
201  {
202  CUDF_EXPECTS(rows == 0 or _stripes.empty(), "Can't set both skip_rows along with stripes");
203  _skip_rows = rows;
204  }
205 
215  {
216  CUDF_EXPECTS(nrows >= 0, "num_rows cannot be negative");
217  CUDF_EXPECTS(_stripes.empty(), "Can't set both num_rows and stripes");
218  _num_rows = nrows;
219  }
220 
226  void enable_use_index(bool use) { _use_index = use; }
227 
233  void enable_use_np_dtypes(bool use) { _use_np_dtypes = use; }
234 
240  void set_timestamp_type(data_type type) { _timestamp_type = type; }
241 
247  void set_decimal128_columns(std::vector<std::string> val)
248  {
249  _decimal128_columns = std::move(val);
250  }
251 };
252 
257  orc_reader_options options;
258 
259  public:
265  explicit orc_reader_options_builder() = default;
266 
272  explicit orc_reader_options_builder(source_info src) : options{std::move(src)} {};
273 
280  orc_reader_options_builder& columns(std::vector<std::string> col_names)
281  {
282  options._columns = std::move(col_names);
283  return *this;
284  }
285 
292  orc_reader_options_builder& stripes(std::vector<std::vector<size_type>> stripes)
293  {
294  options.set_stripes(std::move(stripes));
295  return *this;
296  }
297 
305  {
306  options.set_skip_rows(rows);
307  return *this;
308  }
309 
317  {
318  options.set_num_rows(nrows);
319  return *this;
320  }
321 
329  {
330  options._use_index = use;
331  return *this;
332  }
333 
341  {
342  options._use_np_dtypes = use;
343  return *this;
344  }
345 
353  {
354  options._timestamp_type = type;
355  return *this;
356  }
357 
364  orc_reader_options_builder& decimal128_columns(std::vector<std::string> val)
365  {
366  options._decimal128_columns = std::move(val);
367  return *this;
368  }
369 
373  operator orc_reader_options&&() { return std::move(options); }
374 
382  orc_reader_options&& build() { return std::move(options); }
383 };
384 
403  orc_reader_options const& options,
406  // end of group
418 
428 static constexpr statistics_freq ORC_STATISTICS_STRIPE = statistics_freq::STATISTICS_ROWGROUP;
429 static constexpr statistics_freq ORC_STATISTICS_ROW_GROUP = statistics_freq::STATISTICS_PAGE;
430 
435  // Specify the sink to use for writer output
436  sink_info _sink;
437  // Specify the compression format to use
439  // Specify frequency of statistics collection
440  statistics_freq _stats_freq = ORC_STATISTICS_ROW_GROUP;
441  // Maximum size of each stripe (unless smaller than a single row group)
442  size_t _stripe_size_bytes = default_stripe_size_bytes;
443  // Maximum number of rows in stripe (unless smaller than a single row group)
444  size_type _stripe_size_rows = default_stripe_size_rows;
445  // Row index stride (maximum number of rows in each row group)
446  size_type _row_index_stride = default_row_index_stride;
447  // Set of columns to output
448  table_view _table;
449  // Optional associated metadata
450  std::optional<table_input_metadata> _metadata;
451  // Optional footer key_value_metadata
452  std::map<std::string, std::string> _user_data;
453  // Optional compression statistics
454  std::shared_ptr<writer_compression_statistics> _compression_stats;
455  // Specify whether string dictionaries should be alphabetically sorted
456  bool _enable_dictionary_sort = true;
457 
459 
466  explicit orc_writer_options(sink_info const& sink, table_view const& table)
467  : _sink(sink), _table(table)
468  {
469  }
470 
471  public:
477  explicit orc_writer_options() = default;
478 
488 
494  [[nodiscard]] sink_info const& get_sink() const { return _sink; }
495 
501  [[nodiscard]] compression_type get_compression() const { return _compression; }
502 
508  [[nodiscard]] bool is_enabled_statistics() const
509  {
510  return _stats_freq != statistics_freq::STATISTICS_NONE;
511  }
512 
518  [[nodiscard]] statistics_freq get_statistics_freq() const { return _stats_freq; }
519 
525  [[nodiscard]] auto get_stripe_size_bytes() const { return _stripe_size_bytes; }
526 
532  [[nodiscard]] auto get_stripe_size_rows() const { return _stripe_size_rows; }
533 
539  auto get_row_index_stride() const
540  {
541  auto const unaligned_stride = std::min(_row_index_stride, get_stripe_size_rows());
542  return unaligned_stride - unaligned_stride % 8;
543  }
544 
550  [[nodiscard]] table_view get_table() const { return _table; }
551 
557  [[nodiscard]] auto const& get_metadata() const { return _metadata; }
558 
564  [[nodiscard]] std::map<std::string, std::string> const& get_key_value_metadata() const
565  {
566  return _user_data;
567  }
568 
574  [[nodiscard]] std::shared_ptr<writer_compression_statistics> get_compression_statistics() const
575  {
576  return _compression_stats;
577  }
578 
584  [[nodiscard]] bool get_enable_dictionary_sort() const { return _enable_dictionary_sort; }
585 
586  // Setters
587 
593  void set_compression(compression_type comp) { _compression = comp; }
594 
605  void enable_statistics(statistics_freq val) { _stats_freq = val; }
606 
614  void set_stripe_size_bytes(size_t size_bytes)
615  {
616  CUDF_EXPECTS(size_bytes >= 64 << 10, "64KB is the minimum stripe size");
617  _stripe_size_bytes = size_bytes;
618  }
619 
631  {
632  CUDF_EXPECTS(size_rows >= 512, "Maximum stripe size cannot be smaller than 512");
633  _stripe_size_rows = size_rows;
634  }
635 
646  {
647  CUDF_EXPECTS(stride >= 512, "Row index stride cannot be smaller than 512");
648  _row_index_stride = stride;
649  }
650 
656  void set_table(table_view tbl) { _table = tbl; }
657 
663  void set_metadata(table_input_metadata meta) { _metadata = std::move(meta); }
664 
670  void set_key_value_metadata(std::map<std::string, std::string> metadata)
671  {
672  _user_data = std::move(metadata);
673  }
674 
680  void set_compression_statistics(std::shared_ptr<writer_compression_statistics> comp_stats)
681  {
682  _compression_stats = std::move(comp_stats);
683  }
684 
690  void set_enable_dictionary_sort(bool val) { _enable_dictionary_sort = val; }
691 };
692 
697  orc_writer_options options;
698 
699  public:
706 
713  orc_writer_options_builder(sink_info const& sink, table_view const& table) : options{sink, table}
714  {
715  }
716 
724  {
725  options._compression = comp;
726  return *this;
727  }
728 
741  {
742  options._stats_freq = val;
743  return *this;
744  }
745 
753  {
754  options.set_stripe_size_bytes(val);
755  return *this;
756  }
757 
765  {
766  options.set_stripe_size_rows(val);
767  return *this;
768  }
769 
777  {
778  options.set_row_index_stride(val);
779  return *this;
780  }
781 
789  {
790  options._table = tbl;
791  return *this;
792  }
793 
801  {
802  options._metadata = std::move(meta);
803  return *this;
804  }
805 
812  orc_writer_options_builder& key_value_metadata(std::map<std::string, std::string> metadata)
813  {
814  options._user_data = std::move(metadata);
815  return *this;
816  }
817 
825  std::shared_ptr<writer_compression_statistics> const& comp_stats)
826  {
827  options._compression_stats = comp_stats;
828  return *this;
829  }
830 
838  {
839  options._enable_dictionary_sort = val;
840  return *this;
841  }
842 
846  operator orc_writer_options&&() { return std::move(options); }
847 
855  orc_writer_options&& build() { return std::move(options); }
856 };
857 
871 void write_orc(orc_writer_options const& options,
873 
878 
883  // Specify the sink to use for writer output
884  sink_info _sink;
885  // Specify the compression format to use
887  // Specify granularity of statistics collection
888  statistics_freq _stats_freq = ORC_STATISTICS_ROW_GROUP;
889  // Maximum size of each stripe (unless smaller than a single row group)
890  size_t _stripe_size_bytes = default_stripe_size_bytes;
891  // Maximum number of rows in stripe (unless smaller than a single row group)
892  size_type _stripe_size_rows = default_stripe_size_rows;
893  // Row index stride (maximum number of rows in each row group)
894  size_type _row_index_stride = default_row_index_stride;
895  // Optional associated metadata
896  std::optional<table_input_metadata> _metadata;
897  // Optional footer key_value_metadata
898  std::map<std::string, std::string> _user_data;
899  // Optional compression statistics
900  std::shared_ptr<writer_compression_statistics> _compression_stats;
901  // Specify whether string dictionaries should be alphabetically sorted
902  bool _enable_dictionary_sort = true;
903 
905 
911  chunked_orc_writer_options(sink_info const& sink) : _sink(sink) {}
912 
913  public:
919  explicit chunked_orc_writer_options() = default;
920 
929 
935  [[nodiscard]] sink_info const& get_sink() const { return _sink; }
936 
942  [[nodiscard]] compression_type get_compression() const { return _compression; }
943 
949  [[nodiscard]] statistics_freq get_statistics_freq() const { return _stats_freq; }
950 
956  [[nodiscard]] auto get_stripe_size_bytes() const { return _stripe_size_bytes; }
957 
963  [[nodiscard]] auto get_stripe_size_rows() const { return _stripe_size_rows; }
964 
970  auto get_row_index_stride() const
971  {
972  auto const unaligned_stride = std::min(_row_index_stride, get_stripe_size_rows());
973  return unaligned_stride - unaligned_stride % 8;
974  }
975 
981  [[nodiscard]] auto const& get_metadata() const { return _metadata; }
982 
988  [[nodiscard]] std::map<std::string, std::string> const& get_key_value_metadata() const
989  {
990  return _user_data;
991  }
992 
998  [[nodiscard]] std::shared_ptr<writer_compression_statistics> get_compression_statistics() const
999  {
1000  return _compression_stats;
1001  }
1002 
1008  [[nodiscard]] bool get_enable_dictionary_sort() const { return _enable_dictionary_sort; }
1009 
1010  // Setters
1011 
1017  void set_compression(compression_type comp) { _compression = comp; }
1018 
1029  void enable_statistics(statistics_freq val) { _stats_freq = val; }
1030 
1038  void set_stripe_size_bytes(size_t size_bytes)
1039  {
1040  CUDF_EXPECTS(size_bytes >= 64 << 10, "64KB is the minimum stripe size");
1041  _stripe_size_bytes = size_bytes;
1042  }
1043 
1055  {
1056  CUDF_EXPECTS(size_rows >= 512, "maximum stripe size cannot be smaller than 512");
1057  _stripe_size_rows = size_rows;
1058  }
1059 
1070  {
1071  CUDF_EXPECTS(stride >= 512, "Row index stride cannot be smaller than 512");
1072  _row_index_stride = stride;
1073  }
1074 
1080  void metadata(table_input_metadata meta) { _metadata = std::move(meta); }
1081 
1087  void set_key_value_metadata(std::map<std::string, std::string> metadata)
1088  {
1089  _user_data = std::move(metadata);
1090  }
1091 
1097  void set_compression_statistics(std::shared_ptr<writer_compression_statistics> comp_stats)
1098  {
1099  _compression_stats = std::move(comp_stats);
1100  }
1101 
1107  void set_enable_dictionary_sort(bool val) { _enable_dictionary_sort = val; }
1108 };
1109 
1115 
1116  public:
1123 
1129  explicit chunked_orc_writer_options_builder(sink_info const& sink) : options{sink} {}
1130 
1138  {
1139  options._compression = comp;
1140  return *this;
1141  }
1142 
1155  {
1156  options._stats_freq = val;
1157  return *this;
1158  }
1159 
1167  {
1168  options.set_stripe_size_bytes(val);
1169  return *this;
1170  }
1171 
1179  {
1180  options.set_stripe_size_rows(val);
1181  return *this;
1182  }
1183 
1191  {
1192  options.set_row_index_stride(val);
1193  return *this;
1194  }
1195 
1203  {
1204  options._metadata = std::move(meta);
1205  return *this;
1206  }
1207 
1215  std::map<std::string, std::string> metadata)
1216  {
1217  options._user_data = std::move(metadata);
1218  return *this;
1219  }
1220 
1228  std::shared_ptr<writer_compression_statistics> const& comp_stats)
1229  {
1230  options._compression_stats = comp_stats;
1231  return *this;
1232  }
1233 
1241  {
1242  options._enable_dictionary_sort = val;
1243  return *this;
1244  }
1245 
1249  operator chunked_orc_writer_options&&() { return std::move(options); }
1250 
1258  chunked_orc_writer_options&& build() { return std::move(options); }
1259 };
1260 
1283  public:
1288  orc_chunked_writer() = default;
1289 
1298 
1306 
1310  void close();
1311 
1313  std::unique_ptr<orc::detail::writer> writer;
1314 };
1315  // end of group
1317 } // namespace io
1318 } // namespace cudf
Indicator for the logical data type of an element in a column.
Definition: types.hpp:241
Builds settings to use for write_orc_chunked().
Definition: orc.hpp:1113
chunked_orc_writer_options_builder & enable_dictionary_sort(bool val)
Sets whether string dictionaries should be sorted.
Definition: orc.hpp:1240
chunked_orc_writer_options && build()
move chunked_orc_writer_options member once it's built.
Definition: orc.hpp:1258
chunked_orc_writer_options_builder & stripe_size_bytes(size_t val)
Sets the maximum stripe size, in bytes.
Definition: orc.hpp:1166
chunked_orc_writer_options_builder()=default
Default constructor.
chunked_orc_writer_options_builder & stripe_size_rows(size_type val)
Sets the maximum number of rows in output stripes.
Definition: orc.hpp:1178
chunked_orc_writer_options_builder & compression_statistics(std::shared_ptr< writer_compression_statistics > const &comp_stats)
Sets the pointer to the output compression statistics.
Definition: orc.hpp:1227
chunked_orc_writer_options_builder & key_value_metadata(std::map< std::string, std::string > metadata)
Sets Key-Value footer metadata.
Definition: orc.hpp:1214
chunked_orc_writer_options_builder & compression(compression_type comp)
Sets compression type.
Definition: orc.hpp:1137
chunked_orc_writer_options_builder & metadata(table_input_metadata meta)
Sets associated metadata.
Definition: orc.hpp:1202
chunked_orc_writer_options_builder(sink_info const &sink)
Constructor from sink and table.
Definition: orc.hpp:1129
chunked_orc_writer_options_builder & enable_statistics(statistics_freq val)
Choose granularity of statistics collection.
Definition: orc.hpp:1154
chunked_orc_writer_options_builder & row_index_stride(size_type val)
Sets the row index stride.
Definition: orc.hpp:1190
Settings to use for write_orc_chunked().
Definition: orc.hpp:882
void set_stripe_size_bytes(size_t size_bytes)
Sets the maximum stripe size, in bytes.
Definition: orc.hpp:1038
chunked_orc_writer_options()=default
Default constructor.
void metadata(table_input_metadata meta)
Sets associated metadata.
Definition: orc.hpp:1080
void set_key_value_metadata(std::map< std::string, std::string > metadata)
Sets Key-Value footer metadata.
Definition: orc.hpp:1087
void set_compression_statistics(std::shared_ptr< writer_compression_statistics > comp_stats)
Sets the pointer to the output compression statistics.
Definition: orc.hpp:1097
sink_info const & get_sink() const
Returns sink info.
Definition: orc.hpp:935
auto get_stripe_size_rows() const
Returns maximum stripe size, in rows.
Definition: orc.hpp:963
auto get_row_index_stride() const
Returns the row index stride.
Definition: orc.hpp:970
void set_row_index_stride(size_type stride)
Sets the row index stride.
Definition: orc.hpp:1069
statistics_freq get_statistics_freq() const
Returns granularity of statistics collection.
Definition: orc.hpp:949
void set_compression(compression_type comp)
Sets compression type.
Definition: orc.hpp:1017
std::map< std::string, std::string > const & get_key_value_metadata() const
Returns Key-Value footer metadata information.
Definition: orc.hpp:988
void set_enable_dictionary_sort(bool val)
Sets whether string dictionaries should be sorted.
Definition: orc.hpp:1107
auto const & get_metadata() const
Returns associated metadata.
Definition: orc.hpp:981
bool get_enable_dictionary_sort() const
Returns whether string dictionaries should be sorted.
Definition: orc.hpp:1008
compression_type get_compression() const
Returns compression type.
Definition: orc.hpp:942
void set_stripe_size_rows(size_type size_rows)
Sets the maximum stripe size, in rows.
Definition: orc.hpp:1054
std::shared_ptr< writer_compression_statistics > get_compression_statistics() const
Returns a shared pointer to the user-provided compression statistics.
Definition: orc.hpp:998
auto get_stripe_size_bytes() const
Returns maximum stripe size, in bytes.
Definition: orc.hpp:956
void enable_statistics(statistics_freq val)
Choose granularity of statistics collection.
Definition: orc.hpp:1029
static chunked_orc_writer_options_builder builder(sink_info const &sink)
Create builder to create chunked_orc_writer_options.
Chunked orc writer class writes an ORC file in a chunked/stream form.
Definition: orc.hpp:1282
orc_chunked_writer(chunked_orc_writer_options const &options, rmm::cuda_stream_view stream=cudf::get_default_stream())
Constructor with chunked writer options.
std::unique_ptr< orc::detail::writer > writer
Unique pointer to impl writer class.
Definition: orc.hpp:1313
orc_chunked_writer & write(table_view const &table)
Writes table to output.
void close()
Finishes the chunked/streamed write process.
orc_chunked_writer()=default
Default constructor, this should never be used. This is added just to satisfy cython.
Builds settings to use for read_orc().
Definition: orc.hpp:256
orc_reader_options_builder & use_index(bool use)
Enable/Disable use of row index to speed-up reading.
Definition: orc.hpp:328
orc_reader_options_builder & decimal128_columns(std::vector< std::string > val)
Columns that should be read as 128-bit Decimal.
Definition: orc.hpp:364
orc_reader_options_builder & use_np_dtypes(bool use)
Enable/Disable use of numpy-compatible dtypes.
Definition: orc.hpp:340
orc_reader_options_builder & skip_rows(uint64_t rows)
Sets number of rows to skip from the start.
Definition: orc.hpp:304
orc_reader_options_builder()=default
Default constructor.
orc_reader_options_builder(source_info src)
Constructor from source info.
Definition: orc.hpp:272
orc_reader_options_builder & num_rows(size_type nrows)
Sets number of row to read.
Definition: orc.hpp:316
orc_reader_options_builder & stripes(std::vector< std::vector< size_type >> stripes)
Sets list of individual stripes to read per source.
Definition: orc.hpp:292
orc_reader_options_builder & columns(std::vector< std::string > col_names)
Sets names of the column to read.
Definition: orc.hpp:280
orc_reader_options && build()
move orc_reader_options member once it's built.
Definition: orc.hpp:382
orc_reader_options_builder & timestamp_type(data_type type)
Sets timestamp type to which timestamp column will be cast.
Definition: orc.hpp:352
Settings to use for read_orc().
Definition: orc.hpp:52
std::optional< size_type > const & get_num_rows() const
Returns number of row to read.
Definition: orc.hpp:135
orc_reader_options()=default
Default constructor.
void enable_use_np_dtypes(bool use)
Enable/Disable use of numpy-compatible dtypes.
Definition: orc.hpp:233
auto const & get_stripes() const
Returns vector of vectors, stripes to read for each input source.
Definition: orc.hpp:120
void set_decimal128_columns(std::vector< std::string > val)
Set columns that should be read as 128-bit Decimal.
Definition: orc.hpp:247
void enable_use_index(bool use)
Enable/Disable use of row index to speed-up reading.
Definition: orc.hpp:226
void set_columns(std::vector< std::string > col_names)
Sets names of the column to read.
Definition: orc.hpp:172
uint64_t get_skip_rows() const
Returns number of rows to skip from the start.
Definition: orc.hpp:127
void set_stripes(std::vector< std::vector< size_type >> stripes)
Sets list of stripes to read for each input source.
Definition: orc.hpp:184
data_type get_timestamp_type() const
Returns timestamp type to which timestamp column will be cast.
Definition: orc.hpp:156
void set_num_rows(size_type nrows)
Sets number of row to read.
Definition: orc.hpp:214
auto const & get_columns() const
Returns names of the columns to read, if set.
Definition: orc.hpp:113
void set_skip_rows(uint64_t rows)
Sets number of rows to skip from the start.
Definition: orc.hpp:200
static orc_reader_options_builder builder(source_info src)
Creates orc_reader_options_builder which will build orc_reader_options.
source_info const & get_source() const
Returns source info.
Definition: orc.hpp:106
bool is_enabled_use_np_dtypes() const
Whether to use numpy-compatible dtypes.
Definition: orc.hpp:149
bool is_enabled_use_index() const
Whether to use row index to speed-up reading.
Definition: orc.hpp:142
std::vector< std::string > const & get_decimal128_columns() const
Returns fully qualified names of columns that should be read as 128-bit Decimal.
Definition: orc.hpp:163
void set_timestamp_type(data_type type)
Sets timestamp type to which timestamp column will be cast.
Definition: orc.hpp:240
Builds settings to use for write_orc().
Definition: orc.hpp:696
orc_writer_options_builder & table(table_view tbl)
Sets table to be written to output.
Definition: orc.hpp:788
orc_writer_options_builder & row_index_stride(size_type val)
Sets the row index stride.
Definition: orc.hpp:776
orc_writer_options_builder & enable_statistics(statistics_freq val)
Choose granularity of column statistics to be written.
Definition: orc.hpp:740
orc_writer_options_builder & metadata(table_input_metadata meta)
Sets associated metadata.
Definition: orc.hpp:800
orc_writer_options_builder(sink_info const &sink, table_view const &table)
Constructor from sink and table.
Definition: orc.hpp:713
orc_writer_options && build()
move orc_writer_options member once it's built.
Definition: orc.hpp:855
orc_writer_options_builder()=default
Default constructor.
orc_writer_options_builder & key_value_metadata(std::map< std::string, std::string > metadata)
Sets Key-Value footer metadata.
Definition: orc.hpp:812
orc_writer_options_builder & compression_statistics(std::shared_ptr< writer_compression_statistics > const &comp_stats)
Sets the pointer to the output compression statistics.
Definition: orc.hpp:824
orc_writer_options_builder & stripe_size_rows(size_type val)
Sets the maximum number of rows in output stripes.
Definition: orc.hpp:764
orc_writer_options_builder & enable_dictionary_sort(bool val)
Sets whether string dictionaries should be sorted.
Definition: orc.hpp:837
orc_writer_options_builder & compression(compression_type comp)
Sets compression type.
Definition: orc.hpp:723
orc_writer_options_builder & stripe_size_bytes(size_t val)
Sets the maximum stripe size, in bytes.
Definition: orc.hpp:752
Settings to use for write_orc().
Definition: orc.hpp:434
void enable_statistics(statistics_freq val)
Choose granularity of statistics collection.
Definition: orc.hpp:605
auto const & get_metadata() const
Returns associated metadata.
Definition: orc.hpp:557
std::map< std::string, std::string > const & get_key_value_metadata() const
Returns Key-Value footer metadata information.
Definition: orc.hpp:564
std::shared_ptr< writer_compression_statistics > get_compression_statistics() const
Returns a shared pointer to the user-provided compression statistics.
Definition: orc.hpp:574
bool is_enabled_statistics() const
Whether writing column statistics is enabled/disabled.
Definition: orc.hpp:508
auto get_stripe_size_bytes() const
Returns maximum stripe size, in bytes.
Definition: orc.hpp:525
void set_stripe_size_rows(size_type size_rows)
Sets the maximum stripe size, in rows.
Definition: orc.hpp:630
void set_key_value_metadata(std::map< std::string, std::string > metadata)
Sets metadata.
Definition: orc.hpp:670
auto get_stripe_size_rows() const
Returns maximum stripe size, in rows.
Definition: orc.hpp:532
table_view get_table() const
Returns table to be written to output.
Definition: orc.hpp:550
void set_metadata(table_input_metadata meta)
Sets associated metadata.
Definition: orc.hpp:663
statistics_freq get_statistics_freq() const
Returns frequency of statistics collection.
Definition: orc.hpp:518
void set_compression_statistics(std::shared_ptr< writer_compression_statistics > comp_stats)
Sets the pointer to the output compression statistics.
Definition: orc.hpp:680
auto get_row_index_stride() const
Returns the row index stride.
Definition: orc.hpp:539
void set_table(table_view tbl)
Sets table to be written to output.
Definition: orc.hpp:656
orc_writer_options()=default
Default constructor.
void set_compression(compression_type comp)
Sets compression type.
Definition: orc.hpp:593
void set_enable_dictionary_sort(bool val)
Sets whether string dictionaries should be sorted.
Definition: orc.hpp:690
void set_row_index_stride(size_type stride)
Sets the row index stride.
Definition: orc.hpp:645
compression_type get_compression() const
Returns compression type.
Definition: orc.hpp:501
static orc_writer_options_builder builder(sink_info const &sink, table_view const &table)
Create builder to create orc_writer_options.
bool get_enable_dictionary_sort() const
Returns whether string dictionaries should be sorted.
Definition: orc.hpp:584
void set_stripe_size_bytes(size_t size_bytes)
Sets the maximum stripe size, in bytes.
Definition: orc.hpp:614
sink_info const & get_sink() const
Returns sink info.
Definition: orc.hpp:494
Metadata for a table.
Definition: io/types.hpp:814
A set of cudf::column_view's of the same size.
Definition: table_view.hpp:187
A set of cudf::column's of the same size.
Definition: table.hpp:40
rmm::cuda_stream_view const get_default_stream()
Get the current default stream.
constexpr size_type default_stripe_size_rows
1M rows default orc stripe rows
Definition: orc.hpp:41
constexpr size_type default_row_index_stride
10K rows default orc row index stride
Definition: orc.hpp:42
table_with_metadata read_orc(orc_reader_options const &options, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
Reads an ORC dataset into a set of columns.
constexpr size_t default_stripe_size_bytes
64MB default orc stripe size
Definition: orc.hpp:40
compression_type
Compression algorithms.
Definition: io/types.hpp:56
statistics_freq
Column statistics granularity type for parquet/orc writers.
Definition: io/types.hpp:95
@ AUTO
Automatically detect or select compression format.
@ STATISTICS_ROWGROUP
Per-Rowgroup column statistics.
Definition: io/types.hpp:97
@ STATISTICS_NONE
No column statistics.
Definition: io/types.hpp:96
@ STATISTICS_PAGE
Per-page column statistics.
Definition: io/types.hpp:98
void write_orc(orc_writer_options const &options, rmm::cuda_stream_view stream=cudf::get_default_stream())
Writes a set of columns to ORC format.
device_memory_resource * get_current_device_resource()
#define CUDF_EXPECTS(...)
Macro for checking (pre-)conditions that throws an exception when a condition is violated.
Definition: error.hpp:176
int32_t size_type
Row index type for columns and tables.
Definition: types.hpp:93
@ EMPTY
Always null with no underlying data.
cuDF-IO API type definitions
cuDF interfaces
Definition: aggregation.hpp:34
Destination information for write interfaces.
Definition: io/types.hpp:469
Source information for read interfaces.
Definition: io/types.hpp:294
Table with table metadata used by io readers to return the metadata by value.
Definition: io/types.hpp:249
Class definitions for (mutable)_table_view
Type declarations for libcudf.