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

Method execute_generic_function

graphlite/src/exec/executor.rs:5676–5714  ·  view source on GitHub ↗

Execute a generic function

(
        &self,
        function_name: &str,
        arguments: &[Expression],
        input_rows: Vec<Row>,
        context: &mut ExecutionContext,
    )

Source from the content-addressed store, hash-verified

5674
5675 /// Execute a generic function
5676 fn execute_generic_function(
5677 &self,
5678 function_name: &str,
5679 arguments: &[Expression],
5680 input_rows: Vec<Row>,
5681 context: &mut ExecutionContext,
5682 ) -> Result<Vec<Row>, ExecutionError> {
5683 // Get the function from registry
5684 let function = self.function_registry.get(function_name).ok_or_else(|| {
5685 ExecutionError::UnsupportedOperator(format!("Function not found: {}", function_name))
5686 })?;
5687
5688 // Evaluate arguments
5689 let mut evaluated_args = Vec::new();
5690 for arg in arguments {
5691 let value = self.evaluate_expression(arg, context)?;
5692 evaluated_args.push(value);
5693 }
5694
5695 // Create function context with storage access
5696 let function_context = FunctionContext::with_storage(
5697 input_rows.clone(),
5698 context.variables.clone(),
5699 evaluated_args,
5700 context.storage_manager.clone(),
5701 context.current_graph.clone(),
5702 context.get_current_graph_name(),
5703 );
5704
5705 // Execute the function
5706 let result = function.execute(&function_context).map_err(|e| {
5707 ExecutionError::UnsupportedOperator(format!("Function execution error: {}", e))
5708 })?;
5709
5710 // Return a single row with the result
5711 let mut result_row = Row::new();
5712 result_row.values.insert(function_name.to_string(), result);
5713 Ok(vec![result_row])
5714 }
5715
5716 /// Execute hash aggregation
5717 fn execute_hash_aggregate(

Callers 2

Calls 6

cloneMethod · 0.80
getMethod · 0.45
evaluate_expressionMethod · 0.45
executeMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected