MCPcopy Create free account
hub / github.com/RedisGraph/RedisGraph / ExecutionPlan_FromTLS_AST

Function ExecutionPlan_FromTLS_AST

src/execution_plan/execution_plan.c:350–374  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

348}
349
350ExecutionPlan *ExecutionPlan_FromTLS_AST(void) {
351 AST *ast = QueryCtx_GetAST();
352
353 // handle UNION if there are any
354 bool union_query = AST_ContainsClause(ast, CYPHER_AST_UNION);
355 if(union_query) return _ExecutionPlan_UnionPlans(ast);
356
357 // execution plans are created in 1 or more segments
358 ExecutionPlan **segments = _process_segments(ast);
359 ASSERT(segments != NULL);
360 uint segment_count = array_len(segments);
361 ASSERT(segment_count > 0);
362
363 // connect all segments into a single ExecutionPlan
364 ExecutionPlan *plan = _tie_segments(segments, segment_count);
365
366 // the root operation is OpResults only if the query culminates in a RETURN
367 // or CALL clause
368 _implicit_result(plan);
369
370 // clean up
371 array_free(segments);
372
373 return plan;
374}
375
376void ExecutionPlan_PreparePlan(ExecutionPlan *plan) {
377 // Plan should be prepared only once.

Callers 4

ExecutionCtx_FromQueryFunction · 0.85
buildCallSubqueryPlanFunction · 0.85
build_ast_and_planFunction · 0.85

Calls 8

QueryCtx_GetASTFunction · 0.85
AST_ContainsClauseFunction · 0.85
_process_segmentsFunction · 0.85
array_lenFunction · 0.85
_tie_segmentsFunction · 0.85
_implicit_resultFunction · 0.85
array_freeFunction · 0.85

Tested by 1

build_ast_and_planFunction · 0.68