* @brief The function is used to return the next row by the SRF.. **/
| 493 | * @brief The function is used to return the next row by the SRF.. |
| 494 | **/ |
| 495 | AnyType lda_unnest_transpose::SRF_next(void *user_fctx, bool *is_last_call) |
| 496 | { |
| 497 | sr_ctx * ctx = (sr_ctx *) user_fctx; |
| 498 | if (ctx->maxcall == ctx->curcall) { |
| 499 | *is_last_call = true; |
| 500 | return Null(); |
| 501 | } |
| 502 | |
| 503 | MutableArrayHandle<int32_t> outarray( |
| 504 | madlib_construct_array( |
| 505 | NULL, ctx->dim, INT4TI.oid, INT4TI.len, INT4TI.byval, |
| 506 | INT4TI.align)); |
| 507 | for (int i = 0; i < ctx->dim; i ++) { |
| 508 | outarray[i] = ctx->inarray[(ctx->maxcall + 1) * i + ctx->curcall]; |
| 509 | } |
| 510 | |
| 511 | ctx->curcall++; |
| 512 | *is_last_call = false; |
| 513 | |
| 514 | return outarray; |
| 515 | } |
| 516 | // ----------------------------------------------------------------------- |
| 517 | |
| 518 | void * lda_unnest::SRF_init(AnyType &args) |
no test coverage detected