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

Method scanIndexColumns

src/storage/table/node_table.cpp:948–985  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

946}
947
948void NodeTable::scanIndexColumns(main::ClientContext* context, IndexScanHelper& scanHelper,
949 const NodeGroupCollection& nodeGroups_, std::optional<uint64_t> queryID) const {
950 auto dataChunk = constructDataChunkForColumns(scanHelper.index->getIndexInfo().columnIDs);
951 const auto scanState =
952 scanHelper.initScanState(transaction::Transaction::Get(*context), dataChunk);
953
954 const auto numNodeGroups = nodeGroups_.getNumNodeGroups();
955 auto* progressBar = queryID.has_value() ? common::ProgressBar::Get(*context) : nullptr;
956 if (progressBar != nullptr) {
957 progressBar->addPipeline();
958 progressBar->updateProgress(queryID.value(), numNodeGroups == 0 ? 1.0 : 0.01);
959 }
960 for (node_group_idx_t nodeGroupToScan = 0u; nodeGroupToScan < numNodeGroups;
961 ++nodeGroupToScan) {
962 scanState->nodeGroup = nodeGroups_.getNodeGroupNoLock(nodeGroupToScan);
963
964 // It is possible for the node group to have no chunked groups if we are rolling back due to
965 // an exception that is thrown before any chunked groups could be appended to the node group
966 if (scanState->nodeGroup->getNumChunkedGroups() > 0) {
967 scanState->nodeGroupIdx = nodeGroupToScan;
968 scanHelper.currentNodeGroupIdx = nodeGroupToScan;
969 DASSERT(scanState->nodeGroup);
970 scanState->nodeGroup->initializeScanState(transaction::Transaction::Get(*context),
971 *scanState);
972 while (true) {
973 if (const auto scanResult = scanState->nodeGroup->scan(
974 transaction::Transaction::Get(*context), *scanState);
975 !scanHelper.processScanOutput(context, scanResult, scanState->outputVectors)) {
976 break;
977 }
978 }
979 }
980 if (progressBar != nullptr) {
981 progressBar->updateProgress(queryID.value(),
982 static_cast<double>(nodeGroupToScan + 1) / numNodeGroups);
983 }
984 }
985}
986
987void NodeTable::addIndex(std::unique_ptr<Index> index) {
988 if (getIndex(index->getName()).has_value()) {

Callers

nothing calls this directly

Calls 9

addPipelineMethod · 0.80
getNumChunkedGroupsMethod · 0.80
processScanOutputMethod · 0.80
initScanStateMethod · 0.45
getNumNodeGroupsMethod · 0.45
updateProgressMethod · 0.45
getNodeGroupNoLockMethod · 0.45
initializeScanStateMethod · 0.45
scanMethod · 0.45

Tested by

no test coverage detected