edponce commented on code in PR #13859:
URL: https://github.com/apache/arrow/pull/13859#discussion_r943883137
##########
cpp/examples/tutorial_examples/arrow_example.cc:
##########
@@ -0,0 +1,94 @@
+#include <arrow/api.h>
+#include <arrow/result.h>
+#include <arrow/status.h>
+#include <arrow/table.h>
+
+#include <iostream>
+
+using arrow::Status;
+
+namespace {
Review Comment:
Probably we should not use anonymous namespaces or namespaces in general for
these representative examples.
##########
cpp/examples/tutorial_examples/dataset_example.cc:
##########
@@ -0,0 +1,141 @@
+#include <arrow/api.h>
+#include <arrow/csv/api.h>
+#include <parquet/arrow/reader.h>
+#include <parquet/arrow/writer.h>
+#include <arrow/io/api.h>
+#include <arrow/ipc/api.h>
+#include <arrow/pretty_print.h>
+#include <arrow/result.h>
+#include <arrow/status.h>
+#include <arrow/table.h>
+#include <arrow/compute/api.h>
+#include <arrow/filesystem/api.h>
+#include <arrow/dataset/api.h>
Review Comment:
Are all these header files necessary? Maybe can be simplified due to
transitive inclusion.
##########
cpp/examples/tutorial_examples/compute_example.cc:
##########
@@ -0,0 +1,64 @@
+#include <arrow/api.h>
+#include <arrow/result.h>
+#include <arrow/status.h>
+#include <arrow/table.h>
+#include <arrow/compute/api.h>
+
+#include <iostream>
+
+using arrow::Status;
+
+namespace {
+
+Status RunMain(int argc, char** argv) {
+
+ // Saving and Loading Tables
+
+ arrow::Int32Builder int32builder;
+ int32_t some_nums_raw[5] = {34, 624, 2223, 5654, 4356};
+ ARROW_RETURN_NOT_OK(int32builder.AppendValues(some_nums_raw, 5));
+ std::shared_ptr<arrow::Array> some_nums;
+ ARROW_ASSIGN_OR_RAISE(some_nums, int32builder.Finish());
+
+ int32_t more_nums_raw[5] = {75342, 23, 64, 17, 736};
+ ARROW_RETURN_NOT_OK(int32builder.AppendValues(more_nums_raw, 5));
+ std::shared_ptr<arrow::Array> more_nums;
+ ARROW_ASSIGN_OR_RAISE(more_nums, int32builder.Finish());
+
+ std::shared_ptr<arrow::Field> field_a, field_b;
+ std::shared_ptr<arrow::Schema> schema;
+
+ field_a = arrow::field("A", arrow::int32());
+ field_b = arrow::field("B", arrow::int32());
+
+ schema = arrow::schema({field_a, field_b});
+
+ std::shared_ptr<arrow::Table> table;
+ table = arrow::Table::Make(schema, {some_nums, more_nums}, 5);
+
+ // Performing Computations
Review Comment:
Be explicit on the type of computations performed. I think a bit more detail
will make these examples easy to digest to Arrow novices.
##########
cpp/examples/tutorial_examples/arrow_example.cc:
##########
@@ -0,0 +1,94 @@
+#include <arrow/api.h>
+#include <arrow/result.h>
+#include <arrow/status.h>
+#include <arrow/table.h>
+
+#include <iostream>
+
+using arrow::Status;
+
+namespace {
+
+Status RunMain(int argc, char** argv) {
+
+ // Creating Arrays and Tables
Review Comment:
Probably add the comment for each block of code corresponding to a structure
type being created.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]