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

Method initScanState

src/storage/table/rel_table.cpp:172–191  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

170}
171
172void RelTable::initScanState(Transaction* transaction, TableScanState& scanState,
173 bool resetCachedBoundNodeSelVec) const {
174 auto& relScanState = scanState.cast<RelTableScanState>();
175 // Note there we directly read node at pos 0 here regardless the selVector is filtered or not.
176 // This is because we're assuming the nodeIDVector is always a sequence here.
177 const auto boundNodePos = resetCachedBoundNodeSelVec ?
178 relScanState.nodeIDVector->state->getSelVector()[0] :
179 relScanState.cachedBoundNodeSelVector[0];
180 const auto boundNodeID = relScanState.nodeIDVector->getValue<nodeID_t>(boundNodePos);
181 NodeGroup* nodeGroup = nullptr;
182 // Check if the node group idx is same as previous scan.
183 const auto nodeGroupIdx = StorageUtils::getNodeGroupIdx(boundNodeID.offset);
184 if (relScanState.nodeGroupIdx != nodeGroupIdx) {
185 // We need to re-initialize the node group scan state.
186 nodeGroup = getDirectedTableData(relScanState.direction)->getNodeGroup(nodeGroupIdx);
187 } else {
188 nodeGroup = relScanState.nodeGroup;
189 }
190 scanState.initState(transaction, nodeGroup, resetCachedBoundNodeSelVec);
191}
192
193bool RelTable::scanInternal(Transaction* transaction, TableScanState& scanState) {
194 return scanState.scanNext(transaction);

Callers 3

scanTableDataToChunkFunction · 0.45
initScanMethod · 0.45
startScanMethod · 0.45

Calls 2

initStateMethod · 0.80
getNodeGroupMethod · 0.45

Tested by

no test coverage detected