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

Function NewCreateOp

src/execution_plan/ops/op_create.c:18–46  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16static void CreateFree(OpBase *opBase);
17
18OpBase *NewCreateOp(const ExecutionPlan *plan, NodeCreateCtx *nodes, EdgeCreateCtx *edges) {
19 OpCreate *op = rm_calloc(1, sizeof(OpCreate));
20 op->records = NULL;
21 NewPendingCreationsContainer(&op->pending, nodes, edges); // Prepare all creation variables.
22 // Set our Op operations
23 OpBase_Init((OpBase *)op, OPType_CREATE, "Create", NULL, CreateConsume,
24 NULL, NULL, CreateClone, CreateFree, true, plan);
25
26 uint node_blueprint_count = array_len(nodes);
27 uint edge_blueprint_count = array_len(edges);
28
29 // Construct the array of IDs this operation modifies
30 for(uint i = 0; i < node_blueprint_count; i ++) {
31 NodeCreateCtx *n = nodes + i;
32 n->node_idx = OpBase_Modifies((OpBase *)op, n->alias);
33 }
34 for(uint i = 0; i < edge_blueprint_count; i ++) {
35 EdgeCreateCtx *e = edges + i;
36 e->edge_idx = OpBase_Modifies((OpBase *)op, e->alias);
37 bool aware;
38 UNUSED(aware);
39 aware = OpBase_Aware((OpBase *)op, e->src, &e->src_idx);
40 ASSERT(aware == true);
41 aware = OpBase_Aware((OpBase *)op, e->dest, &e->dest_idx);
42 ASSERT(aware == true);
43 }
44
45 return (OpBase *)op;
46}
47
48// prepare to create all nodes for the current Record
49static void _CreateNodes

Callers 2

CreateCloneFunction · 0.85
_buildCreateOpFunction · 0.85

Calls 6

rm_callocFunction · 0.85
OpBase_InitFunction · 0.85
array_lenFunction · 0.85
OpBase_ModifiesFunction · 0.85
OpBase_AwareFunction · 0.85

Tested by

no test coverage detected