MCPcopy Create free account
hub / github.com/apache/arrow / Process

Method Process

cpp/src/arrow/acero/fetch_node.cc:161–188  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

159 }
160
161 Result<std::optional<util::SequencingQueue::Task>> Process(ExecBatch batch) override {
162 if (finished_) {
163 return std::nullopt;
164 }
165 FetchCounter::Page page = fetch_counter_.NextPage(batch);
166 std::optional<util::SequencingQueue::Task> task_or_none;
167 if (page.to_send > 0) {
168 int new_index = out_batch_count_++;
169 task_or_none = [this, to_send = page.to_send, to_skip = page.to_skip, new_index,
170 batch = std::move(batch)]() mutable {
171 ExecBatch batch_to_send = std::move(batch);
172 if (to_skip > 0 || to_send < batch_to_send.length) {
173 batch_to_send = batch_to_send.Slice(to_skip, to_send);
174 }
175 batch_to_send.index = new_index;
176 return output_->InputReceived(this, std::move(batch_to_send));
177 };
178 }
179 // In the in_batch_counter_ case we've run out of data to process (count_ was
180 // greater than the total # of non-skipped rows) In the page.ended case we've
181 // just hit our desired output count
182 if (in_batch_counter_.Increment() || (page.ended && !finished_)) {
183 finished_ = true;
184 ARROW_RETURN_NOT_OK(inputs_[0]->StopProducing());
185 ARROW_RETURN_NOT_OK(output_->InputFinished(this, out_batch_count_));
186 }
187 return task_or_none;
188 }
189
190 void Schedule(util::SequencingQueue::Task task) override {
191 plan_->query_context()->ScheduleTask(std::move(task), "FetchNode::ProcessBatch");

Callers

nothing calls this directly

Calls 5

NextPageMethod · 0.45
SliceMethod · 0.45
InputReceivedMethod · 0.45
StopProducingMethod · 0.45
InputFinishedMethod · 0.45

Tested by

no test coverage detected