consumes a record from the lhs, plants it in the Argument\List op(s), and consumes a record from the body until depletion. in case the subquery is returning, merges the input (lhs) record with the output record. otherwise, the input record is passed as-is upon depletion of the body, repeats the above. depletion of lhs yields depletion of this operation
| 299 | // upon depletion of the body, repeats the above. depletion of lhs yields |
| 300 | // depletion of this operation |
| 301 | static Record CallSubqueryConsume |
| 302 | ( |
| 303 | OpBase *opBase // operation |
| 304 | ) { |
| 305 | OpCallSubquery *op = (OpCallSubquery *)opBase; |
| 306 | |
| 307 | // if there are more records to consume from body, consume them before |
| 308 | // consuming another record from lhs |
| 309 | if(op->r) { |
| 310 | return _handoff(op); |
| 311 | } |
| 312 | ASSERT(op->r == NULL); |
| 313 | |
| 314 | // consume from lhs if exists, otherwise create a dummy-record to pass to |
| 315 | // the body (rhs). the latter case will happen AT MOST once |
| 316 | if(op->lhs) { |
| 317 | op->r = OpBase_Consume(op->lhs); |
| 318 | } else if(op->first) { |
| 319 | op->r = OpBase_CreateRecord((OpBase *)op); |
| 320 | op->first = false; |
| 321 | } |
| 322 | |
| 323 | // plant the record consumed at the Argument ops |
| 324 | if(op->r) { |
| 325 | _plant_records_Arguments(op); |
| 326 | } else { |
| 327 | // no records - lhs depleted |
| 328 | return NULL; |
| 329 | } |
| 330 | |
| 331 | return _handoff(op); |
| 332 | } |
| 333 | |
| 334 | // frees CallSubquery internal data structures |
| 335 | static void _free_records |
nothing calls this directly
no test coverage detected