forked from apache/arrow
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmap_node.cc
More file actions
82 lines (69 loc) · 2.63 KB
/
Copy pathmap_node.cc
File metadata and controls
82 lines (69 loc) · 2.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
#include "arrow/compute/exec/map_node.h"
#include <functional>
#include <memory>
#include <string>
#include <utility>
#include <vector>
#include "arrow/compute/exec.h"
#include "arrow/compute/exec/expression.h"
#include "arrow/result.h"
#include "arrow/status.h"
#include "arrow/util/logging.h"
#include "arrow/util/tracing_internal.h"
namespace arrow {
namespace compute {
MapNode::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)) {}
Status MapNode::InputFinished(ExecNode* input, int total_batches) {
DCHECK_EQ(input, inputs_[0]);
EVENT_ON_CURRENT_SPAN("InputFinished", {{"batches.length", total_batches}});
ARROW_RETURN_NOT_OK(output_->InputFinished(this, total_batches));
if (input_counter_.SetTotal(total_batches)) {
this->Finish();
}
return Status::OK();
}
Status MapNode::StartProducing() {
NoteStartProducing(ToStringExtra());
return Status::OK();
}
void MapNode::PauseProducing(ExecNode* output, int32_t counter) {
inputs_[0]->PauseProducing(this, counter);
}
void MapNode::ResumeProducing(ExecNode* output, int32_t counter) {
inputs_[0]->ResumeProducing(this, counter);
}
Status MapNode::StopProducingImpl() { return Status::OK(); }
Status MapNode::InputReceived(ExecNode* input, ExecBatch batch) {
auto scope = TraceInputReceived(batch);
DCHECK_EQ(input, inputs_[0]);
compute::Expression guarantee = batch.guarantee;
ARROW_ASSIGN_OR_RAISE(auto output_batch, ProcessBatch(std::move(batch)));
output_batch.guarantee = guarantee;
ARROW_RETURN_NOT_OK(output_->InputReceived(this, std::move(output_batch)));
if (input_counter_.Increment()) {
this->Finish();
}
return Status::OK();
}
void MapNode::Finish() {}
} // namespace compute
} // namespace arrow