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/10/26 12:11:59 UTC
[arrow] branch master updated: ARROW-18135: [C++] Avoid warnings that ExecBatch::length may be uninitialized (#14480)
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 53023b3b86 ARROW-18135: [C++] Avoid warnings that ExecBatch::length may be uninitialized (#14480)
53023b3b86 is described below
commit 53023b3b8634f22f5ec8fd7b7035d98ed54f315e
Author: rtpsw <rt...@hotmail.com>
AuthorDate: Wed Oct 26 15:11:52 2022 +0300
ARROW-18135: [C++] Avoid warnings that ExecBatch::length may be uninitialized (#14480)
See https://issues.apache.org/jira/browse/ARROW-18135
Authored-by: Yaron Gvili <rt...@hotmail.com>
Signed-off-by: Antoine Pitrou <an...@python.org>
---
cpp/src/arrow/compute/exec/exec_plan.cc | 2 +-
cpp/src/arrow/compute/exec/test_util.cc | 2 +-
cpp/src/arrow/compute/kernels/hash_aggregate_test.cc | 4 +++-
cpp/src/arrow/dataset/scanner_test.cc | 4 +++-
4 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/cpp/src/arrow/compute/exec/exec_plan.cc b/cpp/src/arrow/compute/exec/exec_plan.cc
index 7579773c83..992bf54866 100644
--- a/cpp/src/arrow/compute/exec/exec_plan.cc
+++ b/cpp/src/arrow/compute/exec/exec_plan.cc
@@ -602,7 +602,7 @@ Future<std::vector<ExecBatch>> DeclarationToExecBatchesAsync(Declaration declara
.Then([collected_fut, exec_plan]() -> Result<std::vector<ExecBatch>> {
ARROW_ASSIGN_OR_RAISE(auto collected, collected_fut.result());
return ::arrow::internal::MapVector(
- [](std::optional<ExecBatch> batch) { return std::move(*batch); },
+ [](std::optional<ExecBatch> batch) { return batch.value_or(ExecBatch()); },
std::move(collected));
});
}
diff --git a/cpp/src/arrow/compute/exec/test_util.cc b/cpp/src/arrow/compute/exec/test_util.cc
index 23c813b60b..13c07d540c 100644
--- a/cpp/src/arrow/compute/exec/test_util.cc
+++ b/cpp/src/arrow/compute/exec/test_util.cc
@@ -189,7 +189,7 @@ Future<std::vector<ExecBatch>> StartAndCollect(
.Then([collected_fut]() -> Result<std::vector<ExecBatch>> {
ARROW_ASSIGN_OR_RAISE(auto collected, collected_fut.result());
return ::arrow::internal::MapVector(
- [](std::optional<ExecBatch> batch) { return std::move(*batch); },
+ [](std::optional<ExecBatch> batch) { return batch.value_or(ExecBatch()); },
std::move(collected));
});
}
diff --git a/cpp/src/arrow/compute/kernels/hash_aggregate_test.cc b/cpp/src/arrow/compute/kernels/hash_aggregate_test.cc
index 0367657eb4..053b5febe3 100644
--- a/cpp/src/arrow/compute/kernels/hash_aggregate_test.cc
+++ b/cpp/src/arrow/compute/kernels/hash_aggregate_test.cc
@@ -152,7 +152,9 @@ Result<Datum> GroupByUsingExecPlan(const BatchesWithSchema& input,
.Then([collected_fut]() -> Result<std::vector<ExecBatch>> {
ARROW_ASSIGN_OR_RAISE(auto collected, collected_fut.result());
return ::arrow::internal::MapVector(
- [](std::optional<ExecBatch> batch) { return std::move(*batch); },
+ [](std::optional<ExecBatch> batch) {
+ return batch.value_or(ExecBatch());
+ },
std::move(collected));
});
diff --git a/cpp/src/arrow/dataset/scanner_test.cc b/cpp/src/arrow/dataset/scanner_test.cc
index 8c667a7514..1edebb1cbe 100644
--- a/cpp/src/arrow/dataset/scanner_test.cc
+++ b/cpp/src/arrow/dataset/scanner_test.cc
@@ -2157,7 +2157,9 @@ struct TestPlan {
.Then([collected_fut]() -> Result<std::vector<compute::ExecBatch>> {
ARROW_ASSIGN_OR_RAISE(auto collected, collected_fut.result());
return ::arrow::internal::MapVector(
- [](std::optional<compute::ExecBatch> batch) { return std::move(*batch); },
+ [](std::optional<compute::ExecBatch> batch) {
+ return batch.value_or(compute::ExecBatch());
+ },
std::move(collected));
});
}