| 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"); |
nothing calls this directly
no test coverage detected