Changeset: 25dfeb5a3f19 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=25dfeb5a3f19 Modified Files: monetdb5/optimizer/opt_mitosis.c Branch: default Log Message:
Minor change diffs (95 lines): 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 @@ -11,23 +11,6 @@ #include "mal_interpreter.h" #include "gdk_utils.h" -static int -eligible(MalBlkPtr mb) -{ - InstrPtr p; - int i; - for (i = 1; i < mb->stop; i++) { - p = getInstrPtr(mb, i); - if (getModuleId(p) == sqlRef && getFunctionId(p) == assertRef && - p->argc > 2 && getArgType(mb, p, 2) == TYPE_str && - isVarConstant(mb, getArg(p, 2)) && - getVarConstant(mb, getArg(p, 2)).val.sval != NULL && - (strstr(getVarConstant(mb, getArg(p, 2)).val.sval, "PRIMARY KEY constraint") || - strstr(getVarConstant(mb, getArg(p, 2)).val.sval, "UNIQUE constraint"))) - return 0; - } - return 1; -} str OPTmitosisImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr p) @@ -48,14 +31,20 @@ OPTmitosisImplementation(Client cntxt, M //return 0; (void) cntxt; (void) stk; - if (!eligible(mb)) - return MAL_SUCCEED; activeClients = mb->activeClients = MCactiveClients(); old = mb->stmt; for (i = 1; i < mb->stop; i++) { InstrPtr p = old[i]; + if (getModuleId(p) == sqlRef && getFunctionId(p) == assertRef && + p->argc > 2 && getArgType(mb, p, 2) == TYPE_str && + isVarConstant(mb, getArg(p, 2)) && + getVarConstant(mb, getArg(p, 2)).val.sval != NULL && + (strstr(getVarConstant(mb, getArg(p, 2)).val.sval, "PRIMARY KEY constraint") || + strstr(getVarConstant(mb, getArg(p, 2)).val.sval, "UNIQUE constraint"))) + goto bailout; + /* mitosis/mergetable bailout conditions */ if (p->argc > 2 && getModuleId(p) == aggrRef && @@ -72,7 +61,7 @@ OPTmitosisImplementation(Client cntxt, M getFunctionId(p) != avgRef && getFunctionId(p) != sumRef && getFunctionId(p) != prodRef) - return 0; + goto bailout; /* do not split up floating point bat that is being summed */ if (p->retc == 1 && @@ -85,15 +74,15 @@ OPTmitosisImplementation(Client cntxt, M isaBatType(getArgType(mb, p, p->retc)) && (getBatType(getArgType(mb, p, p->retc)) == TYPE_flt || getBatType(getArgType(mb, p, p->retc)) == TYPE_dbl)) - return 0; + goto bailout; if (p->argc > 2 && (getModuleId(p) == capiRef || getModuleId(p) == rapiRef || getModuleId(p) == pyapiRef || getModuleId(p) == pyapi3Ref) && getFunctionId(p) == subeval_aggrRef) - return 0; + goto bailout; /* Mergetable cannot handle intersect/except's for now */ if (getModuleId(p) == algebraRef && getFunctionId(p) == groupbyRef) - return 0; + goto bailout; /* locate the largest non-partitioned table */ if (getModuleId(p) != sqlRef || (getFunctionId(p) != bindRef && getFunctionId(p) != bindidxRef)) @@ -119,7 +108,7 @@ OPTmitosisImplementation(Client cntxt, M } } if (target == 0) - return 0; + goto bailout; /* * The number of pieces should be based on the footprint of the * queryplan, such that preferrably it can be handled without @@ -287,6 +276,7 @@ OPTmitosisImplementation(Client cntxt, M chkDeclarations(mb); } /* keep all actions taken as a post block comment */ +bailout: usec = GDKusec()- usec; snprintf(buf,256,"%-20s actions=1 time=" LLFMT " usec","mitosis", usec); newComment(mb,buf); _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list