You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by ap...@apache.org on 2022/05/04 16:10:30 UTC
[arrow] branch master updated: MINOR: [C++] Trivial improvements to execution plan example
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 8acb3c405f MINOR: [C++] Trivial improvements to execution plan example
8acb3c405f is described below
commit 8acb3c405fe684d5638416c57d0a5f5b68cd3272
Author: Vibhatha Abeykoon <vi...@gmail.com>
AuthorDate: Wed May 4 18:10:16 2022 +0200
MINOR: [C++] Trivial improvements to execution plan example
This is a minor PR including a fix for the streaming execution plan code. In a currently reviewing PR an issue was raised and reflecting the suggesting change for this example.
cc @pitrou
Closes #12767 from vibhatha/minor-cpp-example-improvement
Authored-by: Vibhatha Abeykoon <vi...@gmail.com>
Signed-off-by: Antoine Pitrou <an...@python.org>
---
.../arrow/execution_plan_documentation_examples.cc | 18 ++++++------------
1 file changed, 6 insertions(+), 12 deletions(-)
diff --git a/cpp/examples/arrow/execution_plan_documentation_examples.cc b/cpp/examples/arrow/execution_plan_documentation_examples.cc
index b865fe154e..5f195c9b20 100644
--- a/cpp/examples/arrow/execution_plan_documentation_examples.cc
+++ b/cpp/examples/arrow/execution_plan_documentation_examples.cc
@@ -67,27 +67,21 @@ template <typename TYPE,
arrow::is_temporal_type<TYPE>::value>::type>
arrow::Result<std::shared_ptr<arrow::Array>> GetArrayDataSample(
const std::vector<typename TYPE::c_type>& values) {
- using ARROW_ARRAY_TYPE = typename arrow::TypeTraits<TYPE>::ArrayType;
- using ARROW_BUILDER_TYPE = typename arrow::TypeTraits<TYPE>::BuilderType;
- ARROW_BUILDER_TYPE builder;
+ using ArrowBuilderType = typename arrow::TypeTraits<TYPE>::BuilderType;
+ ArrowBuilderType builder;
ARROW_RETURN_NOT_OK(builder.Reserve(values.size()));
- std::shared_ptr<ARROW_ARRAY_TYPE> array;
ARROW_RETURN_NOT_OK(builder.AppendValues(values));
- ARROW_RETURN_NOT_OK(builder.Finish(&array));
- return array;
+ return builder.Finish();
}
template <class TYPE>
arrow::Result<std::shared_ptr<arrow::Array>> GetBinaryArrayDataSample(
const std::vector<std::string>& values) {
- using ARROW_ARRAY_TYPE = typename arrow::TypeTraits<TYPE>::ArrayType;
- using ARROW_BUILDER_TYPE = typename arrow::TypeTraits<TYPE>::BuilderType;
- ARROW_BUILDER_TYPE builder;
+ using ArrowBuilderType = typename arrow::TypeTraits<TYPE>::BuilderType;
+ ArrowBuilderType builder;
ARROW_RETURN_NOT_OK(builder.Reserve(values.size()));
- std::shared_ptr<ARROW_ARRAY_TYPE> array;
ARROW_RETURN_NOT_OK(builder.AppendValues(values));
- ARROW_RETURN_NOT_OK(builder.Finish(&array));
- return array;
+ return builder.Finish();
}
arrow::Result<std::shared_ptr<arrow::RecordBatch>> GetSampleRecordBatch(