| 6 | namespace function { |
| 7 | |
| 8 | TableFuncMorsel SimpleTableFuncSharedState::getMorsel() { |
| 9 | std::lock_guard lck{mtx}; |
| 10 | DASSERT(curRowIdx <= numRows); |
| 11 | if (curRowIdx == numRows) { |
| 12 | return TableFuncMorsel::createInvalidMorsel(); |
| 13 | } |
| 14 | const auto numValuesToOutput = std::min(maxMorselSize, numRows - curRowIdx); |
| 15 | curRowIdx += numValuesToOutput; |
| 16 | return {curRowIdx - numValuesToOutput, curRowIdx}; |
| 17 | } |
| 18 | |
| 19 | std::unique_ptr<TableFuncSharedState> SimpleTableFunc::initSharedState( |
| 20 | const TableFuncInitSharedStateInput& input) { |