MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / execute

Function execute

nodedb/src/engine/graph/pattern/executor/mod.rs:48–58  ·  view source on GitHub ↗

Execute a MATCH query on a CSR index and edge store. Applies join order optimization before execution: triples within each PatternChain are reordered by selectivity (lowest edge count first, bound variables preferred). `frontier_bitmap`: when `Some`, only nodes whose surrogate is present in the bitmap are eligible as pattern anchors. Bound variables (already resolved from a prior binding row) by

(
    query: &MatchQuery,
    csr: &CsrIndex,
    edge_store: &EdgeStore,
    frontier_bitmap: Option<&nodedb_types::SurrogateBitmap>,
)

Source from the content-addressed store, hash-verified

46/// from a prior binding row) bypass the bitmap check — only free-variable
47/// anchor enumeration is restricted.
48pub fn execute(
49 query: &MatchQuery,
50 csr: &CsrIndex,
51 edge_store: &EdgeStore,
52 frontier_bitmap: Option<&nodedb_types::SurrogateBitmap>,
53) -> Result<MatchOutcome, crate::Error> {
54 // Optimize query before execution (reorder triples by selectivity).
55 let mut optimized = query.clone();
56 super::optimizer::optimize(&mut optimized, csr);
57 execute_query(&optimized, csr, edge_store, frontier_bitmap)
58}
59
60/// Execute a pre-optimized MATCH query (internal, skip optimizer).
61fn execute_query(

Callers 8

execute_simple_one_hopFunction · 0.70
execute_two_hopsFunction · 0.70
execute_optional_matchFunction · 0.70
execute_anti_joinFunction · 0.70
execute_with_limitFunction · 0.70
execute_empty_resultFunction · 0.70
execute_with_node_labelsFunction · 0.70

Calls 3

execute_queryFunction · 0.85
optimizeFunction · 0.50
cloneMethod · 0.45

Tested by 8

execute_simple_one_hopFunction · 0.56
execute_two_hopsFunction · 0.56
execute_optional_matchFunction · 0.56
execute_anti_joinFunction · 0.56
execute_with_limitFunction · 0.56
execute_empty_resultFunction · 0.56
execute_with_node_labelsFunction · 0.56