MonetDB: iot - Merged with backend

2016-06-21 Thread Pedro Ferreira
Changeset: ac718d7895af for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=ac718d7895af
Added Files:
sql/backends/monet5/Tests/pyapi30.sql
sql/backends/monet5/Tests/pyapi30.stable.err
sql/backends/monet5/Tests/pyapi30.stable.out
Removed Files:
clients/python2/ChangeLog
clients/python2/ChangeLog-Archive
clients/python2/ChangeLog.Jun2016
clients/python2/MANIFEST.in
clients/python2/Makefile.ag
clients/python2/README.rst
clients/python2/monetdb/__init__.py
clients/python2/monetdb/control.py
clients/python2/monetdb/exceptions.py
clients/python2/monetdb/mapi.py
clients/python2/monetdb/sql/__init__.py
clients/python2/monetdb/sql/connections.py
clients/python2/monetdb/sql/converters.py
clients/python2/monetdb/sql/cursors.py
clients/python2/monetdb/sql/monetize.py
clients/python2/monetdb/sql/pythonize.py
clients/python2/monetdb/sql/types.py
clients/python2/setup.py
clients/python2/test/capabilities.py
clients/python2/test/dbapi20.py
clients/python2/test/run.cmd
clients/python2/test/run.sh
clients/python2/test/runtests.py
clients/python2/test/test_control.py
clients/python2/test/test_monetize.py
clients/python2/test/test_pythonize.py
clients/python3/ChangeLog
clients/python3/ChangeLog-Archive
clients/python3/ChangeLog.Jun2016
clients/python3/MANIFEST.in
clients/python3/Makefile.ag
clients/python3/README.rst
clients/python3/monetdb/__init__.py
clients/python3/monetdb/control.py
clients/python3/monetdb/exceptions.py
clients/python3/monetdb/mapi.py
clients/python3/monetdb/sql/__init__.py
clients/python3/monetdb/sql/connections.py
clients/python3/monetdb/sql/converters.py
clients/python3/monetdb/sql/cursors.py
clients/python3/monetdb/sql/monetize.py
clients/python3/monetdb/sql/pythonize.py
clients/python3/monetdb/sql/types.py
clients/python3/setup.py
clients/python3/test/capabilities.py
clients/python3/test/dbapi20.py
clients/python3/test/run.cmd
clients/python3/test/run.sh
clients/python3/test/runtests.py
clients/python3/test/test_control.py
clients/python3/test/test_monetize.py
clients/python3/test/test_pythonize.py
monetdb5/tests/BugReports/Tests/no.146.stable.out
sql/test/mapi/Tests/python2_test_monetdb_sql.SQL.bat
sql/test/mapi/Tests/python2_test_monetdb_sql.SQL.sh
sql/test/mapi/Tests/python2_test_monetdb_sql.stable.err
sql/test/mapi/Tests/python2_test_monetdb_sql.stable.out
sql/test/mapi/Tests/python3_test_monetdb_sql.SQL.bat
sql/test/mapi/Tests/python3_test_monetdb_sql.SQL.sh
sql/test/mapi/Tests/python3_test_monetdb_sql.stable.err
sql/test/mapi/Tests/python3_test_monetdb_sql.stable.out
Modified Files:
.hgtags
MonetDB.spec
NT/Makefile
NT/installer32/MonetDB-ODBC-Installer.vdproj
NT/installer32/MonetDB5-Geom-Module.vdproj
NT/installer32/MonetDB5-SQL-Installer.vdproj
NT/installer64/MonetDB-ODBC-Installer.vdproj
NT/installer64/MonetDB5-Geom-Module.vdproj
NT/installer64/MonetDB5-SQL-Installer.vdproj
NT/monetdb_config.h.in
NT/rules.msc
buildtools/autogen/autogen/am.py
buildtools/autogen/autogen/msc.py
clients/Makefile.ag
clients/Tests/SQL-dump.stable.out
clients/Tests/SQL-dump.stable.out.int128
clients/examples/python/basics.py
clients/examples/python/mclient-python2.py
clients/examples/python/mclient-python3.py
clients/examples/python/perf.py
clients/examples/python/sqlsample.py
clients/mapiclient/msqldump.c
clients/mapilib/mapi.rc
clients/odbc/driver/driver.rc
clients/odbc/winsetup/setup.rc
common/stream/stream.c
configure.ag
debian/changelog
debian/control
debian/fix-deb.sh
gdk/libbat.rc
geom/lib/libgeom.c
geom/monetdb5/geom.c
geom/sql/Makefile.ag
java/Makefile.ag
java/build.properties
java/pom.xml
java/release.txt
java/src/main/java/nl/cwi/monetdb/jdbc/MonetDatabaseMetaData.java
java/src/main/java/nl/cwi/monetdb/jdbc/MonetPreparedStatement.java
java/src/main/java/nl/cwi/monetdb/jdbc/MonetResultSet.java
libversions
monetdb5/ChangeLog-Archive
monetdb5/extras/pyapi/pyapi.c
monetdb5/mal/mal_dataflow.c
monetdb5/mal/mal_instruction.c
monetdb5/mal/mal_parser.c
monetdb5/modules/atoms/url.c
monetdb5/modules/mal/groupby.c
monetdb5/modules/mal/sysmon.c
monetdb5/modules/mal/tablet.c

MonetDB: iot - Merged with backend code

