| 902 | } |
| 903 | |
| 904 | bool NodeTable::scanPKColumn(const Transaction* transaction, const Value& keyToLookup, |
| 905 | std::vector<ColumnPredicateSet> columnPredicateSets, offset_t& result) const { |
| 906 | auto dataChunk = constructDataChunkForColumns({pkColumnID}); |
| 907 | std::vector<ValueVector*> outVectors = {&dataChunk.getValueVectorMutable(0)}; |
| 908 | auto scanState = |
| 909 | std::make_unique<NodeTableScanState>(nullptr, std::move(outVectors), dataChunk.state); |
| 910 | scanState->source = TableScanSource::COMMITTED; |
| 911 | scanState->setToTable(transaction, const_cast<NodeTable*>(this), {pkColumnID}, |
| 912 | std::move(columnPredicateSets)); |
| 913 | const auto numNodeGroups = nodeGroups->getNumNodeGroupsNoLock(); |
| 914 | for (node_group_idx_t nodeGroupIdx = 0; nodeGroupIdx < numNodeGroups; ++nodeGroupIdx) { |
| 915 | auto* nodeGroup = nodeGroups->getNodeGroupNoLock(nodeGroupIdx); |
| 916 | if (nodeGroup->getNumChunkedGroups() == 0) { |
| 917 | continue; |
| 918 | } |
| 919 | scanState->nodeGroup = nodeGroup; |
| 920 | scanState->nodeGroupIdx = nodeGroupIdx; |
| 921 | nodeGroup->initializeScanState(transaction, *scanState); |
| 922 | while (true) { |
| 923 | const auto scanResult = nodeGroup->scan(transaction, *scanState); |
| 924 | if (scanResult == NODE_GROUP_SCAN_EMPTY_RESULT) { |
| 925 | break; |
| 926 | } |
| 927 | auto* scannedVector = scanState->outputVectors[0]; |
| 928 | for (idx_t i = 0; i < scannedVector->state->getSelSize(); ++i) { |
| 929 | const auto pos = scannedVector->state->getSelVector()[i]; |
| 930 | if (scannedVector->isNull(pos)) { |
| 931 | continue; |
| 932 | } |
| 933 | if (!(*scannedVector->getAsValue(pos) == keyToLookup)) { |
| 934 | continue; |
| 935 | } |
| 936 | const auto offset = StorageUtils::getStartOffsetOfNodeGroup(nodeGroupIdx) + |
| 937 | scanResult.startRow + pos; |
| 938 | if (isVisibleNoLock(transaction, offset)) { |
| 939 | result = offset; |
| 940 | return true; |
| 941 | } |
| 942 | } |
| 943 | } |
| 944 | } |
| 945 | return false; |
| 946 | } |
| 947 | |
| 948 | void NodeTable::scanIndexColumns(main::ClientContext* context, IndexScanHelper& scanHelper, |
| 949 | const NodeGroupCollection& nodeGroups_, std::optional<uint64_t> queryID) const { |
nothing calls this directly
no test coverage detected