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

Method check_subquery_exists

graphlite/src/exec/executor.rs:1065–1083  ·  view source on GitHub ↗

Check if a subquery returns any results (optimized for EXISTS) Returns true as soon as the first result is found, without materializing all results

(
        &self,
        query: &crate::ast::Query,
        context: &ExecutionContext,
    )

Source from the content-addressed store, hash-verified

1063 /// Check if a subquery returns any results (optimized for EXISTS)
1064 /// Returns true as soon as the first result is found, without materializing all results
1065 fn check_subquery_exists(
1066 &self,
1067 query: &crate::ast::Query,
1068 context: &ExecutionContext,
1069 ) -> Result<bool, ExecutionError> {
1070 use crate::ast::Query;
1071 match query {
1072 Query::Basic(basic_query) => {
1073 // For basic queries, check existence with early termination
1074 self.check_basic_query_exists(basic_query, context)
1075 }
1076 _ => {
1077 // For complex queries (set operations, limited queries), fall back to full execution
1078 // TODO: These could also be optimized for early termination in the future
1079 let result = self.execute_subquery_with_context(query, context)?;
1080 Ok(!result.rows.is_empty())
1081 }
1082 }
1083 }
1084
1085 /// Check if a basic query returns any results with early termination
1086 fn check_basic_query_exists(

Callers 2

evaluate_expressionMethod · 0.80

Calls 3

is_emptyMethod · 0.45

Tested by

no test coverage detected