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

Method Pump

cpp/src/arrow/util/iterator.h:295–320  ·  view source on GitHub ↗

Calls the transform function on the current value. Can return in several ways If the next value is requested (e.g. skip) it will return an empty optional If an invalid status is encountered that will be returned If finished it will return IterationTraits ::End() If a value is returned by the transformer that will be returned

Source from the content-addressed store, hash-verified

293 // * If finished it will return IterationTraits<V>::End()
294 // * If a value is returned by the transformer that will be returned
295 Result<std::optional<V>> Pump() {
296 if (!finished_ && last_value_.has_value()) {
297 auto next_res = transformer_(*last_value_);
298 if (!next_res.ok()) {
299 finished_ = true;
300 return next_res.status();
301 }
302 auto next = std::move(*next_res);
303 if (next.ReadyForNext()) {
304 if (IsIterationEnd(*last_value_)) {
305 finished_ = true;
306 }
307 last_value_.reset();
308 }
309 if (next.Finished()) {
310 finished_ = true;
311 }
312 if (next.HasValue()) {
313 return next.Value();
314 }
315 }
316 if (finished_) {
317 return IterationTraits<V>::End();
318 }
319 return std::nullopt;
320 }
321
322 Iterator<T> it_;
323 Transformer<T, V> transformer_;

Callers

nothing calls this directly

Calls 9

IsIterationEndFunction · 0.85
ReadyForNextMethod · 0.80
EndFunction · 0.70
okMethod · 0.45
statusMethod · 0.45
resetMethod · 0.45
FinishedMethod · 0.45
HasValueMethod · 0.45
ValueMethod · 0.45

Tested by

no test coverage detected