lidavidm commented on a change in pull request #11210:
URL: https://github.com/apache/arrow/pull/11210#discussion_r723201429
##########
File path: cpp/src/arrow/compute/exec/exec_plan.h
##########
@@ -243,6 +248,110 @@ class ARROW_EXPORT ExecNode {
NodeVector outputs_;
};
+class MapNode : public ExecNode {
Review comment:
Can we add a short docstring explaining the purpose of this class?
##########
File path: cpp/src/arrow/compute/exec/exec_plan.h
##########
@@ -243,6 +248,110 @@ class ARROW_EXPORT ExecNode {
NodeVector outputs_;
};
+class MapNode : public ExecNode {
+ public:
+ MapNode(ExecPlan* plan, std::vector<ExecNode*> inputs,
+ std::shared_ptr<Schema> output_schema)
+ : ExecNode(plan, std::move(inputs), /*input_labels=*/{"target"},
+ std::move(output_schema),
+ /*num_outputs=*/1) {
+ executor_ = plan_->exec_context()->executor();
+ }
+
+ void SubmitTask(std::function<Status()> task) {
Review comment:
nit: SubmitTask/Finish could/should be protected
##########
File path: cpp/src/arrow/compute/exec/exec_plan.h
##########
@@ -243,6 +248,110 @@ class ARROW_EXPORT ExecNode {
NodeVector outputs_;
};
+class MapNode : public ExecNode {
+ public:
+ MapNode(ExecPlan* plan, std::vector<ExecNode*> inputs,
+ std::shared_ptr<Schema> output_schema)
+ : ExecNode(plan, std::move(inputs), /*input_labels=*/{"target"},
+ std::move(output_schema),
+ /*num_outputs=*/1) {
+ executor_ = plan_->exec_context()->executor();
+ }
+
+ void SubmitTask(std::function<Status()> task) {
+ if (finished_.is_finished()) {
+ return;
+ }
+ Status status;
+ if (executor_) {
+ status = task_group_.AddTask([this, task]() -> Result<Future<>> {
+ return this->executor_->Submit(this->stop_source_.token(), [this,
task]() {
+ auto status = task();
+ if (this->input_counter_.Increment()) {
+ this->Finish(status);
+ }
+ return status;
Review comment:
I suppose we don't need to cancel here since the next call to AddTask
will fail and cancel - is that right?
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]