Changeset: 93de6de1fc63 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=93de6de1fc63 Modified Files: monetdb5/modules/mal/manifold.c monetdb5/optimizer/opt_support.c sql/backends/monet5/sql_gencode.c sql/backends/monet5/sql_optimizer.c sql/backends/monet5/sql_scenario.c sql/server/rel_optimizer.c Branch: default Log Message:
Merge with Nov2019 diffs (138 lines): diff --git a/monetdb5/modules/mal/manifold.c b/monetdb5/modules/mal/manifold.c --- a/monetdb5/modules/mal/manifold.c +++ b/monetdb5/modules/mal/manifold.c @@ -370,7 +370,7 @@ MANIFOLDremapMultiplex(Client cntxt, Mal { (void) mb; (void) cntxt; - throw(MAL, "opt.remap", "Function '%s.%s' not defined", + throw(MAL, "mal.multiplex", "Function '%s.%s' not defined", *getArgReference_str(stk, p, p->retc), *getArgReference_str(stk, p, p->retc + 1)); } diff --git a/monetdb5/optimizer/opt_support.c b/monetdb5/optimizer/opt_support.c --- a/monetdb5/optimizer/opt_support.c +++ b/monetdb5/optimizer/opt_support.c @@ -96,7 +96,7 @@ optimizeMALBlock(Client cntxt, MalBlkPtr /* assume the type and flow have been checked already */ /* SQL functions intended to be inlined should not be optimized */ if ( mb->inlineProp) - return 0; + return 0; mb->optimize = 0; if (mb->errors) @@ -105,9 +105,9 @@ optimizeMALBlock(Client cntxt, MalBlkPtr // strong defense line, assure that MAL plan is initially correct if( mb->errors == 0 && mb->stop > 1){ resetMalBlk(mb, mb->stop); - chkTypes(cntxt->usermodule, mb, FALSE); - chkFlow(mb); - chkDeclarations(mb); + chkTypes(cntxt->usermodule, mb, FALSE); + chkFlow(mb); + chkDeclarations(mb); if( msg) return msg; if( mb->errors != MAL_SUCCEED){ @@ -132,7 +132,7 @@ optimizeMALBlock(Client cntxt, MalBlkPtr if (msg) { str place = getExceptionPlace(msg); str nmsg = NULL; - if(place){ + if (place){ nmsg = createException(getExceptionType(msg), place, "%s", getExceptionMessageAndState(msg)); GDKfree(place); } diff --git a/sql/backends/monet5/sql_gencode.c b/sql/backends/monet5/sql_gencode.c --- a/sql/backends/monet5/sql_gencode.c +++ b/sql/backends/monet5/sql_gencode.c @@ -140,7 +140,8 @@ static int MalBlkPtr curBlk = 0; InstrPtr curInstr = 0; Symbol backup = NULL, curPrg = NULL; - int old_argc = be->mvc->argc; + int old_argc = be->mvc->argc, res = 0; + str msg = MAL_SUCCEED; backup = c->curprg; curPrg = c->curprg = newFunction(putName(mod), putName(name), FUNCTIONsymbol); @@ -208,21 +209,31 @@ static int return -1; } be->mvc->argc = old_argc; - /* SQL function definitions meant for inlineing should not be optimized before */ + /* SQL function definitions meant for inlining should not be optimized before */ if (inline_func) curBlk->inlineProp = 1; /* optimize the code */ SQLaddQueryToCache(c); if (curBlk->inlineProp == 0 && !c->curprg->def->errors) { - c->curprg->def->errors = SQLoptimizeQuery(c, c->curprg->def); - } else if(curBlk->inlineProp != 0) { + msg = SQLoptimizeQuery(c, c->curprg->def); + } else if (curBlk->inlineProp != 0) { chkProgram(c->usermodule, c->curprg->def); - if(!c->curprg->def->errors) - c->curprg->def->errors = SQLoptimizeFunction(c,c->curprg->def); + if (!c->curprg->def->errors) + msg = SQLoptimizeFunction(c,c->curprg->def); + } + if (msg) { + if (c->curprg->def->errors) + GDKfree(msg); + else + c->curprg->def->errors = msg; + } + if (c->curprg->def->errors) { + freeSymbol(curPrg); + res = -1; } if (backup) c->curprg = backup; - return 0; + return res; } static str diff --git a/sql/backends/monet5/sql_optimizer.c b/sql/backends/monet5/sql_optimizer.c --- a/sql/backends/monet5/sql_optimizer.c +++ b/sql/backends/monet5/sql_optimizer.c @@ -258,7 +258,7 @@ SQLoptimizeQuery(Client c, MalBlkPtr mb) if (msg != MAL_SUCCEED) freeException(msg); /* ignore error */ } - return NULL; + return createException(MAL, "optimizer.optimizeQuery", "%s", mb->errors); } pipe = getSQLoptimizer(be->mvc); @@ -284,4 +284,3 @@ SQLaddQueryToCache(Client c) { insertSymbol(c->usermodule, c->curprg); } - diff --git a/sql/backends/monet5/sql_scenario.c b/sql/backends/monet5/sql_scenario.c --- a/sql/backends/monet5/sql_scenario.c +++ b/sql/backends/monet5/sql_scenario.c @@ -1344,7 +1344,7 @@ SQLparser(Client c) else msg = createException(PARSE, "SQLparser", SQLSTATE(M0M27) "Semantic errors %s", m->errstr); *m->errstr = 0; - } else if(msg) { + } else if (msg) { str newmsg; newmsg = createException(PARSE, "SQLparser", SQLSTATE(M0M27) "Semantic errors %s", msg); freeException(msg); diff --git a/sql/server/rel_optimizer.c b/sql/server/rel_optimizer.c --- a/sql/server/rel_optimizer.c +++ b/sql/server/rel_optimizer.c @@ -5265,7 +5265,7 @@ typedef struct { static void rel_find_joins(mvc *sql, sql_rel *parent, sql_rel *rel, list *l, int depth) { - if (!rel || depth == 20) /* limit to 20 relations bellow in the tree */ + if (!rel || depth == 5) /* limit to 5 relations bellow in the tree */ return; switch (rel->op) { _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list