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

Function DeleteConsume

src/execution_plan/ops/op_delete.c:197–236  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

195}
196
197static Record DeleteConsume(OpBase *opBase) {
198 OpDelete *op = (OpDelete *)opBase;
199 Record r;
200 ASSERT(op->op.childCount > 0);
201
202 // return mode, all data was consumed
203 if(op->records) return _handoff(op);
204
205 // consume mode
206 op->records = array_new(Record, 32);
207 // initialize the records array with NULL
208 // which will terminate execution upon depletion
209 array_append(op->records, NULL);
210
211 GraphContext *gc = QueryCtx_GetGraphCtx();
212 // pull data until child is depleted
213 OpBase *child = op->op.children[0];
214 while((r = OpBase_Consume(child))) {
215 // persist scalars from previous ops before storing the record
216 // as those ops will be freed before the records are handed off
217 Record_PersistScalars(r);
218
219 // save record for later use
220 array_append(op->records, r);
221
222 // collect entities to be deleted
223 _CollectDeletedEntities(r, opBase);
224 }
225
226 // done reading, we're not going to call consume any longer
227 // there might be operations e.g. index scan that need to free
228 // index R/W lock, as such reset all execution plan operation up the chain
229 OpBase_PropagateReset(child);
230
231 // delete entities
232 _DeleteEntities(op);
233
234 // return record
235 return _handoff(op);
236}
237
238static OpBase *DeleteClone(const ExecutionPlan *plan, const OpBase *opBase) {
239 ASSERT(opBase->type == OPType_DELETE);

Callers

nothing calls this directly

Calls 7

QueryCtx_GetGraphCtxFunction · 0.85
OpBase_ConsumeFunction · 0.85
Record_PersistScalarsFunction · 0.85
_CollectDeletedEntitiesFunction · 0.85
OpBase_PropagateResetFunction · 0.85
_DeleteEntitiesFunction · 0.85
_handoffFunction · 0.70

Tested by

no test coverage detected