Changeset: 99484de8fca9 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=99484de8fca9 Modified Files: monetdb5/optimizer/opt_mergetable.c Branch: Oct2020 Log Message:
handle mat assignments (with multiple columns) correctly diffs (61 lines): diff --git a/monetdb5/optimizer/opt_mergetable.c b/monetdb5/optimizer/opt_mergetable.c --- a/monetdb5/optimizer/opt_mergetable.c +++ b/monetdb5/optimizer/opt_mergetable.c @@ -396,6 +396,32 @@ mat_delta(matlist_t *ml, MalBlkPtr mb, I return r; } +static InstrPtr +mat_assign(MalBlkPtr mb, InstrPtr p, matlist_t *ml) +{ + InstrPtr r = NULL; + mat_t *mat = ml->v; + + for(int i = 0; i<p->retc; i++) { + int res = is_a_mat(getArg(p,i), ml); + int m = is_a_mat(getArg(p,p->retc+i), ml); + assert(res<0 && m >= 0); + + if((r = newInstructionArgs(mb, matRef, packRef, mat[m].mi->argc)) == NULL) + return NULL; + getArg(r, 0) = getArg(p,i); + for(int k=1; k < mat[m].mi->argc; k++) { + /* reuse inputs of old mat */ + r = addArgument(mb, r, getArg(mat[m].mi, k)); + (void)setPartnr(ml, -1, getArg(mat[m].mi, k), k); + } + if (mat_add(ml, r, mat_none, getFunctionId(p))) { + freeInstruction(r); + return NULL; + } + } + return r; +} static InstrPtr mat_apply1(MalBlkPtr mb, InstrPtr p, matlist_t *ml, int m, int var) @@ -406,6 +432,8 @@ mat_apply1(MalBlkPtr mb, InstrPtr p, mat InstrPtr r = NULL, q; mat_t *mat = ml->v; + assert(!is_assign); + assert (p->retc == 1); /* Find the mat we overwrite */ @@ -2229,6 +2257,15 @@ OPTmergetableImplementation(Client cntxt continue; } + if (match == p->retc && p->argc == (p->retc*2) && getFunctionId(p) == NULL) { + if ((r = mat_assign(mb, p, &ml)) == NULL) { + msg = createException(MAL,"optimizer.mergetable",SQLSTATE(HY013) MAL_MALLOC_FAIL); + goto cleanup; + } + actions++; + continue; + } + m = n = o = e = -1; for( fm= p->argc-1; fm>=p->retc ; fm--) if ((m=is_a_mat(getArg(p,fm), &ml)) >= 0) _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list