| 195 | } |
| 196 | |
| 197 | static 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 | |
| 238 | static OpBase *DeleteClone(const ExecutionPlan *plan, const OpBase *opBase) { |
| 239 | ASSERT(opBase->type == OPType_DELETE); |
nothing calls this directly
no test coverage detected