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

Method Next

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

Source from the content-addressed store, hash-verified

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