| 170 | } |
| 171 | |
| 172 | void 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 | |
| 193 | bool RelTable::scanInternal(Transaction* transaction, TableScanState& scanState) { |
| 194 | return scanState.scanNext(transaction); |
no test coverage detected