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

Function AST_PrepareCreateOp

src/ast/ast_build_op_contexts.c:433–461  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

431//------------------------------------------------------------------------------
432
433AST_CreateContext AST_PrepareCreateOp
434(
435 QueryGraph *qg,
436 rax *bound_vars,
437 const cypher_astnode_t *clause
438) {
439 // shouldn't operate on the original bound variables map
440 // as this function may insert aliases
441 rax *bound_and_introduced_entities = raxClone(bound_vars);
442
443 NodeCreateCtx *nodes_to_create = array_new(NodeCreateCtx, 1);
444 EdgeCreateCtx *edges_to_create = array_new(EdgeCreateCtx, 1);
445
446 const cypher_astnode_t *pattern = cypher_ast_create_get_pattern(clause);
447 uint npaths = cypher_ast_pattern_npaths(pattern);
448
449 for(uint j = 0; j < npaths; j++) {
450 const cypher_astnode_t *path = cypher_ast_pattern_get_path(pattern, j);
451 AST_PreparePathCreation(path, qg, bound_and_introduced_entities,
452 &nodes_to_create, &edges_to_create);
453 }
454
455 raxFree(bound_and_introduced_entities);
456
457 AST_CreateContext ctx = { .nodes_to_create = nodes_to_create,
458 .edges_to_create = edges_to_create };
459
460 return ctx;
461}
462

Callers 1

_buildCreateOpFunction · 0.85

Calls 2

raxCloneFunction · 0.85
AST_PreparePathCreationFunction · 0.85

Tested by

no test coverage detected