| 86 | } |
| 87 | |
| 88 | bool PrimaryKeyScanNodeTable::lookupRange(ExecutionContext* context) { |
| 89 | auto transaction = transaction::Transaction::Get(*context->clientContext); |
| 90 | while (currentRangeTableIdx < tableInfos.size()) { |
| 91 | auto& tableInfo = tableInfos[currentRangeTableIdx]; |
| 92 | auto& table = tableInfo.table->cast<NodeTable>(); |
| 93 | if (rangeOffsets.empty()) { |
| 94 | ValueVector* lowerBoundVector = nullptr; |
| 95 | uint64_t lowerPos = 0; |
| 96 | if (indexEvaluator != nullptr) { |
| 97 | indexEvaluator->evaluate(); |
| 98 | lowerBoundVector = indexEvaluator->resultVector.get(); |
| 99 | auto& lowerSelVector = lowerBoundVector->state->getSelVector(); |
| 100 | DASSERT(lowerSelVector.getSelSize() == 1); |
| 101 | lowerPos = lowerSelVector.getSelectedPositions()[0]; |
| 102 | if (lowerBoundVector->isNull(lowerPos)) { |
| 103 | currentRangeTableIdx++; |
| 104 | continue; |
| 105 | } |
| 106 | } |
| 107 | |
| 108 | ValueVector* upperBoundVector = nullptr; |
| 109 | uint64_t upperPos = 0; |
| 110 | if (upperBoundEvaluator != nullptr) { |
| 111 | upperBoundEvaluator->evaluate(); |
| 112 | upperBoundVector = upperBoundEvaluator->resultVector.get(); |
| 113 | auto& upperSelVector = upperBoundVector->state->getSelVector(); |
| 114 | DASSERT(upperSelVector.getSelSize() == 1); |
| 115 | upperPos = upperSelVector.getSelectedPositions()[0]; |
| 116 | if (upperBoundVector->isNull(upperPos)) { |
| 117 | currentRangeTableIdx++; |
| 118 | continue; |
| 119 | } |
| 120 | } |
| 121 | static constexpr auto maxRangeResults = std::numeric_limits<common::idx_t>::max(); |
| 122 | const auto found = |
| 123 | indexName.empty() ? |
| 124 | table.lookupPKRange(transaction, lowerBoundVector, lowerPos, lowerInclusive, |
| 125 | upperBoundVector, upperPos, upperInclusive, maxRangeResults, rangeOffsets) : |
| 126 | isIndexEquality ? table.lookupIndex(transaction, indexName, lowerBoundVector, |
| 127 | lowerPos, rangeOffsets) : |
| 128 | table.lookupIndexRange(transaction, indexName, lowerBoundVector, |
| 129 | lowerPos, lowerInclusive, upperBoundVector, upperPos, |
| 130 | upperInclusive, maxRangeResults, rangeOffsets); |
| 131 | if (!found) { |
| 132 | currentRangeTableIdx++; |
| 133 | continue; |
| 134 | } |
| 135 | } |
| 136 | |
| 137 | const auto remaining = rangeOffsets.size() - rangeOffsetCursor; |
| 138 | if (remaining == 0) { |
| 139 | rangeOffsets.clear(); |
| 140 | rangeOffsetCursor = 0; |
| 141 | currentRangeTableIdx++; |
| 142 | continue; |
| 143 | } |
| 144 | const auto outputSize = std::min<uint64_t>(remaining, common::DEFAULT_VECTOR_CAPACITY); |
| 145 | auto& selVector = scanState->nodeIDVector->state->getSelVectorUnsafe(); |
nothing calls this directly
no test coverage detected