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

Method Pump

cpp/src/arrow/util/iterator.h:294–319  ·  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

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