You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/10/25 13:21:50 UTC

[GitHub] [arrow] rtpsw commented on a diff in pull request #14480: ARROW-18135: [C++] Avoid warnings that ExecBatch::length may be uninitialized

rtpsw commented on code in PR #14480:
URL: https://github.com/apache/arrow/pull/14480#discussion_r1004481381


##########
cpp/src/arrow/compute/exec/exec_plan.cc:
##########
@@ -602,7 +602,9 @@ 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 ARROW_PREDICT_TRUE(batch) ? std::move(*batch) : ExecBatch();

Review Comment:
   Does `value_or` use something like `ARROW_PREDICT_TRUE` underneath? Granted, the code changes here are not in performance-critical code, though they such code may follow the example set here. Bottom line, if you want the conciseness change, I'd be OK doing it.



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org