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

Method Next

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

Source from the content-addressed store, hash-verified

534 explicit FlattenIterator(Iterator<Iterator<T>> it) : parent_(std::move(it)) {}
535
536 Result<T> Next() {
537 if (IsIterationEnd(child_)) {
538 // Pop from parent's iterator.
539 ARROW_ASSIGN_OR_RAISE(child_, parent_.Next());
540
541 // Check if final iteration reached.
542 if (IsIterationEnd(child_)) {
543 return IterationTraits<T>::End();
544 }
545
546 return Next();
547 }
548
549 // Pop from child_ and check for depletion.
550 ARROW_ASSIGN_OR_RAISE(T out, child_.Next());
551 if (IsIterationEnd(out)) {
552 // Reset state such that we pop from parent on the recursive call
553 child_ = IterationTraits<Iterator<T>>::End();
554
555 return Next();
556 }
557
558 return out;
559 }
560
561 private:
562 Iterator<Iterator<T>> parent_;

Callers

nothing calls this directly

Calls 5

IsIterationEndFunction · 0.85
EndFunction · 0.70
ARROW_ASSIGN_OR_RAISEFunction · 0.50
NextFunction · 0.50
NextMethod · 0.45

Tested by

no test coverage detected