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

Function execute_clause

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

Execute a single MATCH clause.

(
    clause: &MatchClause,
    csr: &CsrIndex,
    input_rows: &[BindingRow],
    state: &mut ExecutionState,
    frontier_bitmap: Option<&nodedb_types::SurrogateBitmap>,
)

Source from the content-addressed store, hash-verified

129
130/// Execute a single MATCH clause.
131pub(super) fn execute_clause(
132 clause: &MatchClause,
133 csr: &CsrIndex,
134 input_rows: &[BindingRow],
135 state: &mut ExecutionState,
136 frontier_bitmap: Option<&nodedb_types::SurrogateBitmap>,
137) -> Result<Vec<BindingRow>, crate::Error> {
138 let mut result_rows = input_rows.to_vec();
139
140 for chain in &clause.patterns {
141 let mut next_rows = Vec::new();
142 for row in &result_rows {
143 next_rows.extend(execute_chain(chain, csr, row, state, frontier_bitmap)?);
144 }
145 result_rows = next_rows;
146 }
147
148 Ok(result_rows)
149}
150
151/// Execute a single pattern chain against a binding row.
152fn execute_chain(

Callers 2

execute_queryFunction · 0.85
apply_predicateFunction · 0.85

Calls 3

execute_chainFunction · 0.85
to_vecMethod · 0.45
extendMethod · 0.45

Tested by

no test coverage detected