| 211 | } |
| 212 | |
| 213 | bool ArrowNodeTable::lookupPK([[maybe_unused]] const transaction::Transaction* transaction, |
| 214 | common::ValueVector* keyVector, uint64_t vectorPos, common::offset_t& result) const { |
| 215 | if (keyVector->isNull(vectorPos)) { |
| 216 | return false; |
| 217 | } |
| 218 | |
| 219 | int64_t pkArrowColumnIdx = -1; |
| 220 | for (common::idx_t propIdx = 0; propIdx < nodeTableCatalogEntry->getNumProperties(); |
| 221 | ++propIdx) { |
| 222 | if (nodeTableCatalogEntry->getColumnID(propIdx) == getPKColumnID()) { |
| 223 | pkArrowColumnIdx = static_cast<int64_t>(propIdx); |
| 224 | break; |
| 225 | } |
| 226 | } |
| 227 | if (pkArrowColumnIdx < 0 || !schema.children || pkArrowColumnIdx >= schema.n_children || |
| 228 | !schema.children[pkArrowColumnIdx]) { |
| 229 | return false; |
| 230 | } |
| 231 | |
| 232 | auto keyToLookup = keyVector->getAsValue(vectorPos); |
| 233 | auto pkType = getColumn(getPKColumnID()).getDataType().copy(); |
| 234 | auto singleValueState = common::DataChunkState::getSingleValueDataChunkState(); |
| 235 | auto arrowPKVector = |
| 236 | std::make_unique<common::ValueVector>(std::move(pkType), memoryManager, singleValueState); |
| 237 | arrowPKVector->state->setToFlat(); |
| 238 | |
| 239 | for (size_t batchIdx = 0; batchIdx < arrays.size(); ++batchIdx) { |
| 240 | const auto& batch = arrays[batchIdx]; |
| 241 | const auto batchLength = getArrowBatchLength(batch); |
| 242 | if (batchLength == 0 || !batch.children || pkArrowColumnIdx >= batch.n_children || |
| 243 | !batch.children[pkArrowColumnIdx]) { |
| 244 | continue; |
| 245 | } |
| 246 | auto* pkChildArray = batch.children[pkArrowColumnIdx]; |
| 247 | auto* pkChildSchema = schema.children[pkArrowColumnIdx]; |
| 248 | common::ArrowNullMaskTree nullMask(pkChildSchema, pkChildArray, pkChildArray->offset, |
| 249 | pkChildArray->length); |
| 250 | for (uint64_t rowIdx = 0; rowIdx < batchLength; ++rowIdx) { |
| 251 | common::ArrowConverter::fromArrowArray(pkChildSchema, pkChildArray, *arrowPKVector, |
| 252 | &nullMask, pkChildArray->offset + rowIdx, 0, 1); |
| 253 | if (arrowPKVector->isNull(0)) { |
| 254 | continue; |
| 255 | } |
| 256 | if (*arrowPKVector->getAsValue(0) == *keyToLookup) { |
| 257 | result = batchStartOffsets[batchIdx] + rowIdx; |
| 258 | return true; |
| 259 | } |
| 260 | } |
| 261 | } |
| 262 | return false; |
| 263 | } |
| 264 | |
| 265 | bool ArrowNodeTable::isVisible([[maybe_unused]] const transaction::Transaction* transaction, |
| 266 | common::offset_t offset) const { |
nothing calls this directly
no test coverage detected