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

Function MergeCreateConsume

src/execution_plan/ops/op_merge_create.c:265–300  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

263}
264
265static Record MergeCreateConsume(OpBase *opBase) {
266 OpMergeCreate *op = (OpMergeCreate *)opBase;
267 Record r;
268
269 // Return mode, all data was consumed.
270 if(op->handoff_mode) return _handoff(op);
271
272 // Consume mode.
273 if(!opBase->childCount) {
274 // No child operation to call.
275 r = OpBase_CreateRecord(opBase);
276
277 /* Buffer all entity creations.
278 * If this operation has no children, it should always have unique creations. */
279 bool entities_created = _CreateEntities(op, r, op->gc);
280 ASSERT(entities_created == true);
281
282 // Save record for later use.
283 array_append(op->records, r);
284 } else {
285 // Pull record from child.
286 r = OpBase_Consume(opBase->children[0]);
287 if(r) {
288 /* Create entities. */
289 if(_CreateEntities(op, r, op->gc)) {
290 // Save record for later use.
291 array_append(op->records, r);
292 } else {
293 OpBase_DeleteRecord(r);
294 }
295 }
296 }
297
298 // MergeCreate returns no data while in creation mode.
299 return NULL;
300}
301
302void MergeCreate_Commit(OpBase *opBase) {
303 OpMergeCreate *op = (OpMergeCreate *)opBase;

Callers

nothing calls this directly

Calls 5

OpBase_CreateRecordFunction · 0.85
_CreateEntitiesFunction · 0.85
OpBase_ConsumeFunction · 0.85
OpBase_DeleteRecordFunction · 0.85
_handoffFunction · 0.70

Tested by

no test coverage detected