Changeset: 070d4faca903 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=070d4faca903
Modified Files:
sql/backends/monet5/sql_execute.c
sql/backends/monet5/sql_gencode.c
Branch: jit
Log Message:
Handle the explain properly
diffs (59 lines):
diff --git a/sql/backends/monet5/sql_execute.c
b/sql/backends/monet5/sql_execute.c
--- a/sql/backends/monet5/sql_execute.c
+++ b/sql/backends/monet5/sql_execute.c
@@ -228,6 +228,10 @@ SQLrun(Client c, backend *be, mvc *m){
// This include template constants, BAT sizes.
optimizeQuery(c,mb);
+ if (m->emod & mod_explain) {
+ if (c->curprg->def)
+ printFunction(c->fdout, mb, 0, LIST_MAL_NAME |
LIST_MAL_VALUE | LIST_MAL_MAPI);
+ } else
if( m->emod & mod_debug)
msg = runMALDebugger(c, mb);
else{
@@ -588,15 +592,6 @@ SQLengineIntern(Client c, backend *be)
return MAL_SUCCEED;
}
- if (m->emod & mod_explain) {
- if (be->q && be->q->code)
- printFunction(c->fdout, ((Symbol) (be->q->code))->def,
0, LIST_MAL_NAME | LIST_MAL_VALUE | LIST_MAL_MAPI);
- else if (be->q)
- msg = createException(PARSE, "SQLparser", "%s",
(*m->errstr) ? m->errstr : "39000!program contains errors");
- else if (c->curprg->def)
- printFunction(c->fdout, c->curprg->def, 0,
LIST_MAL_NAME | LIST_MAL_VALUE | LIST_MAL_MAPI);
- goto cleanup_engine;
- }
#ifdef SQL_SCENARIO_DEBUG
mnstr_printf(GDKout, "#Ready to execute SQL statement\n");
#endif
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
@@ -482,6 +482,8 @@ static int
/* SQL function definitions meant for inlineing should not be optimized
before */
if (inline_func)
curBlk->inlineProp =1;
+ /* optimize the code */
+ optimizeQuery(c, c->curprg->def);
addQueryToCache(c);
if (backup)
c->curprg = backup;
@@ -699,7 +701,7 @@ static int
pushInstruction(curBlk, p);
pushEndInstruction(curBlk);
- /* SQL function definitions meant f r inlineing should not be optimized
before */
+ /* SQL function definitions meant for inlineing should not be optimized
before */
curBlk->inlineProp = 1;
addQueryToCache(c);
if (backup)
@@ -2899,7 +2901,6 @@ backend_dumpproc(backend *be, Client c,
return NULL;
// Always keep the SQL query around for monitoring
- // if (m->history || QLOGisset()) {
{
char *t, *tt;
InstrPtr q;
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list