2016-06-15 Thread Pedro Ferreira
Changeset: 30283d4f77ec for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=30283d4f77ec
Removed Files:
sql/backends/monet5/iot/Tests/iot01.sql
Modified Files:
monetdb5/mal/mal_instruction.c
monetdb5/optimizer/opt_iot.c
sql/backends/monet5/iot/50_iot.sql
sql/backends/monet5/iot/Makefile.am
sql/backends/monet5/iot/Tests/All
sql/backends/monet5/iot/Tests/cleanup.sql
sql/backends/monet5/iot/Tests/iot00.sql
sql/backends/monet5/iot/Tests/iot02.sql
sql/backends/monet5/iot/Tests/iot03.sql
sql/backends/monet5/iot/Tests/iot10.sql
sql/backends/monet5/iot/Tests/iot12.sql
sql/backends/monet5/iot/Tests/iot15.sql
sql/backends/monet5/iot/Tests/receptor01.sql
sql/backends/monet5/iot/basket.c
sql/backends/monet5/iot/basket.h
sql/backends/monet5/iot/basket.mal
sql/backends/monet5/iot/iot.c
sql/backends/monet5/iot/iot.h
sql/backends/monet5/iot/iot.mal
sql/backends/monet5/iot/petrinet.c
sql/backends/monet5/iot/petrinet.h
sql/backends/monet5/iot/petrinet.mal
sql/backends/monet5/sql_optimizer.c
sql/backends/monet5/sql_scenario.c
Branch: iot
Log Message:

Merged with backend code


diffs (truncated from 1908 to 300 lines):

diff --git a/monetdb5/mal/mal_instruction.c b/monetdb5/mal/mal_instruction.c
--- a/monetdb5/mal/mal_instruction.c
+++ b/monetdb5/mal/mal_instruction.c
@@ -207,6 +207,7 @@ freeMalBlk(MalBlkPtr mb)
 
if (mb->history)
freeMalBlk(mb->history);
+   mb->history = 0;
if (mb->binding)
GDKfree(mb->binding);
mb->binding = 0;
diff --git a/monetdb5/optimizer/opt_iot.c b/monetdb5/optimizer/opt_iot.c
--- a/monetdb5/optimizer/opt_iot.c
+++ b/monetdb5/optimizer/opt_iot.c
@@ -34,7 +34,7 @@
 #include "opt_dataflow.h"
 
 #define MAXBSKT 64
-#define isstream(S,T) \
+#define getStreamTableInfo(S,T) \
for(fnd=0, k= 0; k< btop; k++) \
if( strcmp(schemas[k], S)== 0 && strcmp(tables[k], T)== 0 ){ \
fnd= 1; break;\
@@ -50,13 +50,18 @@ OPTiotImplementation(Client cntxt, MalBl
str  tables[MAXBSKT];
int  mvc[MAXBSKT];
int done[MAXBSKT]= {0};
-   int btop=0;
+   int btop=0, lastmvc=0;
int noerror=0;
-   int cq;
+   int cq= strncmp(getFunctionId(getInstrPtr(mb,0)),"cq",2) == 0;
+   char buf[256];
+   lng usec = GDKusec();
 
(void) pci;
 
-   cq= strncmp(getFunctionId(getInstrPtr(mb,0)),"cq",2) == 0;
+   OPTDEBUGiot {
+   mnstr_printf(cntxt->fdout, "#iot optimizer start\n");
+   printFunction(cntxt->fdout, mb, stk, LIST_MAL_DEBUG);
+   } 
old = mb->stmt;
limit = mb->stop;
slimit = mb->ssize;
@@ -64,29 +69,27 @@ OPTiotImplementation(Client cntxt, MalBl
/* first analyse the query for streaming tables */
for (i = 1; i < limit && btop fdout, "#iot stream 
table %s.%s\n", getModuleId(p), getFunctionId(p));
-   schemas[btop]= getVarConstant(mb, getArg(p,1)).val.sval;
-   tables[btop]= getVarConstant(mb, getArg(p,2)).val.sval;
-   mvc[btop] = getArg(p,0);
+   schemas[btop]= getVarConstant(mb, getArg(p,2)).val.sval;
+   tables[btop]= getVarConstant(mb, getArg(p,3)).val.sval;
for( j =0; j< btop ; j++)
if( strcmp(schemas[j], schemas[j+1])==0  && 
strcmp(tables[j],tables[j+1]) ==0)
break;
-   mvc[j] = getArg(p,0);
+   lastmvc = mvc[j] = getArg(p,0);
done[j]= done[j] || getFunctionId(p)== registerRef;
if( j == btop)
btop++;
}
-   if( getModuleId(p)== basketRef && (getFunctionId(p) == 
appendRef || getFunctionId(p) == deleteRef )){
+   if( getModuleId(p)== basketRef && getFunctionId(p) == appendRef 
){
OPTDEBUGiot mnstr_printf(cntxt->fdout, "#iot stream 
table %s.%s\n", getModuleId(p), getFunctionId(p));
schemas[btop]= getVarConstant(mb, getArg(p,2)).val.sval;
tables[btop]= getVarConstant(mb, getArg(p,3)).val.sval;
-   mvc[btop] = getArg(p,0);
for( j =0; j< btop ; j++)
if( strcmp(schemas[j], schemas[j+1])==0  && 
strcmp(tables[j],tables[j+1]) ==0)