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

Method initScanForCommittedPersistent

src/storage/table/csr_node_group.cpp:86–127  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

84}
85
86void CSRNodeGroup::initScanForCommittedPersistent(const Transaction* transaction,
87 RelTableScanState& relScanState, CSRNodeGroupScanState& nodeGroupScanState) const {
88 // Scan the csr header chunks from disk.
89 ChunkState offsetState, lengthState;
90 auto& csrChunkGroup = persistentChunkGroup->cast<ChunkedCSRNodeGroup>();
91 const auto& csrHeader = csrChunkGroup.getCSRHeader();
92 // We are switching to a new node group.
93 // Initialize the scan states of a new node group for the csr header.
94 csrHeader.offset->initializeScanState(offsetState, relScanState.csrOffsetColumn);
95 csrHeader.length->initializeScanState(lengthState, relScanState.csrLengthColumn);
96 nodeGroupScanState.header->offset->setNumValues(0);
97 nodeGroupScanState.header->length->setNumValues(0);
98 // Initialize the scan states of a new node group for data columns.
99 for (auto i = 0u; i < relScanState.columnIDs.size(); i++) {
100 if (relScanState.columnIDs[i] == INVALID_COLUMN_ID ||
101 relScanState.columnIDs[i] == ROW_IDX_COLUMN_ID) {
102 continue;
103 }
104 auto& chunk = persistentChunkGroup->getColumnChunk(relScanState.columnIDs[i]);
105 chunk.initializeScanState(nodeGroupScanState.chunkStates[i], relScanState.columns[i]);
106 }
107 DASSERT(csrHeader.offset->getNumValues() == csrHeader.length->getNumValues());
108 if (relScanState.randomLookup) {
109 auto pos = relScanState.nodeIDVector->state->getSelVector()[0];
110 auto nodeOffset = relScanState.nodeIDVector->readNodeOffset(pos);
111 auto offsetInGroup = nodeOffset % StorageConfig::NODE_GROUP_SIZE;
112 auto offsetToScanFrom = offsetInGroup == 0 ? 0 : offsetInGroup - 1;
113 csrHeader.offset->scanCommitted<ResidencyState::ON_DISK>(transaction, offsetState,
114 *nodeGroupScanState.header->offset, offsetToScanFrom, 1);
115 csrHeader.length->scanCommitted<ResidencyState::ON_DISK>(transaction, lengthState,
116 *nodeGroupScanState.header->length, offsetInGroup, 1);
117 } else {
118 auto numBoundNodes = csrHeader.offset->getNumValues();
119 csrHeader.offset->scanCommitted<ResidencyState::ON_DISK>(transaction, offsetState,
120 *nodeGroupScanState.header->offset);
121 csrHeader.length->scanCommitted<ResidencyState::ON_DISK>(transaction, lengthState,
122 *nodeGroupScanState.header->length);
123 nodeGroupScanState.numTotalRows =
124 nodeGroupScanState.header->getStartCSROffset(numBoundNodes);
125 }
126 nodeGroupScanState.header->randomLookup = relScanState.randomLookup;
127}
128
129void CSRNodeGroup::initScanForCommittedInMem(RelTableScanState& relScanState,
130 CSRNodeGroupScanState& nodeGroupScanState) {

Callers

nothing calls this directly

Calls 5

getStartCSROffsetMethod · 0.80
initializeScanStateMethod · 0.45
setNumValuesMethod · 0.45
sizeMethod · 0.45
getNumValuesMethod · 0.45

Tested by

no test coverage detected