MCPcopy Create free account
hub / github.com/LadybugDB/ladybug / getSelVectorToScan

Method getSelVectorToScan

src/storage/table/version_info.cpp:474–510  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

472}
473
474void 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
512void VersionInfo::clearVectorInfo(const idx_t vectorIdx) {
513 DASSERT(vectorIdx < vectorsInfo.size());

Callers 1

scanMethod · 0.80

Calls 7

setToUnfilteredMethod · 0.80
getSelSizeMethod · 0.80
isUnfilteredMethod · 0.80
setSelSizeMethod · 0.80
getMutableBufferMethod · 0.80
setToFilteredMethod · 0.80
getSelVectorForScanMethod · 0.80

Tested by

no test coverage detected