From a9b5bd98ff25b50f6740bfb87ba5b6559890645a Mon Sep 17 00:00:00 2001 From: Christopher Harris Date: Fri, 13 Aug 2021 17:58:32 -0500 Subject: [PATCH 1/3] use correct namespace in cuio code examples --- cpp/include/cudf/io/avro.hpp | 7 +++---- cpp/include/cudf/io/csv.hpp | 8 +++----- cpp/include/cudf/io/json.hpp | 6 +++--- cpp/include/cudf/io/orc.hpp | 7 +++---- cpp/include/cudf/io/parquet.hpp | 7 +++---- 5 files changed, 15 insertions(+), 20 deletions(-) diff --git a/cpp/include/cudf/io/avro.hpp b/cpp/include/cudf/io/avro.hpp index 34410209c72..205879195cb 100644 --- a/cpp/include/cudf/io/avro.hpp +++ b/cpp/include/cudf/io/avro.hpp @@ -196,11 +196,10 @@ class avro_reader_options_builder { * The following code snippet demonstrates how to read a dataset from a file: * @code * ... - * std::string filepath = "dataset.avro"; - * cudf::avro_reader_options options = - * cudf::avro_reader_options::builder(cudf::source_info(filepath)); + * auto source = cudf::io::source_info("dataset.avro"); + * auto options = cudf::io::avro_reader_options::builder(source); + * auto result = cudf::io::read_avro(options); * ... - * auto result = cudf::read_avro(options); * @endcode * * @param options Settings for controlling reading behavior. diff --git a/cpp/include/cudf/io/csv.hpp b/cpp/include/cudf/io/csv.hpp index d4a21b2e98c..c739d2bceb5 100644 --- a/cpp/include/cudf/io/csv.hpp +++ b/cpp/include/cudf/io/csv.hpp @@ -1185,11 +1185,9 @@ class csv_reader_options_builder { * * The following code snippet demonstrates how to read a dataset from a file: * @code - * std::string filepath = "dataset.csv"; - * cudf::io::csv_reader_options options = - * cudf::io::csv_reader_options::builder(cudf::source_info(filepath)); - * ... - * auto result = cudf::read_csv(options); + * auto source = cudf::io::source_info("dataset.csv"); + * auto options = cudf::io::csv_reader_options::builder(source); + * auto result = cudf::io::read_csv(options); * @endcode * * @param options Settings for controlling reading behavior. diff --git a/cpp/include/cudf/io/json.hpp b/cpp/include/cudf/io/json.hpp index 8954f7dcab1..5f8113af2ee 100644 --- a/cpp/include/cudf/io/json.hpp +++ b/cpp/include/cudf/io/json.hpp @@ -351,10 +351,10 @@ class json_reader_options_builder { * The following code snippet demonstrates how to read a dataset from a file: * @code * ... - * std::string filepath = "dataset.json"; - * cudf::read_json_options options = cudf::read_json_options::builder(cudf::source_info(filepath)); + * auto source = cudf::io::source_info("dataset.json"); + * auto options = cudf::io::read_json_options::builder(source); + * auto result = cudf::io::read_json(options); * ... - * auto result = cudf::read_json(options); * @endcode * * @param options Settings for controlling reading behavior. diff --git a/cpp/include/cudf/io/orc.hpp b/cpp/include/cudf/io/orc.hpp index 52d3138d3a1..b3f2a6d2df7 100644 --- a/cpp/include/cudf/io/orc.hpp +++ b/cpp/include/cudf/io/orc.hpp @@ -347,11 +347,10 @@ class orc_reader_options_builder { * The following code snippet demonstrates how to read a dataset from a file: * @code * ... - * std::string filepath = "dataset.orc"; - * cudf::orc_reader_options options = - * cudf::orc_reader_options::builder(cudf::source_info(filepath)); + * auto source = cudf::io::source_info("dataset.orc"); + * auto options = cudf::io::orc_reader_options::builder(source); + * auto result = cudf::io::read_orc(options); * ... - * auto result = cudf::read_orc(options); * @endcode * * Note: Support for reading files with struct columns is currently experimental, the output may not diff --git a/cpp/include/cudf/io/parquet.hpp b/cpp/include/cudf/io/parquet.hpp index ecd9607a87e..34ff4fd0104 100644 --- a/cpp/include/cudf/io/parquet.hpp +++ b/cpp/include/cudf/io/parquet.hpp @@ -355,11 +355,10 @@ class parquet_reader_options_builder { * The following code snippet demonstrates how to read a dataset from a file: * @code * ... - * std::string filepath = "dataset.parquet"; - * cudf::io::parquet_reader_options options = - * cudf::io::parquet_reader_options::builder(cudf::source_info(filepath)); + * auto source = cudf::io::source_info("dataset.parquet"); + * auto options = cudf::io::parquet_reader_options::builder(source); + * auto result = cudf::io::read_parquet(options); * ... - * auto result = cudf::read_parquet(options); * @endcode * * @param options Settings for controlling reading behavior From 3057795965a3b88648b3158c9d8bb8211aad6bd5 Mon Sep 17 00:00:00 2001 From: Christopher Harris Date: Fri, 13 Aug 2021 18:02:00 -0500 Subject: [PATCH 2/3] remove extra ... in code example --- cpp/include/cudf/io/avro.hpp | 2 -- cpp/include/cudf/io/json.hpp | 2 -- cpp/include/cudf/io/orc.hpp | 2 -- cpp/include/cudf/io/parquet.hpp | 2 -- 4 files changed, 8 deletions(-) diff --git a/cpp/include/cudf/io/avro.hpp b/cpp/include/cudf/io/avro.hpp index 205879195cb..774690c939f 100644 --- a/cpp/include/cudf/io/avro.hpp +++ b/cpp/include/cudf/io/avro.hpp @@ -195,11 +195,9 @@ class avro_reader_options_builder { * * The following code snippet demonstrates how to read a dataset from a file: * @code - * ... * auto source = cudf::io::source_info("dataset.avro"); * auto options = cudf::io::avro_reader_options::builder(source); * auto result = cudf::io::read_avro(options); - * ... * @endcode * * @param options Settings for controlling reading behavior. diff --git a/cpp/include/cudf/io/json.hpp b/cpp/include/cudf/io/json.hpp index 5f8113af2ee..60f990c87d8 100644 --- a/cpp/include/cudf/io/json.hpp +++ b/cpp/include/cudf/io/json.hpp @@ -350,11 +350,9 @@ class json_reader_options_builder { * * The following code snippet demonstrates how to read a dataset from a file: * @code - * ... * auto source = cudf::io::source_info("dataset.json"); * auto options = cudf::io::read_json_options::builder(source); * auto result = cudf::io::read_json(options); - * ... * @endcode * * @param options Settings for controlling reading behavior. diff --git a/cpp/include/cudf/io/orc.hpp b/cpp/include/cudf/io/orc.hpp index b3f2a6d2df7..1839ce0d2e4 100644 --- a/cpp/include/cudf/io/orc.hpp +++ b/cpp/include/cudf/io/orc.hpp @@ -346,11 +346,9 @@ class orc_reader_options_builder { * * The following code snippet demonstrates how to read a dataset from a file: * @code - * ... * auto source = cudf::io::source_info("dataset.orc"); * auto options = cudf::io::orc_reader_options::builder(source); * auto result = cudf::io::read_orc(options); - * ... * @endcode * * Note: Support for reading files with struct columns is currently experimental, the output may not diff --git a/cpp/include/cudf/io/parquet.hpp b/cpp/include/cudf/io/parquet.hpp index 34ff4fd0104..5f72bf788d4 100644 --- a/cpp/include/cudf/io/parquet.hpp +++ b/cpp/include/cudf/io/parquet.hpp @@ -354,11 +354,9 @@ class parquet_reader_options_builder { * * The following code snippet demonstrates how to read a dataset from a file: * @code - * ... * auto source = cudf::io::source_info("dataset.parquet"); * auto options = cudf::io::parquet_reader_options::builder(source); * auto result = cudf::io::read_parquet(options); - * ... * @endcode * * @param options Settings for controlling reading behavior From 98cc65856f4429c664df94d46ef5311989b1b003 Mon Sep 17 00:00:00 2001 From: Christopher Harris Date: Sun, 15 Aug 2021 21:37:26 -0500 Subject: [PATCH 3/3] update cudf::io:: reader writer doc comment example code --- cpp/include/cudf/io/csv.hpp | 10 +++++----- cpp/include/cudf/io/orc.hpp | 9 +++------ cpp/include/cudf/io/parquet.hpp | 20 +++++++------------- 3 files changed, 15 insertions(+), 24 deletions(-) diff --git a/cpp/include/cudf/io/csv.hpp b/cpp/include/cudf/io/csv.hpp index c739d2bceb5..fece1cb52b0 100644 --- a/cpp/include/cudf/io/csv.hpp +++ b/cpp/include/cudf/io/csv.hpp @@ -1512,12 +1512,12 @@ class csv_writer_options_builder { * * The following code snippet demonstrates how to write columns to a file: * @code - * std::string filepath = "dataset.csv"; - * cudf::io::sink_info sink_info(filepath); + * auto destination = cudf::io::sink_info("dataset.csv"); + * auto options = cudf::io::csv_writer_options(destination, table->view()) + * .na_rep(na) + * .include_header(include_header) + * .rows_per_chunk(rows_per_chunk); * - * cudf::io::csv_writer_options options = cudf::io::csv_writer_options(sink_info, - * table->view()).na_rep(na).include_header(include_header).rows_per_chunk(rows_per_chunk); - * ... * cudf::io::write_csv(options); * @endcode * diff --git a/cpp/include/cudf/io/orc.hpp b/cpp/include/cudf/io/orc.hpp index 1839ce0d2e4..4ae09b516a4 100644 --- a/cpp/include/cudf/io/orc.hpp +++ b/cpp/include/cudf/io/orc.hpp @@ -565,12 +565,9 @@ class orc_writer_options_builder { * * The following code snippet demonstrates how to write columns to a file: * @code - * ... - * std::string filepath = "dataset.orc"; - * cudf::orc_writer_options options = cudf::orc_writer_options::builder(cudf::sink_info(filepath), - * table->view()); - * ... - * cudf::write_orc(options); + * auto destination = cudf::io::sink_info("dataset.orc"); + * auto options = cudf::io::orc_writer_options::builder(destination, table->view()); + * cudf::io::write_orc(options); * @endcode * * @param options Settings for controlling reading behavior. diff --git a/cpp/include/cudf/io/parquet.hpp b/cpp/include/cudf/io/parquet.hpp index 5f72bf788d4..e1e5da88225 100644 --- a/cpp/include/cudf/io/parquet.hpp +++ b/cpp/include/cudf/io/parquet.hpp @@ -781,12 +781,9 @@ class parquet_writer_options_builder { * * The following code snippet demonstrates how to write columns to a file: * @code - * ... - * std::string filepath = "dataset.parquet"; - * cudf::io::parquet_writer_options options = - * cudf::io::parquet_writer_options::builder(cudf::sink_info(filepath), table->view()); - * ... - * cudf::write_parquet(options); + * auto destination = cudf::io::sink_info("dataset.parquet"); + * auto options = cudf::io::parquet_writer_options::builder(destination, table->view()); + * cudf::io::write_parquet(options); * @endcode * * @param options Settings for controlling writing behavior. @@ -1016,15 +1013,12 @@ std::unique_ptr> merge_rowgroup_metadata( * one logical table by writing a series of individual cudf::tables. * * @code - * ... - * std::string filepath = "dataset.parquet"; - * cudf::io::chunked_parquet_writer_options options = - * cudf::io::chunked_parquet_writer_options::builder(cudf::sink_info(filepath), table->view()); - * ... - * cudf::io::parquet_chunked_writer writer(options) + * auto destination = cudf::io::sink_info("dataset.parquet"); + * auto options = cudf::io::chunked_parquet_writer_options::builder(destination, table->view()); + * auto writer = cudf::io::parquet_chunked_writer(options); + * * writer.write(table0) * writer.write(table1) - * ... * writer.close() * @endcode */