You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by li...@apache.org on 2021/02/22 14:51:00 UTC
[arrow] 02/02: Add overload for future
This is an automated email from the ASF dual-hosted git repository.
lidavidm pushed a commit to branch patching
in repository https://gitbox.apache.org/repos/asf/arrow.git
commit ab15813b037bb880a8a8c6f825dceaf7fad341fd
Author: David Li <da...@ursacomputing.com>
AuthorDate: Mon Feb 22 09:48:40 2021 -0500
Add overload for future
---
cpp/src/arrow/util/future.h | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/cpp/src/arrow/util/future.h b/cpp/src/arrow/util/future.h
index ee053cf..6a7ed19 100644
--- a/cpp/src/arrow/util/future.h
+++ b/cpp/src/arrow/util/future.h
@@ -493,6 +493,17 @@ class ARROW_MUST_USE_TYPE Future {
});
}
+ Future(Result<ValueType> res) : Future() {
+ if (ARROW_PREDICT_TRUE(res.ok())) {
+ impl_ = FutureImpl::MakeFinished(FutureState::SUCCESS);
+ } else {
+ impl_ = FutureImpl::MakeFinished(FutureState::FAILURE);
+ }
+ SetResult(std::move(res));
+ }
+
+ Future(Status s) : Future(Result<ValueType>(std::move(s))) {}
+
protected:
template <typename OnComplete>
struct Callback {