This is an automated email from the ASF dual-hosted git repository.
apitrou pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git
The following commit(s) were added to refs/heads/master by this push:
new c445243a14 MINOR: [C++] Row wise conversion example fix (#13648)
c445243a14 is described below
commit c445243a1455a7e06c7bed95596499e348056bac
Author: zhang chaoming <[email protected]>
AuthorDate: Wed Jul 20 03:33:59 2022 +0800
MINOR: [C++] Row wise conversion example fix (#13648)
This example should print the expected rows.
Lead-authored-by: [email protected]
<[email protected]>
Co-authored-by: Antoine Pitrou <[email protected]>
Co-authored-by: Antoine Pitrou <[email protected]>
Co-authored-by: moses <[email protected]>
Co-authored-by: zhang chaoming
<[email protected]>
Signed-off-by: Antoine Pitrou <[email protected]>
---
cpp/examples/arrow/row_wise_conversion_example.cc | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/cpp/examples/arrow/row_wise_conversion_example.cc
b/cpp/examples/arrow/row_wise_conversion_example.cc
index d4bde56a12..3f9214d221 100644
--- a/cpp/examples/arrow/row_wise_conversion_example.cc
+++ b/cpp/examples/arrow/row_wise_conversion_example.cc
@@ -173,16 +173,16 @@ arrow::Result<std::vector<data_row>>
ColumnarTableToVector(
}
arrow::Status RunRowConversion() {
- std::vector<data_row> rows = {
+ std::vector<data_row> original_rows = {
{1, 1, {10.0}}, {2, 3, {11.0, 12.0, 13.0}}, {3, 2, {15.0, 25.0}}};
std::shared_ptr<arrow::Table> table;
- std::vector<data_row> expected_rows;
+ std::vector<data_row> converted_rows;
- ARROW_ASSIGN_OR_RAISE(table, VectorToColumnarTable(rows));
+ ARROW_ASSIGN_OR_RAISE(table, VectorToColumnarTable(original_rows));
- ARROW_ASSIGN_OR_RAISE(expected_rows, ColumnarTableToVector(table));
+ ARROW_ASSIGN_OR_RAISE(converted_rows, ColumnarTableToVector(table));
- assert(rows.size() == expected_rows.size());
+ assert(original_rows.size() == converted_rows.size());
// Print out contents of table, should get
// ID Components Component prices
@@ -192,7 +192,7 @@ arrow::Status RunRowConversion() {
std::cout << std::left << std::setw(3) << "ID " << std::left << std::setw(11)
<< "Components " << std::left << std::setw(15) << "Component
prices "
<< std::endl;
- for (const auto& row : rows) {
+ for (const auto& row : converted_rows) {
std::cout << std::left << std::setw(3) << row.id << std::left <<
std::setw(11)
<< row.components;
for (const auto& cost : row.component_cost) {