Private helper for statement execution within the unified flow
(
&self,
statement: &Statement,
context: &mut ExecutionContext,
graph_expr: Option<&GraphExpression>,
session: Option<&Arc<std::sync::RwLock<UserSession>>>,
| 701 | |
| 702 | /// Private helper for statement execution within the unified flow |
| 703 | fn execute_statement( |
| 704 | &self, |
| 705 | statement: &Statement, |
| 706 | context: &mut ExecutionContext, |
| 707 | graph_expr: Option<&GraphExpression>, |
| 708 | session: Option<&Arc<std::sync::RwLock<UserSession>>>, |
| 709 | ) -> Result<QueryResult, ExecutionError> { |
| 710 | log::debug!( |
| 711 | "EXECUTOR: execute_statement called with statement type: {:?}", |
| 712 | std::mem::discriminant(statement) |
| 713 | ); |
| 714 | match statement { |
| 715 | Statement::Query(query) => { |
| 716 | // Handle basic queries, set operations, and limited queries |
| 717 | match query { |
| 718 | crate::ast::Query::Basic(basic_query) => { |
| 719 | // Use session-aware graph resolution instead of legacy execute_basic_query |
| 720 | |
| 721 | // Create a mini ExecutionRequest to use resolve_graph_for_execution |
| 722 | let mini_request = ExecutionRequest::new(statement.clone()) |
| 723 | .with_session(session.cloned()) |
| 724 | .with_graph_expr(graph_expr.cloned()); |
| 725 | |
| 726 | // Resolve graph with proper session context |
| 727 | let graph = self.resolve_graph_for_execution(&mini_request)?; |
| 728 | |
| 729 | // Create physical plan |
| 730 | use crate::ast::{Document, Query, Statement as AstStatement}; |
| 731 | use crate::plan::optimizer::QueryPlanner; |
| 732 | |
| 733 | let query = Query::Basic(basic_query.clone()); |
| 734 | let statement_ast = AstStatement::Query(query); |
| 735 | let document = Document { |
| 736 | statement: statement_ast, |
| 737 | location: crate::ast::Location { |
| 738 | line: 1, |
| 739 | column: 1, |
| 740 | offset: 0, |
| 741 | }, |
| 742 | }; |
| 743 | |
| 744 | let mut planner = QueryPlanner::new(); |
| 745 | let planned_query = planner.plan_query(&document).map_err(|e| { |
| 746 | ExecutionError::RuntimeError(format!("Planning error: {}", e)) |
| 747 | })?; |
| 748 | self.execute_with_provided_graph_and_audit(&planned_query, &graph, context) |
| 749 | } |
| 750 | crate::ast::Query::SetOperation(set_op) => { |
| 751 | self.execute_set_operation(set_op, context) |
| 752 | } |
| 753 | crate::ast::Query::Limited { |
| 754 | query, |
| 755 | order_clause, |
| 756 | limit_clause, |
| 757 | } => { |
| 758 | // Execute the inner query first |
| 759 | let mut result = self.execute_query_recursive(query, context)?; |
| 760 |
no test coverage detected