| 472 | } |
| 473 | |
| 474 | void VersionInfo::getSelVectorToScan(const transaction_t startTS, const transaction_t transactionID, |
| 475 | SelectionVector& selVector, const row_idx_t startRow, const row_idx_t numRows) const { |
| 476 | if (numRows == 0) { |
| 477 | return; |
| 478 | } |
| 479 | auto [startVectorIdx, startRowIdxInVector] = |
| 480 | StorageUtils::getQuotientRemainder(startRow, DEFAULT_VECTOR_CAPACITY); |
| 481 | auto [endVectorIdx, endRowIdxInVector] = |
| 482 | StorageUtils::getQuotientRemainder(startRow + numRows - 1, DEFAULT_VECTOR_CAPACITY); |
| 483 | auto vectorIdx = startVectorIdx; |
| 484 | selVector.setToUnfiltered(0); |
| 485 | sel_t outputPos = 0u; |
| 486 | while (vectorIdx <= endVectorIdx) { |
| 487 | const auto startRowIdx = vectorIdx == startVectorIdx ? startRowIdxInVector : 0; |
| 488 | const auto endRowIdx = |
| 489 | vectorIdx == endVectorIdx ? endRowIdxInVector : DEFAULT_VECTOR_CAPACITY - 1; |
| 490 | const auto numRowsInVector = endRowIdx - startRowIdx + 1; |
| 491 | const auto vectorVersion = getVectorVersionInfo(vectorIdx); |
| 492 | if (!vectorVersion) { |
| 493 | auto numSelected = selVector.getSelSize(); |
| 494 | if (selVector.isUnfiltered()) { |
| 495 | selVector.setSelSize(numSelected + numRowsInVector); |
| 496 | } else { |
| 497 | for (auto i = 0u; i < numRowsInVector; i++) { |
| 498 | selVector.getMutableBuffer()[numSelected++] = outputPos + i; |
| 499 | } |
| 500 | selVector.setToFiltered(numSelected); |
| 501 | } |
| 502 | } else { |
| 503 | vectorVersion->getSelVectorForScan(startTS, transactionID, selVector, startRowIdx, |
| 504 | numRowsInVector, outputPos); |
| 505 | } |
| 506 | outputPos += numRowsInVector; |
| 507 | vectorIdx++; |
| 508 | } |
| 509 | DASSERT(outputPos <= DEFAULT_VECTOR_CAPACITY); |
| 510 | } |
| 511 | |
| 512 | void VersionInfo::clearVectorInfo(const idx_t vectorIdx) { |
| 513 | DASSERT(vectorIdx < vectorsInfo.size()); |
no test coverage detected