// Next advances the iterator and reports if it is still valid.
500821
func (t *TSMIndexIterator) Next() bool {
	t.d.mu.RLock()
	if n := len(t.d.ro.offsets); t.n != n {
		t.err, t.ok = fmt.Errorf("Key count changed during iteration"), false
	}
	if !t.ok || t.err != nil {
		t.d.mu.RUnlock()
		return false
	}
	if !t.peeked && !t.first {
		t.ok = t.iter.Next()
	}
	if !t.ok {
		t.d.mu.RUnlock()
		return false
	}

	t.peeked = false
	t.first = false

	t.offset = t.iter.Offset()
	t.eoffset = t.iter.EntryOffset(t.b)
	t.d.mu.RUnlock()

	// reset lazy loaded state
	t.key = nil
	t.typ = 0
	t.entries = t.entries[:0]
	return true
}
815058
func (t *batchIter) next() (kind internalKeyKind, ukey []byte, value []byte, ok bool) {
	p := *t
	if len(p) == 0 {
		return 0, nil, nil, false
	}
	kind, *t = internalKeyKind(p[0]), p[1:]
	if kind > internalKeyKindMax {
		return 0, nil, nil, false
	}
	ukey, ok = t.nextStr()
	if !ok {
		return 0, nil, nil, false
	}
	if kind != internalKeyKindDelete {
		value, ok = t.nextStr()
		if !ok {
			return 0, nil, nil, false
		}
	}
	return kind, ukey, value, true
}
2478
func (it *Iterator4Chunk) Next() Row {
	if it.cursor >= it.numRows {
		it.cursor = it.numRows + 1
		return it.End()
	}
	row := it.chk.GetRow(int(it.cursor))
	it.cursor++
	return row
}
114281
func (i *Int16) Next() int16 {
	i.lock.Lock()
	defer i.lock.Unlock()
	i.increment++
	return i.increment
}
214012
func (i *SeriesCollectionIterator) Next() bool {
	i.index++
	return i.index < i.length
}
396517
func (itr *limitIterator) Next() (rowID, columnID uint64, eof bool) {
	// Always return EOF once it is reached by limit or the underlying iterator.
	if itr.eof {
		return 0, 0, true
	}

	// Retrieve pair from underlying iterator.
	// Mark as EOF if it is beyond the limit (or at EOF).
	rowID, columnID, eof = itr.itr.Next()
	if eof || rowID > itr.maxRowID || (rowID == itr.maxRowID && columnID > itr.maxColumnID) {
		itr.eof = true
		return 0, 0, true
	}

	return rowID, columnID, false
}
257087
func (e *StringDecoder) Next() bool {
	if e.err != nil {
		return false
	}

	e.i += e.l
	return e.i < len(e.b)
}
471042
func (pd *DocumentIterator) Next(d Document) error {
	pd.loadInternal()

	hasNext := pd.iterator.Next(d)
	if hasNext {
		return nil
	}
	return pd.iterator.Err()
}
752326
func (e *baseExecutor) Next(ctx context.Context, req *chunk.RecordBatch) error {
	return nil
}
635140
func (itr *sliceIterator) Next() (rowID, columnID uint64, eof bool) {
	if itr.i >= itr.n {
		return 0, 0, true
	}

	rowID = itr.rowIDs[itr.i]
	columnID = itr.columnIDs[itr.i]

	itr.i++
	return rowID, columnID, false
}
73474
func (it *stackIterator) Next() bool {
	if it.err != nil || it.atend {
		return false
	}
	callFrameRegs, ret, retaddr := it.advanceRegs()
	it.frame = it.newStackframe(ret, retaddr)

	if it.stkbar != nil && it.frame.Ret == it.stackBarrierPC && it.frame.addrret == it.stkbar[0].ptr {
		// Skip stack barrier frames
		it.frame.Ret = it.stkbar[0].val
		it.stkbar = it.stkbar[1:]
	}

	if it.switchStack() {
		return true
	}

	if it.frame.Ret <= 0 {
		it.atend = true
		return true
	}

	it.top = false
	it.pc = it.frame.Ret
	it.regs = callFrameRegs
	return true
}
225597
func (iter *iteratorSingle) Next() error {
	err := iter.sc.Next()
	if err != nil {
		iter.op = 0
		iter.k = nil
		iter.v = nil

		// we DO want to return ErrIteratorDone here
		return err
	}

	iter.op, iter.k, iter.v = iter.sc.Current()
	if iter.op != OperationDel ||
		iter.iteratorOptions.IncludeDeletions {
		return nil
	}

	return iter.Next()
}
523711
func (e *CheckIndexRangeExec) Next(ctx context.Context, req *chunk.RecordBatch) error {
	req.Reset()
	handleIdx := e.schema.Len() - 1
	for {
		err := e.result.Next(ctx, e.srcChunk)
		if err != nil {
			return err
		}
		if e.srcChunk.NumRows() == 0 {
			return nil
		}
		iter := chunk.NewIterator4Chunk(e.srcChunk)
		for row := iter.Begin(); row != iter.End(); row = iter.Next() {
			handle := row.GetInt64(handleIdx)
			for _, hr := range e.handleRanges {
				if handle >= hr.Begin && handle < hr.End {
					req.AppendRow(row)
					break
				}
			}
		}
		if req.NumRows() > 0 {
			return nil
		}
	}
}
173408
func (i *ObjectIterator) Next() error {
	i.position++
	if i.position < i.size && i.current != nil {
		var err error
		// skip over key
		i.current, err = i.current.Next()
		if err != nil {
			return WithStack(err)
		}
		// skip over value
		i.current, err = i.current.Next()
		if err != nil {
			return WithStack(err)
		}
	} else {
		i.current = nil
	}
	return nil
}
1144535
func (it *iterator4RowPtr) Next() Row {
	if len := it.Len(); it.cursor >= len {
		it.cursor = len + 1
		return it.End()
	}
	row := it.li.GetRow(it.ptrs[it.cursor])
	it.cursor++
	return row
}
1212717
func (c *Ctx) Next() {
	c.index++
	c.handlers[c.index](c.parent)
}
656562
func (m *enumerator) Next() error {
	m.lowCurr += 1
	if m.lowCurr >= len(m.lowIdxs) {
		// move all the current low iterators forwards
		for _, vi := range m.lowIdxs {
			err := m.itrs[vi].Next()
			if err != nil && err != vellum.ErrIteratorDone {
				return err
			}
			m.currKs[vi], m.currVs[vi] = m.itrs[vi].Current()
		}
		// can skip any empty keys encountered at this point
		m.updateMatches(true)
	}
	if m.lowK == nil && len(m.lowIdxs) == 0 {
		return vellum.ErrIteratorDone
	}
	return nil
}