Changeset: c34557a9a866 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c34557a9a866
Modified Files:
monetdb5/optimizer/opt_mergetable.c
Branch: default
Log Message:
merged with oct2020
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
@@ -375,6 +375,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)
@@ -385,6 +411,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 */
@@ -2240,6 +2268,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
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list