Changeset: 42a8375a652b for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=42a8375a652b Modified Files: monetdb5/optimizer/opt_mergetable.c monetdb5/optimizer/opt_mitosis.c Branch: default Log Message:
merged with Feb2013 diffs (107 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 @@ -37,6 +37,7 @@ typedef struct mat { int pm; /* parent mat, for sub relations */ mat_type_t type; /* type of operation */ int packed; + int pushed; } mat_t; static mat_type_t @@ -86,6 +87,7 @@ mat_add(mat_t *mat, int mtop, InstrPtr q mat[mtop].type = type; mat[mtop].pm = -1; mat[mtop].packed = 0; + mat[mtop].pushed = 0; (void)func; //printf (" mtop %d %s\n", mtop, func); return mtop+1; @@ -103,6 +105,7 @@ mat_add_var(mat_t *mat, int mtop, InstrP mat[mtop].im = inputmat; mat[mtop].pm = parentmat; mat[mtop].packed = 0; + mat[mtop].pushed = 1; return mtop+1; } @@ -976,6 +979,7 @@ mat_group_attr(MalBlkPtr mb, mat_t *mat, if (push) pushInstruction(mb,attr); mtop = mat_add_var(mat, mtop, attr, NULL, getArg(attr, 0), mat_ext, -1, -1); + mat[mtop-1].pushed = push; /* keep new attribute with the group extend */ mat[aext].im = mtop-1; } @@ -1048,6 +1052,7 @@ mat_group_new(MalBlkPtr mb, InstrPtr p, /* create mat's for the intermediates */ a = mtop = mat_add_var(mat, mtop, attr, NULL, getArg(attr, 0), mat_ext, -1, -1); + mat[mtop-1].pushed = push; g = mtop = mat_add_var(mat, mtop, r0, p, getArg(p, 0), mat_grp, b, -1); mtop = mat_add_var(mat, mtop, r1, p, getArg(p, 1), mat_ext, a-1, mtop-1); /* point back at group */ mtop = mat_add_var(mat, mtop, r2, p, getArg(p, 2), mat_cnt, -1, mtop-1); /* point back at ext */ @@ -1132,6 +1137,7 @@ mat_group_derive(MalBlkPtr mb, InstrPtr /* create mat's for the intermediates */ a = mtop = mat_add_var(mat, mtop, attr, NULL, getArg(attr, 0), mat_ext, -1, -1); + mat[mtop-1].pushed = push; g = mtop = mat_add_var(mat, mtop, r0, p, getArg(p, 0), mat_grp, b, g); mtop = mat_add_var(mat, mtop, r1, p, getArg(p, 1), mat_ext, a-1, mtop-1); /* point back at group */ mtop = mat_add_var(mat, mtop, r2, p, getArg(p, 2), mat_cnt, -1, mtop-1); /* point back at ext */ @@ -1265,6 +1271,7 @@ mat_topn(MalBlkPtr mb, InstrPtr p, mat_t } mtop = mat_add_var(mat, mtop, pck, p, getArg(p,0), is_slice?mat_slc:mat_tpn, (n>=0)?n:m, (n>=0)?m:-1); + mat[mtop-1].pushed = 0; if (is_slice) { /* real instruction */ @@ -1352,6 +1359,7 @@ OPTmergetableImplementation(Client cntxt (getFunctionId(p) == newRef || getFunctionId(p) == packRef)){ mat_set_prop(mb, p); mtop = mat_add(mat, mtop, p, mat_none, getFunctionId(p)); + mat[mtop-1].pushed = 1; continue; } @@ -1603,7 +1611,10 @@ OPTmergetableImplementation(Client cntxt freeInstruction(old[i]); GDKfree(old); } - + for (i=0; i<mtop; i++) { + if (mat[i].mi && !mat[i].pushed) + freeInstruction(mat[i].mi); + } GDKfree(mat); return actions; } diff --git a/monetdb5/optimizer/opt_mitosis.c b/monetdb5/optimizer/opt_mitosis.c --- a/monetdb5/optimizer/opt_mitosis.c +++ b/monetdb5/optimizer/opt_mitosis.c @@ -67,7 +67,13 @@ OPTmitosisImplementation(Client cntxt, M getFunctionId(p) == mark_grpRef || getFunctionId(p) == dense_rank_grpRef)) return 0; - if (getModuleId(p) == aggrRef && getFunctionId(p) == submedianRef) + if (p->argc > 2 && getModuleId(p) == aggrRef && + getFunctionId(p) != subcountRef && + getFunctionId(p) != subminRef && + getFunctionId(p) != submaxRef && + getFunctionId(p) != subavgRef && + getFunctionId(p) != subsumRef && + getFunctionId(p) != subprodRef) return 0; /* Mergetable cannot handle intersect/except's for now */ if (getModuleId(p) == algebraRef && getFunctionId(p) == groupbyRef) @@ -237,5 +243,9 @@ OPTmitosisImplementation(Client cntxt, M if (upd) pushInstruction(mb, matr); } + for (; i<limit; i++) + if (old[i]) + pushInstruction(mb,old[i]); + GDKfree(old); return 1; } _______________________________________________ checkin-list mailing list checkin-list@monetdb.org http://mail.monetdb.org/mailman/listinfo/checkin-list