MCPcopy Create free account
hub / github.com/GraphLite-AI/GraphLite / evaluate_where_expression_on_row

Method evaluate_where_expression_on_row

graphlite/src/exec/executor.rs:1609–1631  ·  view source on GitHub ↗

Evaluate a WHERE expression on a single row

(
        &self,
        where_clause: &crate::ast::WhereClause,
        row: &Row,
        context: &ExecutionContext,
    )

Source from the content-addressed store, hash-verified

1607
1608 /// Evaluate a WHERE expression on a single row
1609 fn evaluate_where_expression_on_row(
1610 &self,
1611 where_clause: &crate::ast::WhereClause,
1612 row: &Row,
1613 context: &ExecutionContext,
1614 ) -> Result<bool, ExecutionError> {
1615 // Create a temporary context that includes the current row data
1616 let mut temp_context = context.clone();
1617
1618 // Add row variables to the context
1619 for (key, value) in &row.values {
1620 temp_context.variables.insert(key.clone(), value.clone());
1621 }
1622
1623 // Use the regular expression evaluation which handles binary expressions
1624 let result = self.evaluate_expression(&where_clause.condition, &temp_context)?;
1625 match result {
1626 crate::storage::Value::Boolean(b) => Ok(b),
1627 crate::storage::Value::Null => Ok(false),
1628 crate::storage::Value::Number(n) => Ok(n != 0.0),
1629 _ => Ok(true), // Non-null, non-false values are truthy
1630 }
1631 }
1632
1633 /// Convert Vec<Row> to the format expected by WithClauseProcessor
1634 fn convert_rows_to_processor_format(

Callers 1

Calls 3

cloneMethod · 0.80
insertMethod · 0.45
evaluate_expressionMethod · 0.45

Tested by

no test coverage detected