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

Method probe

src/processor/operator/path_property_probe.cpp:291–336  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

289}
290
291void PathPropertyProbe::probe(lbug::processor::JoinHashTable* hashTable, uint64_t sizeProbed,
292 uint64_t sizeToProbe, ValueVector* idVector, const std::vector<ValueVector*>& propertyVectors,
293 const std::vector<ft_col_idx_t>& colIndicesToScan, const char* pathElementType) const {
294 // Hash
295 for (auto i = 0u; i < sizeToProbe; ++i) {
296 function::Hash::operation(idVector->getValue<internalID_t>(sizeProbed + i),
297 localState.hashes[i]);
298 }
299 // Probe hash
300 for (auto i = 0u; i < sizeToProbe; ++i) {
301 localState.probedTuples[i] = hashTable->getTupleForHash(localState.hashes[i]);
302 }
303 // Match value
304 for (auto i = 0u; i < sizeToProbe; ++i) {
305 localState.matchedTuples[i] = nullptr;
306 auto id = idVector->getValue<internalID_t>(sizeProbed + i);
307 while (localState.probedTuples[i]) {
308 auto currentTuple = localState.probedTuples[i];
309 if (*(internalID_t*)currentTuple == id) {
310 localState.matchedTuples[i] = currentTuple;
311 break;
312 }
313 localState.probedTuples[i] = *hashTable->getPrevTuple(currentTuple);
314 }
315 if (localState.matchedTuples[i] == nullptr) {
316 throw RuntimeException(std::format(
317 "PathPropertyProbe failed to find {} property tuple for path element id "
318 "{{tableID: {}, offset: {}}}. This indicates the {} property hash table is "
319 "missing an ID produced by recursive path enumeration. hashTableEntries={}, "
320 "pathDataOffset={}, probeBatchOffset={}.",
321 pathElementType, id.tableID, id.offset, pathElementType, hashTable->getNumEntries(),
322 sizeProbed + i, i));
323 }
324 }
325 // Scan table
326 auto factorizedTable = hashTable->getFactorizedTable();
327 for (auto i = 0u; i < sizeToProbe; ++i) {
328 auto tuple = localState.matchedTuples[i];
329 for (auto j = 0u; j < propertyVectors.size(); ++j) {
330 auto propertyVector = propertyVectors[j];
331 auto colIdx = colIndicesToScan[j];
332 factorizedTable->readFlatColToFlatVector(tuple, colIdx, *propertyVector,
333 sizeProbed + i);
334 }
335 }
336}
337
338} // namespace processor
339} // namespace lbug

Callers

nothing calls this directly

Calls 7

operationFunction · 0.85
getTupleForHashMethod · 0.80
getPrevTupleMethod · 0.80
getFactorizedTableMethod · 0.80
getNumEntriesMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected