Changeset: 7d44b524b0ae for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=7d44b524b0ae
Modified Files:
sql/backends/monet5/datacell/50_datacell.mal
sql/backends/monet5/datacell/Makefile.ag
sql/backends/monet5/datacell/emitter.mx
sql/backends/monet5/datacell/opt_datacell.mx
sql/backends/monet5/datacell/receptor.mx
Branch: default
Log Message:
Fixation of a datacell state
Nothing special to be expected for now. simply a sink.
diffs (220 lines):
diff --git a/sql/backends/monet5/datacell/50_datacell.mal
b/sql/backends/monet5/datacell/50_datacell.mal
--- a/sql/backends/monet5/datacell/50_datacell.mal
+++ b/sql/backends/monet5/datacell/50_datacell.mal
@@ -16,6 +16,7 @@
# All Rights Reserved.
# This loads the MonetDB/SQL module
-library datacell;
-include datacell;
+include basket;
+include receptor;
+include emitter;
diff --git a/sql/backends/monet5/datacell/Makefile.ag
b/sql/backends/monet5/datacell/Makefile.ag
--- a/sql/backends/monet5/datacell/Makefile.ag
+++ b/sql/backends/monet5/datacell/Makefile.ag
@@ -40,7 +40,7 @@
receptor.mx \
petrinet.mx \
dcoperator.mx \
- opt_dataflow.mx \
+ opt_datacell.mx \
emitter.mx
LIBS = ../../../../monetdb5/tools/libmonetdb5 \
@@ -72,7 +72,7 @@
receptor.mal \
emitter.mal \
petrinet.mal \
- opt_dataflow.mx \
+ opt_datacell.mx \
dcoperator.mal
}
diff --git a/sql/backends/monet5/datacell/emitter.mx
b/sql/backends/monet5/datacell/emitter.mx
--- a/sql/backends/monet5/datacell/emitter.mx
+++ b/sql/backends/monet5/datacell/emitter.mx
@@ -41,29 +41,29 @@
@mal
module emitter;
-command new(schema:str,tbl:str):void
+command new(sch:str,tbl:str):void
address DCemitterNew
comment "Define a new emitter.";
-command setType(schema:str,tbl:str, type:str):void
+command setType(sch:str,tbl:str, type:str):void
address DCemitterSetType
comment "Set the emitter as a server or a client.";
-command start(schema:str,tbl:str)
+command start(sch:str,tbl:str)
address DCemitterStart
comment "Start an emitter thread";
-command start(schema:str,tbl:str, host:str, port:int)
+command start(sch:str,tbl:str, host:str, port:int)
address DCemitterStartFull
comment "Start an emitter thread";
-command pause(schema:str,tbl:str)
+command pause(sch:str,tbl:str)
address DCemitterPause
comment "Pause sending";
-command stop(schema:str,tbl:str)
+command stop(sch:str,tbl:str)
address DCemitterStop
comment "Stop an emitter thread";
-command drop(schema:str,tbl:str)
+command drop(sch:str,tbl:str)
address DCemitterDrop
comment "Drop the emitter";
@-
diff --git a/sql/backends/monet5/datacell/opt_datacell.mx
b/sql/backends/monet5/datacell/opt_datacell.mx
new file mode 100644
--- /dev/null
+++ b/sql/backends/monet5/datacell/opt_datacell.mx
@@ -0,0 +1,129 @@
+@/
+The contents of this file are subject to the MonetDB Public License
+Version 1.1 (the "License"); you may not use this file except in
+compliance with the License. You may obtain a copy of the License at
+http://monetdb.cwi.nl/Legal/MonetDBLicense-1.1.html
+
+Software distributed under the License is distributed on an "AS IS"
+basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+License for the specific language governing rights and limitations
+under the License.
+
+The Original Code is the MonetDB Database System.
+
+The Initial Developer of the Original Code is CWI.
+Portions created by CWI are Copyright (C) 1997-July 2008 CWI.
+Copyright August 2008-2011 MonetDB B.V.
+All Rights Reserved.
+@
+
+@f opt_datacell
+@a M. Kersten
+@- Datacell optimizer
+Assume simple queries
+@{
+@mal
+pattern optimizer.datacell():str
+address OPTdatacell;
+pattern optimizer.datacell(mod:str, fcn:str):str
+address OPTdatacell
+comment "Datacell expression optimizer";
+
+@h
+#ifndef _OPT_DATACELL_
+#define _OPT_DATACELL_
+#include "opt_prelude.h"
+#include "opt_support.h"
+#include "opt_pipes.h"
+
+#define OPTDEBUGdatacell if ( optDebug & (1 <<DEBUG_OPT_DATACELL) )
+opt_export str OPTdatacell(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr
p);
+
+#endif
+@-
+We keep a flow dependency table to detect.
+@c
+#include "monetdb_config.h"
+#include "opt_datacell.h"
+#include "opt_deadcode.h"
+#include "mal_interpreter.h" /* for showErrors() */
+#include "mal_builder.h"
+#include "opt_statistics.h"
+
+static int
+OPTdatacellImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr
pci)
+{
+ int actions = 0;
+
+ OPTDEBUGdatacell {
+ mnstr_printf(cntxt->fdout, "#Datacell optimizer started\n");
+ printFunction(cntxt->fdout, mb, 0, LIST_MAL_STMT);
+ }
+ (void) stk;
+ (void) pci;
+
+ if ( actions)
+ addPipeDefinition("datacell_pipe",
+
"inline,remap,datacell,evaluate,costModel,coercions,emptySet,aliases,mitosis,"
+
"mergetable,deadcode,commonTerms,joinPath,reorder,deadcode,reduce,dataflow,"
+
"history,multiplex,accumulators,garbageCollector" );
+ return 0;
+}
+
+/* #define _DEBUG_OPTIMIZER_*/
+
+str OPTdatacell(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr p){
+ str modnme;
+ str fcnnme;
+ str msg= MAL_SUCCEED;
+ Symbol s= NULL;
+ lng t,clk= GDKusec();
+ int actions = 0;
+
+ optimizerInit();
+ if( p )
+ removeInstruction(mb, p);
+ OPTDEBUGdatacell mnstr_printf(cntxt->fdout,"=APPLY OPTIMIZER datacell\n");
+ if( p && p->argc > 1 ){
+ if( getArgType(mb,p,1) != TYPE_str ||
+ getArgType(mb,p,2) != TYPE_str ||
+ !isVarConstant(mb,getArg(p,1)) ||
+ !isVarConstant(mb,getArg(p,2))
+ ) {
+ throw(MAL, "optimizer.datacell", ILLARG_CONSTANTS);
+ }
+ if( stk != 0){
+ modnme= *(str*)getArgReference(stk,p,1);
+ fcnnme= *(str*)getArgReference(stk,p,2);
+ } else {
+ modnme= getArgDefault(mb,p,1);
+ fcnnme= getArgDefault(mb,p,2);
+ }
+ s= findSymbol(cntxt->nspace,
putName(modnme,strlen(modnme)),putName(fcnnme,strlen(fcnnme)));
+
+ if( s == NULL) {
+ char buf[1024];
+ snprintf(buf,1024, "%s.%s",modnme,fcnnme);
+ throw(MAL, "optimizer.datacell", RUNTIME_OBJECT_UNDEFINED ":%s",
buf);
+ }
+ mb = s->def;
+ stk= 0;
+ }
+ if( mb->errors ){
+ /* when we have errors, we still want to see them */
+ addtoMalBlkHistory(mb,"datacell");
+ return MAL_SUCCEED;
+ }
+ actions= OPTdatacellImplementation(cntxt, mb,stk,p);
+ msg= optimizerCheck(cntxt, mb, "optimizer.datacell", actions, t=(GDKusec()
- clk),OPT_CHECK_ALL);
+ OPTDEBUGdatacell {
+ mnstr_printf(cntxt->fdout,"=FINISHED datacell %d\n",actions);
+ printFunction(cntxt->fdout,mb,0,LIST_MAL_STMT | LIST_MAPI);
+ }
+ DEBUGoptimizers
+ mnstr_printf(cntxt->fdout,"#opt_reduce: %d ms\n",t);
+ QOTupdateStatistics("datacell",actions,t);
+ addtoMalBlkHistory(mb,"datacell");
+ return msg;
+}
+@}
diff --git a/sql/backends/monet5/datacell/receptor.mx
b/sql/backends/monet5/datacell/receptor.mx
--- a/sql/backends/monet5/datacell/receptor.mx
+++ b/sql/backends/monet5/datacell/receptor.mx
@@ -78,7 +78,7 @@
address DCgenerator
comment "Use a function/factory to generate the events";
-command drop(schema:str, tb;:str)
+command drop(schema:str, tb:str)
address DCreceptorDrop
comment "Drop a receptor";
@-
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list