Changeset: a1628c37924c for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=a1628c37924c
Modified Files:
        sql/backends/monet5/datacell/datacell.c
        sql/backends/monet5/datacell/opt_datacell.c
        sql/backends/monet5/datacell/opt_datacell.h
Branch: Feb2013
Log Message:

Massage the SQL query for datacell processing


diffs (111 lines):

diff --git a/sql/backends/monet5/datacell/datacell.c 
b/sql/backends/monet5/datacell/datacell.c
--- a/sql/backends/monet5/datacell/datacell.c
+++ b/sql/backends/monet5/datacell/datacell.c
@@ -70,11 +70,13 @@ DCprocedureStmt(Client cntxt, MalBlkPtr 
                f = o->data;
                if (strcmp(f->base.name, nme) == 0) {
                        be = (void *) backend_create(m, cntxt);
-                       backend_create_func(be, f);
-                       break;
+                       if  (be->mvc->sa ) {
+                               backend_create_func(be, f);
+                               return MAL_SUCCEED;
+                       }
                }
        }
-       return MAL_SUCCEED;
+       throw(SQL, "datacell.query", "Procedure missing");
 }
 
 str
@@ -299,11 +301,12 @@ DCquery(Client cntxt, MalBlkPtr mb, MalS
        lng clk = GDKusec();
        char buf[BUFSIZ], *lsch, *lnme;
 
+       if ( mb->errors)
+               throw(SQL, "datacell.query", "Query contains errors");
        BSKTelements(nme, buf, &lsch, &lnme);
        BSKTtolower(lsch);
        BSKTtolower(lnme);
 
-       (void) mb;
        /* check if the argument denotes a procedure name */
        /* if so, get its definition to be compiled */
 
diff --git a/sql/backends/monet5/datacell/opt_datacell.c 
b/sql/backends/monet5/datacell/opt_datacell.c
--- a/sql/backends/monet5/datacell/opt_datacell.c
+++ b/sql/backends/monet5/datacell/opt_datacell.c
@@ -40,7 +40,7 @@ int
 OPTdatacellImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr 
pci)
 {
        int actions = 0, fnd, mvc = 0;
-       int bskt, i, j, k, limit, /*vlimit,*/ slimit;
+       int bskt, i, j, k, limit, slimit;
        InstrPtr r, p, qq, *old;
        str col;
        int maxbasket = 128, m = 0, a = 0;
@@ -61,10 +61,10 @@ OPTdatacellImplementation(Client cntxt, 
        } else
                (void) stk;
 
+       removeDataflow(cntxt, mb);
        old = mb->stmt;
        limit = mb->stop;
        slimit = mb->ssize;
-       /*vlimit = mb->vtop;*/
        if (newMalBlkStmt(mb, slimit) < 0)
                return 0;
 
@@ -72,7 +72,6 @@ OPTdatacellImplementation(Client cntxt, 
        tidlist = (char *) GDKzalloc(mb->vtop );
        if (alias == 0)
                return 0;
-       removeDataflow(mb, old, limit);
 
        pushInstruction(mb, old[0]);
        newFcnCall(mb, sqlRef, putName("transaction", 11));
@@ -251,6 +250,8 @@ OPTdatacellImplementation(Client cntxt, 
                                                        getArg(qq, 0) = 
getArg(qa[j], k + 2);
                                                        getArg(qq, 1) = 
getArg(p, 5);
                                                        qq->argc = 2;
+                                                       p->argc =2;
+                                                       pushInstruction(mb,p);
                                                        p = qq;
                                                } else {
                                                        qq= newAssignment(mb);
@@ -279,14 +280,20 @@ OPTdatacellImplementation(Client cntxt, 
        (void) pci;
 
        OPTDEBUGdatacell {
-               mnstr_printf(cntxt->fdout, "#Datacell optimizer finished\n");
+               mnstr_printf(cntxt->fdout, "#Datacell optimizer 
intermediate\n");
                printFunction(cntxt->fdout, mb, stk, LIST_MAL_STMT);
        } 
        /* optimize this new continous query using the default pipe */
        addOptimizers(cntxt, mb, "default_pipe");
        msg = optimizeMALBlock(cntxt, mb);
-       if (msg == MAL_SUCCEED)
+       if (msg == MAL_SUCCEED) {
+               removeDataflow(cntxt, mb);
                msg = optimizerCheck(cntxt, mb, "optimizer.datacell", actions, 
(GDKusec() - clk), OPT_CHECK_ALL);
+       }
+       OPTDEBUGdatacell {
+               mnstr_printf(cntxt->fdout, "#Datacell optimizer finished\n");
+               printFunction(cntxt->fdout, mb, stk, LIST_MAL_STMT);
+       } 
 
        if (actions)
        {
diff --git a/sql/backends/monet5/datacell/opt_datacell.h 
b/sql/backends/monet5/datacell/opt_datacell.h
--- a/sql/backends/monet5/datacell/opt_datacell.h
+++ b/sql/backends/monet5/datacell/opt_datacell.h
@@ -23,7 +23,7 @@
 #include "opt_support.h"
 #include "opt_pipes.h"
 
-#define OPTDEBUGdatacell   if (1)
-//#define OPTDEBUGdatacell  if (optDebug & (1 << DEBUG_OPT_DATACELL))
+//#define OPTDEBUGdatacell   if (1)
+#define OPTDEBUGdatacell  if (optDebug & (1 << DEBUG_OPT_DATACELL))
 opt_export int OPTdatacellImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr 
stk, InstrPtr pci);
 #endif
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to