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

Function _CreateNodes

src/execution_plan/ops/op_create.c:49–82  ·  view source on GitHub ↗

prepare to create all nodes for the current Record

Source from the content-addressed store, hash-verified

47
48// prepare to create all nodes for the current Record
49static void _CreateNodes
50(
51 OpCreate *op,
52 Record r,
53 GraphContext *gc
54) {
55 uint nodes_to_create_count = array_len(op->pending.nodes_to_create);
56 for(uint i = 0; i < nodes_to_create_count; i++) {
57 // get specified node to create
58 NodeCreateCtx *n = op->pending.nodes_to_create + i;
59
60 // create a new node
61 Node newNode = Graph_ReserveNode(gc->g);
62
63 // add new node to Record and save a reference to it
64 Node *node_ref = Record_AddNode(r, n->node_idx, newNode);
65
66 // convert query-level properties
67 AttributeSet converted_attr = NULL;
68 PropertyMap *map = n->properties;
69 if(map != NULL) {
70 ConvertPropertyMap(gc, &converted_attr, r, map, false);
71 }
72
73 // save node for later insertion
74 array_append(op->pending.created_nodes, node_ref);
75
76 // save attributes to insert with node
77 array_append(op->pending.node_attributes, converted_attr);
78
79 // save labels to assigned to node
80 array_append(op->pending.node_labels, n->labelsId);
81 }
82}
83
84// prepare to create all edges for the current Record
85static void _CreateEdges

Callers 1

CreateConsumeFunction · 0.85

Calls 4

array_lenFunction · 0.85
Graph_ReserveNodeFunction · 0.85
Record_AddNodeFunction · 0.85
ConvertPropertyMapFunction · 0.85

Tested by

no test coverage detected