Changeset: 1695b2823109 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=1695b2823109
Added Files:
        monetdb5/optimizer/opt_timetrails.c
        monetdb5/optimizer/opt_timetrails.h
Modified Files:
        monetdb5/optimizer/Makefile.ag
        monetdb5/optimizer/opt_pipes.c
        monetdb5/optimizer/opt_prelude.c
        monetdb5/optimizer/opt_prelude.h
        monetdb5/optimizer/opt_support.c
        monetdb5/optimizer/opt_wrapper.c
        sql/backends/monet5/Makefile.ag
Branch: timetrails
Log Message:

Transformed the iot optimizer


diffs (truncated from 325 to 300 lines):

diff --git a/monetdb5/optimizer/Makefile.ag b/monetdb5/optimizer/Makefile.ag
--- a/monetdb5/optimizer/Makefile.ag
+++ b/monetdb5/optimizer/Makefile.ag
@@ -33,7 +33,7 @@ lib_optimizer = {
                opt_querylog.c opt_querylog.h \
                opt_inline.c opt_inline.h \
                opt_jit.c opt_jit.h \
-               opt_iot.c opt_iot.h \
+               opt_timetrails.c opt_timetrails.h \
                opt_projectionpath.c opt_projectionpath.h \
                opt_macro.c opt_macro.h \
                opt_matpack.c opt_matpack.h \
diff --git a/monetdb5/optimizer/opt_pipes.c b/monetdb5/optimizer/opt_pipes.c
--- a/monetdb5/optimizer/opt_pipes.c
+++ b/monetdb5/optimizer/opt_pipes.c
@@ -202,10 +202,10 @@ static struct PIPELINES {
 //      "optimizer.oltp();"awaiting the autocommit front-end changes
         "optimizer.garbageCollector();",
         "stable", NULL, NULL, 1},
-       {"iot_pipe",
+       {"timetrails",
         "optimizer.inline();"
         "optimizer.remap();"
-        "optimizer.iot();"
+        "optimizer.timetrails();"
         "optimizer.costModel();"
         "optimizer.coercions();"
         "optimizer.evaluate();"
diff --git a/monetdb5/optimizer/opt_prelude.c b/monetdb5/optimizer/opt_prelude.c
--- a/monetdb5/optimizer/opt_prelude.c
+++ b/monetdb5/optimizer/opt_prelude.c
@@ -165,7 +165,6 @@ str ilikeselectRef;
 str ilikethetaselectRef;
 str likeRef;
 str ilikeRef;
-str iotRef;
 str not_likeRef;
 str not_ilikeRef;
 str listRef;
@@ -278,6 +277,7 @@ str subavgRef;
 str selectRef;
 str sortRef;
 str takeRef;
+str timetrailsRef;
 str transactionRef;
 str transaction_beginRef;
 str transaction_releaseRef;
@@ -432,7 +432,6 @@ void optimizerInit(void)
        inplaceRef = putName("inplace");
        intRef = putName("int");
        ioRef = putName("io");
-       iotRef = putName("iot");
        iteratorRef = putName("iterator");
        projectionpathRef = putName("projectionpath");
        joinRef = putName("join");
@@ -455,7 +454,6 @@ void optimizerInit(void)
        ilikethetaselectRef = putName("ilikethetaselect");
        not_likeRef = putName("not_like");
        not_ilikeRef = putName("not_ilike");
-       iotRef = putName("iot");
        lockRef = putName("lock");
        lookupRef = putName("lookup");
        malRef = putName("mal");
@@ -563,6 +561,7 @@ void optimizerInit(void)
        subavgRef = putName("subavg");
        sortRef = putName("sort");
        takeRef= putName("take");
+       timetrailsRef = putName("timetrails");
        transactionRef= putName("transaction");
        transaction_beginRef= putName("transaction_begin");
        transaction_releaseRef= putName("transaction_release");
diff --git a/monetdb5/optimizer/opt_prelude.h b/monetdb5/optimizer/opt_prelude.h
--- a/monetdb5/optimizer/opt_prelude.h
+++ b/monetdb5/optimizer/opt_prelude.h
@@ -163,7 +163,6 @@ mal_export  str likeuselectRef;
 mal_export  str ilikeuselectRef;
 mal_export  str listRef;
 mal_export  str lockRef;
-mal_export  str iotRef;
 mal_export  str lookupRef;
 mal_export  str malRef;
 mal_export  str batmalRef;
@@ -269,6 +268,7 @@ mal_export  str sumRef;
 mal_export  str subsumRef;
 mal_export  str subavgRef;
 mal_export  str sortRef;
+mal_export  str timetrailsRef;
 mal_export  str timestampRef;
 mal_export     str tumbleRef;
 mal_export  str takeRef;
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
@@ -421,7 +421,7 @@ hasSideEffects(MalBlkPtr mb, InstrPtr p,
                if (getFunctionId(p) == singleRef) return FALSE;
                return TRUE;
        }
-       if (getModuleId(p) == basketRef || getModuleId(p) == iotRef){
+       if (getModuleId(p) == basketRef || getModuleId(p) == timetrailsRef){
                return TRUE;
        }
        if( getModuleId(p) == mapiRef){
diff --git a/monetdb5/optimizer/opt_iot.c b/monetdb5/optimizer/opt_timetrails.c
copy from monetdb5/optimizer/opt_iot.c
copy to monetdb5/optimizer/opt_timetrails.c
--- a/monetdb5/optimizer/opt_iot.c
+++ b/monetdb5/optimizer/opt_timetrails.c
@@ -19,13 +19,13 @@
 
 /*
  * (author) M. Kersten
- * Assume simple queries . Clear out all non-iot schema related sql 
statements, except for the bare minimum.
+ * Assume simple queries . Clear out all non-timetrails schema related sql 
statements, except for the bare minimum.
  */
 /*
  * We keep a flow dependency table to detect.
  */
 #include "monetdb_config.h"
-#include "opt_iot.h"
+#include "opt_timetrails.h"
 #include "opt_deadcode.h"
 #include "mal_interpreter.h"    /* for showErrors() */
 #include "mal_builder.h"
@@ -39,7 +39,7 @@
        }
 
 str
-OPTiotImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
+OPTtimetrailsImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, 
InstrPtr pci)
 {
        int i, j, k, fnd, limit, slimit;
        InstrPtr r, p, *old;
@@ -60,14 +60,14 @@ OPTiotImplementation(Client cntxt, MalBl
        for(i =0; i< mb->stop; i++){
                p= getInstrPtr(mb,i);
                if( getModuleId(p) == basketRef||
-                       getModuleId(p) == iotRef)
+                       getModuleId(p) == timetrailsRef)
                        break;
        }
        if( i == mb->stop)
                return MAL_SUCCEED;
 
 #ifdef DEBUG_OPT_IOT
-       mnstr_printf(cntxt->fdout, "#iot optimizer start\n");
+       mnstr_printf(cntxt->fdout, "#timetrails optimizer start\n");
        printFunction(cntxt->fdout, mb, stk, LIST_MAL_DEBUG);
 #endif
        old = mb->stmt;
@@ -79,7 +79,7 @@ OPTiotImplementation(Client cntxt, MalBl
                p = old[i];
                if( getModuleId(p)== basketRef && (getFunctionId(p)== 
registerRef || getFunctionId(p)== bindRef )  ){
 #ifdef DEBUG_OPT_IOT
-                       mnstr_printf(cntxt->fdout, "#iot stream table %s.%s\n", 
getModuleId(p), getFunctionId(p));
+                       mnstr_printf(cntxt->fdout, "#timetrails stream table 
%s.%s\n", getModuleId(p), getFunctionId(p));
 #endif
                        schemas[btop]= getVarConstant(mb, getArg(p,2)).val.sval;
                        tables[btop]= getVarConstant(mb, getArg(p,3)).val.sval;
@@ -92,7 +92,7 @@ OPTiotImplementation(Client cntxt, MalBl
                }
                if( getModuleId(p)== basketRef && getFunctionId(p) == appendRef 
){
 #ifdef DEBUG_OPT_IOT
-                       mnstr_printf(cntxt->fdout, "#iot stream table %s.%s\n", 
getModuleId(p), getFunctionId(p));
+                       mnstr_printf(cntxt->fdout, "#timetrails stream table 
%s.%s\n", getModuleId(p), getFunctionId(p));
 #endif
                        schemas[btop]= getVarConstant(mb, getArg(p,2)).val.sval;
                        tables[btop]= getVarConstant(mb, getArg(p,3)).val.sval;
@@ -106,7 +106,7 @@ OPTiotImplementation(Client cntxt, MalBl
                }
                if( getModuleId(p)== basketRef && getFunctionId(p) == updateRef 
){
 #ifdef DEBUG_OPT_IOT
-                       mnstr_printf(cntxt->fdout, "#iot stream table %s.%s\n", 
getModuleId(p), getFunctionId(p));
+                       mnstr_printf(cntxt->fdout, "#timetrails stream table 
%s.%s\n", getModuleId(p), getFunctionId(p));
 #endif
                        schemas[btop]= getVarConstant(mb, getArg(p,2)).val.sval;
                        tables[btop]= getVarConstant(mb, getArg(p,3)).val.sval;
@@ -118,9 +118,9 @@ OPTiotImplementation(Client cntxt, MalBl
                        if( j == btop)
                                btop++;
                }
-               if( getModuleId(p)== iotRef && getFunctionId(p) == basketRef){
+               if( getModuleId(p)== timetrailsRef && getFunctionId(p) == 
basketRef){
 #ifdef DEBUG_OPT_IOT
-                       mnstr_printf(cntxt->fdout, "#iot stream table %s.%s\n", 
getModuleId(p), getFunctionId(p));
+                       mnstr_printf(cntxt->fdout, "#timetrails stream table 
%s.%s\n", getModuleId(p), getFunctionId(p));
 #endif
                        schemas[btop]= getVarConstant(mb, getArg(p,1)).val.sval;
                        tables[btop]= getVarConstant(mb, getArg(p,2)).val.sval;
@@ -134,7 +134,7 @@ OPTiotImplementation(Client cntxt, MalBl
                        lastmvc = getArg(p,0);
                if (!cq && getModuleId(p) == sqlRef && getFunctionId(p) == 
affectedRowsRef )
                        lastmvc = getArg(p,0);
-               if( getModuleId(p)== iotRef && getFunctionId(p) == tumbleRef){
+               if( getModuleId(p)== timetrailsRef && getFunctionId(p) == 
tumbleRef){
                        lastmvc = getArg(p,1);
                }
        }
@@ -142,7 +142,7 @@ OPTiotImplementation(Client cntxt, MalBl
                return MAL_SUCCEED;
 
 #ifdef DEBUG_OPT_IOT
-       mnstr_printf(cntxt->fdout, "#iot optimizer started with %d streams, mvc 
%d\n", btop,lastmvc);
+       mnstr_printf(cntxt->fdout, "#timetrails optimizer started with %d 
streams, mvc %d\n", btop,lastmvc);
        printFunction(cntxt->fdout, mb, stk, LIST_MAL_DEBUG);
 #endif
        (void) stk;
@@ -200,7 +200,7 @@ OPTiotImplementation(Client cntxt, MalBl
                        if (getModuleId(p) == sqlRef && getFunctionId(p) == 
tidRef ){
                                
getStreamTableInfo(getVarConstant(mb,getArg(p,2)).val.sval, 
getVarConstant(mb,getArg(p,3)).val.sval );
 #ifdef DEBUG_OPT_IOT
-                               mnstr_printf(cntxt->fdout, "#iot optimizer 
found stream %d\n",fnd);
+                               mnstr_printf(cntxt->fdout, "#timetrails 
optimizer found stream %d\n",fnd);
 #endif
                                if( fnd){
                                        getModuleId(p) = basketRef;
@@ -225,7 +225,7 @@ OPTiotImplementation(Client cntxt, MalBl
                                continue;
                        }
 
-                       if( getModuleId(p)== iotRef && 
getFunctionId(p)==errorRef)
+                       if( getModuleId(p)== timetrailsRef && 
getFunctionId(p)==errorRef)
                                noerror++;
                        if (p->token == ENDsymbol && btop > 0 && noerror==0) {
                                // empty all baskets used only when we are 
optimizing a cq
@@ -244,7 +244,7 @@ OPTiotImplementation(Client cntxt, MalBl
                                setVarUDFtype(mb, j);
                                r->barrier = CATCHsymbol;
 
-                               r = newStmt(mb,iotRef, errorRef);
+                               r = newStmt(mb,timetrailsRef, errorRef);
                                r = pushStr(mb, r, getModuleId(old[0]));
                                r = pushStr(mb, r, getFunctionId(old[0]));
                                r = pushArgument(mb, r, j);
@@ -257,7 +257,7 @@ OPTiotImplementation(Client cntxt, MalBl
                                setVarUDFtype(mb, j);
                                r->barrier = CATCHsymbol;
 
-                               r = newStmt(mb,iotRef, errorRef);
+                               r = newStmt(mb,timetrailsRef, errorRef);
                                r = pushStr(mb, r, getModuleId(old[0]));
                                r = pushStr(mb, r, getFunctionId(old[0]));
                                r = pushArgument(mb, r, j);
@@ -307,11 +307,11 @@ OPTiotImplementation(Client cntxt, MalBl
        chkFlow(cntxt->fdout, mb);
        chkDeclarations(cntxt->fdout, mb);
     /* keep all actions taken as a post block comment */
-    snprintf(buf,256,"%-20s actions=%2d time=" LLFMT " usec","iot", btop, 
GDKusec() - usec);
+    snprintf(buf,256,"%-20s actions=%2d time=" LLFMT " usec","timetrails", 
btop, GDKusec() - usec);
     newComment(mb,buf);
 
 #ifdef DEBUG_OPT_IOT
-       mnstr_printf(cntxt->fdout, "#iot optimizer final\n");
+       mnstr_printf(cntxt->fdout, "#timetrails optimizer final\n");
        printFunction(cntxt->fdout, mb, stk, LIST_MAL_DEBUG);
 #endif
        GDKfree(alias);
@@ -319,5 +319,5 @@ OPTiotImplementation(Client cntxt, MalBl
 
     if( btop > 0)
         return MAL_SUCCEED;
-       throw (MAL,"optimizer.iot", "The iot optimizer failed to start! (btop = 
%d)", btop);
+       throw (MAL,"optimizer.timetrails", "The timetrails optimizer failed to 
start! (btop = %d)", btop);
 }
diff --git a/monetdb5/optimizer/opt_iot.h b/monetdb5/optimizer/opt_timetrails.h
copy from monetdb5/optimizer/opt_iot.h
copy to monetdb5/optimizer/opt_timetrails.h
--- a/monetdb5/optimizer/opt_iot.h
+++ b/monetdb5/optimizer/opt_timetrails.h
@@ -23,6 +23,6 @@
 #include "opt_support.h"
 #include "opt_pipes.h"
 
-mal_export str OPTiotImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, 
InstrPtr pci);
+mal_export str OPTtimetrailsImplementation(Client cntxt, MalBlkPtr mb, 
MalStkPtr stk, InstrPtr pci);
 
 #endif
diff --git a/monetdb5/optimizer/opt_wrapper.c b/monetdb5/optimizer/opt_wrapper.c
--- a/monetdb5/optimizer/opt_wrapper.c
+++ b/monetdb5/optimizer/opt_wrapper.c
@@ -33,7 +33,6 @@
 #include "opt_garbageCollector.h"
 #include "opt_generator.h"
 #include "opt_inline.h"
-#include "opt_iot.h"
 #include "opt_jit.h"
 #include "opt_projectionpath.h"
 #include "opt_matpack.h"
@@ -49,6 +48,7 @@
 #include "opt_remap.h"
 #include "opt_remoteQueries.h"
 #include "opt_reorder.h"
+#include "opt_timetrails.h"
 #include "opt_volcano.h"
 
 struct{
@@ -70,7 +70,7 @@ struct{
        {"garbageCollector", &OPTgarbageCollectorImplementation,0,0},
        {"generator", &OPTgeneratorImplementation,0,0},
        {"inline", &OPTinlineImplementation,0,0},
-    {"iot", &OPTiotImplementation,0,0},
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to