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

Function ExecutionPlan_Clone

src/execution_plan/execution_plan_clone.c:71–81  ·  view source on GitHub ↗

This function clones the input ExecutionPlan by recursively visiting its tree of ops. * When an op is encountered that was constructed as part of a different ExecutionPlan segment, that segment * and its internal members (FilterTree, record mapping, query graphs, and AST segment) are also cloned. */

Source from the content-addressed store, hash-verified

69 * When an op is encountered that was constructed as part of a different ExecutionPlan segment, that segment
70 * and its internal members (FilterTree, record mapping, query graphs, and AST segment) are also cloned. */
71ExecutionPlan *ExecutionPlan_Clone(const ExecutionPlan *template) {
72 ASSERT(template != NULL);
73 // Store the original AST pointer.
74 AST *master_ast = QueryCtx_GetAST();
75 // Verify that the execution plan template is not prepared yet.
76 ASSERT(template->prepared == false && "Execution plan cloning should be only on templates");
77 ExecutionPlan *clone = _ExecutionPlan_Clone(template);
78 // Restore the original AST pointer.
79 QueryCtx_SetAST(master_ast);
80 return clone;
81}
82

Callers 2

ExecutionCtx_CloneFunction · 0.85

Calls 3

QueryCtx_GetASTFunction · 0.85
_ExecutionPlan_CloneFunction · 0.85
QueryCtx_SetASTFunction · 0.85

Tested by 1