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

Method select_statement_needs_graph_context

graphlite/src/exec/executor.rs:2861–2915  ·  view source on GitHub ↗

Check if a SELECT statement needs graph context

(
        &self,
        select_stmt: &crate::ast::SelectStatement,
    )

Source from the content-addressed store, hash-verified

2859
2860 /// Check if a SELECT statement needs graph context
2861 fn select_statement_needs_graph_context(
2862 &self,
2863 select_stmt: &crate::ast::SelectStatement,
2864 ) -> bool {
2865 // Check if FROM clause exists (implies graph operations)
2866 if select_stmt.from_clause.is_some() {
2867 return true;
2868 }
2869
2870 // Check expressions in return items
2871 match &select_stmt.return_items {
2872 crate::ast::SelectItems::Wildcard { .. } => return true, // Wildcard implies graph data
2873 crate::ast::SelectItems::Explicit { items, .. } => {
2874 for item in items {
2875 if self.expression_needs_graph_context(&item.expression) {
2876 return true;
2877 }
2878 }
2879 }
2880 }
2881
2882 // Check WHERE clause expressions
2883 if let Some(where_clause) = &select_stmt.where_clause {
2884 if self.expression_needs_graph_context(&where_clause.condition) {
2885 return true;
2886 }
2887 }
2888
2889 // Check GROUP BY expressions
2890 if let Some(group_clause) = &select_stmt.group_clause {
2891 for expr in &group_clause.expressions {
2892 if self.expression_needs_graph_context(expr) {
2893 return true;
2894 }
2895 }
2896 }
2897
2898 // Check HAVING clause expressions
2899 if let Some(having_clause) = &select_stmt.having_clause {
2900 if self.expression_needs_graph_context(&having_clause.condition) {
2901 return true;
2902 }
2903 }
2904
2905 // Check ORDER BY expressions
2906 if let Some(order_clause) = &select_stmt.order_clause {
2907 for item in &order_clause.items {
2908 if self.expression_needs_graph_context(&item.expression) {
2909 return true;
2910 }
2911 }
2912 }
2913
2914 false
2915 }
2916
2917 /// Check if an expression needs graph context
2918 fn expression_needs_graph_context(&self, expr: &crate::ast::Expression) -> bool {

Callers 2

execute_statementMethod · 0.80

Calls 1

Tested by

no test coverage detected