Changeset: 241d0163a282 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=241d0163a282
Added Files:
sql/backends/monet5/datacell/Tests/emilistart.sql
Removed Files:
sql/backends/monet5/datacell/Tests/emili.sql
Modified Files:
sql/backends/monet5/datacell/Tests/All
sql/backends/monet5/datacell/Tests/dcload.sql
sql/backends/monet5/datacell/Tests/dcload.stable.err
sql/backends/monet5/datacell/opt_datacell.c
sql/backends/monet5/datacell/opt_datacell.h
sql/backends/monet5/datacell/petrinet.c
Branch: default
Log Message:
Fixing some datacell optimizer stuff
and petrinet controller.
Updates the test sets.
diffs (truncated from 303 to 300 lines):
diff --git a/sql/backends/monet5/datacell/Tests/All
b/sql/backends/monet5/datacell/Tests/All
--- a/sql/backends/monet5/datacell/Tests/All
+++ b/sql/backends/monet5/datacell/Tests/All
@@ -13,7 +13,7 @@ ENABLE_DATACELL?scenario04
ENABLE_DATACELL?scenario05
ENABLE_DATACELL?scenario06
ENABLE_DATACELL?dctemper00
-ENABLE_DATACELL?dcload
+#ENABLE_DATACELL?dcload
#ENABLE_DATACELL?linearroad
# MAL
ENABLE_DATACELL?datacell00
@@ -22,5 +22,6 @@ ENABLE_DATACELL?receptor00
ENABLE_DATACELL?emitter00
ENABLE_DATACELL?datacell99
-ENABLE_DATACELL?emili
+ENABLE_DATACELL?emilistart
+ENABLE_DATACELL?emilifinish
diff --git a/sql/backends/monet5/datacell/Tests/dcload.sql
b/sql/backends/monet5/datacell/Tests/dcload.sql
--- a/sql/backends/monet5/datacell/Tests/dcload.sql
+++ b/sql/backends/monet5/datacell/Tests/dcload.sql
@@ -23,13 +23,13 @@ CREATE TABLE "datacell"."alarm_hot" (
"temperature" DOUBLE
);
---CALL datacell.receptor('datacell.sensors', 'localhost', 50500);
+CALL datacell.receptor('datacell.sensors', 'localhost', 50500);
---CALL datacell.emitter('datacell.alarm_warm', 'localhost', 50601);
---CALL datacell.emitter('datacell.alarm_hot', 'localhost', 50602);
+CALL datacell.emitter('datacell.alarm_warm', 'localhost', 50601);
+CALL datacell.emitter('datacell.alarm_hot', 'localhost', 50602);
---CALL datacell.basket('datacell.warm');
---CALL datacell.basket('datacell.hot');
+CALL datacell.basket('datacell.warm');
+CALL datacell.basket('datacell.hot');
CREATE PROCEDURE datacell.warm()
BEGIN
diff --git a/sql/backends/monet5/datacell/Tests/dcload.stable.err
b/sql/backends/monet5/datacell/Tests/dcload.stable.err
--- a/sql/backends/monet5/datacell/Tests/dcload.stable.err
+++ b/sql/backends/monet5/datacell/Tests/dcload.stable.err
@@ -1,15 +1,13 @@
stderr of test 'dcload` in directory 'sql/backends/monet5/datacell` itself:
-# 12:45:12 >
-# 12:45:12 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set"
"gdk_dbfarm=/export/scratch1/mk/current//Linux/var/MonetDB" "--set"
"mapi_open=true" "--set" "mapi_port=38236" "--set" "monet_prompt=" "--trace"
"--forcemito" "--set" "mal_listing=2"
"--dbname=mTests_backends_monet5_datacell" "--set" "mal_listing=0"
-# 12:45:12 >
+# 13:34:10 >
+# 13:34:10 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set"
"mapi_open=true" "--set" "mapi_port=38485" "--set"
"mapi_usock=/var/tmp/mtest-1999/.s.monetdb.38485" "--set" "monet_prompt="
"--forcemito" "--set" "mal_listing=2"
"--dbpath=/export/scratch1/mk/current//Linux/var/MonetDB/mTests_sql_backends_monet5_datacell"
"--set" "mal_listing=0"
+# 13:34:10 >
-# builtin opt gdk_dbname = demo
-# builtin opt gdk_dbfarm =
/export/scratch1/mk/current//Linux/var/monetdb5/dbfarm
+# builtin opt gdk_dbpath =
/export/scratch1/mk/current//Linux/var/monetdb5/dbfarm/demo
# builtin opt gdk_debug = 0
-# builtin opt gdk_alloc_map = no
-# builtin opt gdk_vmtrim = yes
+# builtin opt gdk_vmtrim = no
# builtin opt monet_prompt = >
# builtin opt monet_daemon = no
# builtin opt mapi_port = 50000
@@ -18,64 +16,21 @@ stderr of test 'dcload` in directory 'sq
# builtin opt sql_optimizer = default_pipe
# builtin opt sql_debug = 0
# cmdline opt gdk_nr_threads = 0
-# cmdline opt gdk_dbfarm = /export/scratch1/mk/current//Linux/var/MonetDB
# cmdline opt mapi_open = true
-# cmdline opt mapi_port = 38236
+# cmdline opt mapi_port = 38485
+# cmdline opt mapi_usock = /var/tmp/mtest-1999/.s.monetdb.38485
# cmdline opt monet_prompt =
# cmdline opt mal_listing = 2
-# cmdline opt gdk_dbname = mTests_backends_monet5_datacell
+# cmdline opt gdk_dbpath =
/export/scratch1/mk/current//Linux/var/MonetDB/mTests_sql_backends_monet5_datacell
# cmdline opt mal_listing = 0
+# cmdline opt gdk_debug = 536870922
-# 12:45:12 >
-# 12:45:12 > "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e" "--host=vienna"
"--port=38236"
-# 12:45:12 >
+# 13:34:10 >
+# 13:34:10 > "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e"
"--host=/var/tmp/mtest-1999" "--port=38485"
+# 13:34:10 >
-MAPI = (monetdb) /var/tmp/mtest-32181/.s.monetdb.37111
-QUERY = CALL datacell.query('datacell.warm');
- !TypeException:datacell.warm[18]:'algebra.leftfetchjoin' undefined in:
_33:bat[:oid,:inet] := algebra.leftfetchjoin(_23:bat[:oid,:oid], _136:BAT)
- !TypeException:datacell.warm[23]:'algebra.leftfetchjoin' undefined in:
_45:bat[:oid,:timestamp] := algebra.leftfetchjoin(_23:bat[:oid,:oid], _136:BAT)
- !TypeException:datacell.warm[27]:'algebra.leftfetchjoin' undefined in:
_53:bat[:oid,:str] := algebra.leftfetchjoin(_23:bat[:oid,:oid], _136:BAT)
- !TypeException:datacell.warm[28]:'algebra.leftfetchjoin' undefined in:
_57:bat[:oid,:dbl] := algebra.leftfetchjoin(_23:bat[:oid,:oid], _136:BAT)
- !TypeException:datacell.warm[14]:'algebra.subselect' undefined in:
_23:bat[:oid,:oid] := algebra.subselect(_136:BAT, _22:str, _22:str, _24:bit,
_24:bit, _15:bit)
- !TypeException:datacell.warm[18]:'algebra.leftfetchjoin' undefined in:
_33:bat[:oid,:inet] := algebra.leftfetchjoin(_23:bat[:oid,:oid], _136:BAT)
- !TypeException:datacell.warm[23]:'algebra.leftfetchjoin' undefined in:
_45:bat[:oid,:timestamp] := algebra.leftfetchjoin(_23:bat[:oid,:oid], _136:BAT)
- !TypeException:datacell.warm[27]:'algebra.leftfetchjoin' undefined in:
_53:bat[:oid,:str] := algebra.leftfetchjoin(_23:bat[:oid,:oid], _136:BAT)
- !TypeException:datacell.warm[28]:'algebra.leftfetchjoin' undefined in:
_57:bat[:oid,:dbl] := algebra.leftfetchjoin(_23:bat[:oid,:oid], _136:BAT)
- !TypeException:datacell.warm[14]:'algebra.subselect' undefined in:
_23:bat[:oid,:oid] := algebra.subselect(_136:BAT, _22:str, _22:str, _24:bit,
_24:bit, _15:bit)
- !TypeException:datacell.warm[18]:'algebra.leftfetchjoin' undefined in:
_33:bat[:oid,:inet] := algebra.leftfetchjoin(_23:bat[:oid,:oid], _136:BAT)
- !TypeException:datacell.warm[23]:'algebra.leftfetchjoin' undefined in:
_45:bat[:oid,:timestamp] := algebra.leftfetchjoin(_23:bat[:oid,:oid], _136:BAT)
- !TypeException:datacell.warm[27]:'algebra.leftfetchjoin' undefined in:
_53:bat[:oid,:str] := algebra.leftfetchjoin(_23:bat[:oid,:oid], _136:BAT)
- !TypeException:datacell.warm[28]:'algebra.leftfetchjoin' undefined in:
_57:bat[:oid,:dbl] := algebra.leftfetchjoin(_23:bat[:oid,:oid], _136:BAT)
- !TypeException:datacell.warm[14]:'algebra.subselect' undefined in:
_23:bat[:oid,:oid] := algebra.subselect(_136:BAT, _22:str, _22:str, _24:bit,
_24:bit, _15:bit)
- !TypeException:datacell.warm[18]:'algebra.leftfetchjoin' undefined in:
_33:bat[:oid,:inet] := algebra.leftfetchjoin(_23:bat[:oid,:oid], _136:BAT)
- !TypeException:datacell.warm[23]:'algebra.leftfetchjoin' undefined in:
_45:bat[:oid,:timestamp] := algebra.leftfetchjoin(_23:bat[:oid,:oid], _136:BAT)
- !TypeException:datacell.warm[27]:'algebra.leftfetchjoin' undefined in:
_53:bat[:oid,:str] := algebra.leftfetchjoin(_23:bat[:oid,:oid], _136:BAT)
- !TypeException:datacell.warm[28]:'algebra.leftfetchjoin' undefined in:
_57:bat[:oid,:dbl] := algebra.leftfetchjoin(_23:bat[:oid,:oid], _136:BAT)
-MAPI = (monetdb) /var/tmp/mtest-32181/.s.monetdb.37111
-QUERY = CALL datacell.query('datacell.hot');
+# 13:34:10 >
+# 13:34:10 > "Done."
+# 13:34:10 >
- !TypeException:datacell.hot[18]:'algebra.leftfetchjoin' undefined in:
_33:bat[:oid,:inet] := algebra.leftfetchjoin(_23:bat[:oid,:oid], _135:BAT)
- !TypeException:datacell.hot[23]:'algebra.leftfetchjoin' undefined in:
_45:bat[:oid,:timestamp] := algebra.leftfetchjoin(_23:bat[:oid,:oid], _135:BAT)
- !TypeException:datacell.hot[27]:'algebra.leftfetchjoin' undefined in:
_53:bat[:oid,:str] := algebra.leftfetchjoin(_23:bat[:oid,:oid], _135:BAT)
- !TypeException:datacell.hot[28]:'algebra.leftfetchjoin' undefined in:
_57:bat[:oid,:dbl] := algebra.leftfetchjoin(_23:bat[:oid,:oid], _135:BAT)
- !TypeException:datacell.hot[14]:'algebra.subselect' undefined in:
_23:bat[:oid,:oid] := algebra.subselect(_135:BAT, _22:str, _22:str, _1:bit,
_1:bit, _24:bit)
- !TypeException:datacell.hot[18]:'algebra.leftfetchjoin' undefined in:
_33:bat[:oid,:inet] := algebra.leftfetchjoin(_23:bat[:oid,:oid], _135:BAT)
- !TypeException:datacell.hot[23]:'algebra.leftfetchjoin' undefined in:
_45:bat[:oid,:timestamp] := algebra.leftfetchjoin(_23:bat[:oid,:oid], _135:BAT)
- !TypeException:datacell.hot[27]:'algebra.leftfetchjoin' undefined in:
_53:bat[:oid,:str] := algebra.leftfetchjoin(_23:bat[:oid,:oid], _135:BAT)
- !TypeException:datacell.hot[28]:'algebra.leftfetchjoin' undefined in:
_57:bat[:oid,:dbl] := algebra.leftfetchjoin(_23:bat[:oid,:oid], _135:BAT)
- !TypeException:datacell.hot[14]:'algebra.subselect' undefined in:
_23:bat[:oid,:oid] := algebra.subselect(_135:BAT, _22:str, _22:str, _1:bit,
_1:bit, _24:bit)
- !TypeException:datacell.hot[18]:'algebra.leftfetchjoin' undefined in:
_33:bat[:oid,:inet] := algebra.leftfetchjoin(_23:bat[:oid,:oid], _135:BAT)
- !TypeException:datacell.hot[23]:'algebra.leftfetchjoin' undefined in:
_45:bat[:oid,:timestamp] := algebra.leftfetchjoin(_23:bat[:oid,:oid], _135:BAT)
- !TypeException:datacell.hot[27]:'algebra.leftfetchjoin' undefined in:
_53:bat[:oid,:str] := algebra.leftfetchjoin(_23:bat[:oid,:oid], _135:BAT)
- !TypeException:datacell.hot[28]:'algebra.leftfetchjoin' undefined in:
_57:bat[:oid,:dbl] := algebra.leftfetchjoin(_23:bat[:oid,:oid], _135:BAT)
- !TypeException:datacell.hot[14]:'algebra.subselect' undefined in:
_23:bat[:oid,:oid] := algebra.subselect(_135:BAT, _22:str, _22:str, _1:bit,
_1:bit, _24:bit)
- !TypeException:datacell.hot[18]:'algebra.leftfetchjoin' undefined in:
_33:bat[:oid,:inet] := algebra.leftfetchjoin(_23:bat[:oid,:oid], _135:BAT)
- !TypeException:datacell.hot[23]:'algebra.leftfetchjoin' undefined in:
_45:bat[:oid,:timestamp] := algebra.leftfetchjoin(_23:bat[:oid,:oid], _135:BAT)
- !TypeException:datacell.hot[27]:'algebra.leftfetchjoin' undefined in:
_53:bat[:oid,:str] := algebra.leftfetchjoin(_23:bat[:oid,:oid], _135:BAT)
- !TypeException:datacell.hot[28]:'algebra.leftfetchjoin' undefined in:
_57:bat[:oid,:dbl] := algebra.leftfetchjoin(_23:bat[:oid,:oid], _135:BAT)
-
-# 12:45:12 >
-# 12:45:12 > "Done."
-# 12:45:12 >
-
diff --git a/sql/backends/monet5/datacell/Tests/emili.sql
b/sql/backends/monet5/datacell/Tests/emilistart.sql
rename from sql/backends/monet5/datacell/Tests/emili.sql
rename to sql/backends/monet5/datacell/Tests/emilistart.sql
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
@@ -18,8 +18,7 @@
*/
/*
- * @a M. Kersten
- * @- Datacell optimizer
+ * (author) M. Kersten
* Assume simple queries . Clear out all non-datacell schema related sql
statements, except
* for the bare minimum.
*/
@@ -43,7 +42,7 @@ OPTdatacellImplementation(Client cntxt,
int bskt, i, j, k, limit, slimit;
InstrPtr r, p, qq, *old;
str col;
- int maxbasket = 128, m = 0, a = 0;
+ int maxbasket = 128, m = 0, a = 0, movetofront=0;
char *tables[128] = { NULL };
char *appends[128] = { NULL };
InstrPtr q[128], qa[128] = { NULL };
@@ -55,13 +54,13 @@ OPTdatacellImplementation(Client cntxt,
(void) pci;
+ removeDataflow(mb);
OPTDEBUGdatacell {
mnstr_printf(cntxt->fdout, "#Datacell optimizer started\n");
- printFunction(cntxt->fdout, mb, stk, LIST_MAL_STMT);
+ printFunction(cntxt->fdout, mb, stk, LIST_MAL_DEBUG);
} else
(void) stk;
- removeDataflow(mb);
old = mb->stmt;
limit = mb->stop;
slimit = mb->ssize;
@@ -80,17 +79,15 @@ OPTdatacellImplementation(Client cntxt,
p = old[i];
if (getModuleId(p) == datacellRef && getFunctionId(p)
== putName("window", 6) &&
- isVarConstant(mb, getArg(p, 1)) &&
isVarConstant(mb, getArg(p, 2)) && isVarConstant(mb, getArg(p, 3))) {
+ isVarConstant(mb, getArg(p, 1)) &&
isVarConstant(mb, getArg(p, 2)) && isVarConstant(mb, getArg(p, 3)))
/* let's move the window to the start of the
block when it consists of constants*/
- pushInstruction(mb, p);
- for (j = mb->stop - 1; j > 1; j--)
- mb->stmt[j] = mb->stmt[j - 1];
- mb->stmt[j] = p;
- continue;
- }
+ movetofront=1;
if (getModuleId(p) == datacellRef && (getFunctionId(p)
== putName("threshold", 9) || getFunctionId(p) == putName("beat", 4)) &&
- isVarConstant(mb, getArg(p, 1)) &&
isVarConstant(mb, getArg(p, 2))) {
+ isVarConstant(mb, getArg(p, 1)) &&
isVarConstant(mb, getArg(p, 2)))
/* let's move the threshold/beat to the start
of the block when it consists of constants*/
+ movetofront=1;
+ if( movetofront){
+ movetofront =0;
pushInstruction(mb, p);
for (j = mb->stop - 1; j > 1; j--)
mb->stmt[j] = mb->stmt[j - 1];
@@ -131,14 +128,6 @@ OPTdatacellImplementation(Client cntxt,
continue;
}
- /* remove delta processing for baskets */
- if (getModuleId(p) == sqlRef && (getFunctionId(p) ==
deltaRef || getFunctionId(p) == projectdeltaRef || getFunctionId(p) ==
subdeltaRef) ) {
- clrFunction(p);
- getArg(p,1) = alias[getArg(p,1)];
- p->argc =2;
- pushInstruction(mb, p);
- continue;
- }
/* localize access to basket tables */
if (getModuleId(p) == sqlRef && (getFunctionId(p) ==
bindRef || getFunctionId(p) == binddbatRef)) {
snprintf(buf, BUFSIZ, "%s.%s",
getVarConstant(mb, getArg(p, 2)).val.sval, getVarConstant(mb, getArg(p,
3)).val.sval);
@@ -195,6 +184,11 @@ OPTdatacellImplementation(Client cntxt,
snprintf(buf, BUFSIZ, "%s.%s",
getVarConstant(mb, getArg(p, 2)).val.sval, getVarConstant(mb, getArg(p,
3)).val.sval);
bskt = BSKTlocate(buf);
tidlist[getArg(p,0)] = bskt > 0;
+ if ( bskt == 0){
+ clrFunction(p);
+ p->argc=1;
+ p = pushNil(mb,p, getArgType(mb,p,0));
+ }
}
/* remove consolidation of tid lists */
if (getModuleId(p) == algebraRef && getFunctionId(p) ==
leftfetchjoinRef && tidlist[getArg(p,1)]){
@@ -202,6 +196,23 @@ OPTdatacellImplementation(Client cntxt,
freeInstruction(p);
continue;
}
+ /* remove delta processing for baskets */
+ if (getModuleId(p) == sqlRef && (getFunctionId(p) ==
deltaRef || getFunctionId(p) == subdeltaRef) ) {
+ clrFunction(p);
+ p->argc =2;
+ pushInstruction(mb, p);
+ continue;
+ }
+
+ /* remove delta processing for baskets */
+ if (getModuleId(p) == sqlRef && (getFunctionId(p) ==
projectdeltaRef || getFunctionId(p) == subdeltaRef) ) {
+ clrFunction(p);
+ setModuleId(p,algebraRef);
+ setFunctionId(p,joinRef);
+ p->argc =3;
+ pushInstruction(mb, p);
+ continue;
+ }
for (j = 0; j < p->argc; j++)
if (alias[getArg(p, j)])
@@ -275,7 +286,7 @@ OPTdatacellImplementation(Client cntxt,
OPTDEBUGdatacell {
mnstr_printf(cntxt->fdout, "#Datacell optimizer
intermediate\n");
- printFunction(cntxt->fdout, mb, stk, LIST_MAL_STMT);
+ printFunction(cntxt->fdout, mb, stk, LIST_MAL_DEBUG);
}
/* optimize this new continous query using the default pipe */
addOptimizers(cntxt, mb, "default_pipe");
@@ -286,7 +297,7 @@ OPTdatacellImplementation(Client cntxt,
}
OPTDEBUGdatacell {
mnstr_printf(cntxt->fdout, "#Datacell optimizer finished\n");
- printFunction(cntxt->fdout, mb, stk, LIST_MAL_STMT);
+ printFunction(cntxt->fdout, mb, stk, LIST_MAL_DEBUG);
}
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
diff --git a/sql/backends/monet5/datacell/petrinet.c
b/sql/backends/monet5/datacell/petrinet.c
--- a/sql/backends/monet5/datacell/petrinet.c
+++ b/sql/backends/monet5/datacell/petrinet.c
@@ -472,8 +472,9 @@ PNcontroller(void *dummy)
lng t, analysis, now;
char buf[BUFSIZ], *modnme, *fcnnme;
- cntxt = mal_clients; /* run as admin */
- SQLinitEnvironment(cntxt);
+ cntxt = mal_clients; /* run as admin in SQL mode*/
+ if( strcmp(cntxt->scenario, "sql") )
+ SQLinitEnvironment(cntxt);
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list