Changeset: 38af22c8e50d for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=38af22c8e50d
Added Files:
        sql/backends/monet5/iot/Tests/cleanup.sql
        sql/backends/monet5/iot/Tests/iot01.sql
        sql/backends/monet5/iot/Tests/iot02.sql
        sql/backends/monet5/iot/Tests/iot03.sql
        sql/backends/monet5/iot/Tests/iot12.sql
        sql/backends/monet5/iot/Tests/receptor01.sql
Removed Files:
        sql/backends/monet5/iot/Tests/iot05.sql
        sql/backends/monet5/iot/Tests/iot99.sql
Modified Files:
        monetdb5/optimizer/opt_iot.c
        monetdb5/optimizer/opt_prelude.c
        monetdb5/optimizer/opt_prelude.h
        sql/backends/monet5/iot/50_iot.sql
        sql/backends/monet5/iot/Makefile.ag
        sql/backends/monet5/iot/Makefile.am
        sql/backends/monet5/iot/Tests/All
        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
Branch: iot
Log Message:

Intermittent commit
Change the interface to empty streams.
Add the skeleton for the receptor.


diffs (truncated from 802 to 300 lines):

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
@@ -167,7 +167,7 @@ OPTiotImplementation(Client cntxt, MalBl
                                // empty all baskets used only when we are 
optimizing a cq
                                for( j=0; cq && j<btop; j++)
                                if( done[j]==0) {
-                                       p= newStmt(mb,basketRef,finishRef);
+                                       p= newStmt(mb,iotRef,tumbleRef);
                                        p= pushStr(mb,p, schemas[j]);
                                        p= pushStr(mb,p, tables[j]);
                                }
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
@@ -87,7 +87,6 @@ str execRef;
 str expandRef;
 str exportOperationRef;
 str findRef;
-str finishRef;
 str firstnRef;
 str getRef;
 str getTraceRef;
@@ -236,6 +235,7 @@ str unpackRef;
 str unpinRef;
 str updateRef;
 str timestampRef;
+str tumbleRef;
 str transactionRef;
 str thetasubselectRef;
 str likesubselectRef;
@@ -320,7 +320,6 @@ void optimizerInit(void)
        expandRef = putName("expand");
        exportOperationRef = putName("exportOperation");
        findRef = putName("find");
-       finishRef = putName("finish");
        firstnRef = putName("firstn");
        getRef = putName("get");
        getTraceRef = putName("getTrace");
@@ -458,6 +457,7 @@ void optimizerInit(void)
        transRef= putName("trans");
        transactionRef= putName("transaction");
        timestampRef = putName("timestamp");
+       tumbleRef = putName("tumble");
        not_uniqueRef= putName("not_unique");
        sampleRef= putName("sample");
        subuniqueRef= putName("subunique");
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
@@ -219,6 +219,7 @@ opt_export  str subsumRef;
 opt_export  str subavgRef;
 opt_export  str subsortRef;
 opt_export  str timestampRef;
+opt_export     str tumbleRef;
 opt_export  str transactionRef;
 opt_export  str takeRef;
 opt_export  str transRef;
diff --git a/sql/backends/monet5/iot/50_iot.sql 
b/sql/backends/monet5/iot/50_iot.sql
--- a/sql/backends/monet5/iot/50_iot.sql
+++ b/sql/backends/monet5/iot/50_iot.sql
@@ -42,7 +42,7 @@ create procedure iot.deregister("schema"
 create procedure iot.deregister()
        external name iot.deregister;
 
--- resume with limited the number of scheduler before next pause
+-- resume with limited the number of scheduler loops before next pause
 create procedure iot.cycles(n integer)
        external name iot.cycles;
 
@@ -54,7 +54,13 @@ create procedure iot.period(n integer)
 create procedure iot.basket("schema" string, "table" string, dirpath string)
        external name iot.basket;
 
--- triggering conditions for each stream
+-- input/output places
+create procedure iot.receptor("schema" string, "table" string, dir string)
+       external name iot.receptor;
+create procedure iot.emitter("schema" string, "table" string, dir string)
+       external name iot.emitter;
+
+
 create procedure iot.threshold("schema" string, "table" string, elem int)
        external name iot.threshold;
 
@@ -62,6 +68,13 @@ create procedure iot.beat("schema" strin
        external name iot.beat;
 
 -- cleaup activities 
+create procedure iot.tumble()
+       external name iot.tumble;
+create procedure iot.tumble("schema" string, "table" string)
+       external name iot.tumble;
+create procedure iot.tumble("schema" string, "table" string, elem int)
+       external name iot.tumble;
+
 create procedure iot.window("schema" string, "table" string, elem int)
        external name iot.window;
 
diff --git a/sql/backends/monet5/iot/Makefile.ag 
b/sql/backends/monet5/iot/Makefile.ag
--- a/sql/backends/monet5/iot/Makefile.ag
+++ b/sql/backends/monet5/iot/Makefile.ag
@@ -36,7 +36,9 @@ INCLUDES = .. \
 lib__iot = {
        MODULE
        DIR = libdir/monetdb5
-       SOURCES = iot.c basket.c petrinet.c
+       SOURCES = iot.c iot.h \
+               basket.c basket.h \
+               petrinet.c petrinet.h
        LIBS = ../../../../monetdb5/tools/libmonetdb5 \
                ../../../../gdk/libbat 
 }
diff --git a/sql/backends/monet5/iot/Makefile.am 
b/sql/backends/monet5/iot/Makefile.am
--- a/sql/backends/monet5/iot/Makefile.am
+++ b/sql/backends/monet5/iot/Makefile.am
@@ -13,9 +13,9 @@ install-exec-local-50_iot.mal: 50_iot.ma
 uninstall-local-50_iot.mal: 
        $(RM) $(DESTDIR)$(libdir)/monetdb5/autoload/50_iot.mal
 
-iot.o iot.lo: iot.c iot.h ../../../../monetdb5/optimizer/opt_prelude.h 
../../../../monetdb5/optimizer/opt_support.h 
../../../../monetdb5/optimizer/../mal/mal.h 
../../../../monetdb5/optimizer/../mal/mal_function.h 
../../../../monetdb5/optimizer/../mal/mal_scenario.h 
../../../../monetdb5/optimizer/../mal/mal_builder.h 
../../../../monetdb5/optimizer/opt_pipes.h 
../../../../monetdb5/optimizer/opt_iot.h ../sql_optimizer.h ../sql_gencode.h
-petrinet.o petrinet.lo: petrinet.c iot.h petrinet.h 
../../../../monetdb5/mal/mal_builder.h 
../../../../monetdb5/optimizer/opt_support.h 
../../../../monetdb5/optimizer/../mal/mal.h 
../../../../monetdb5/optimizer/../mal/mal_function.h 
../../../../monetdb5/optimizer/../mal/mal_scenario.h 
../../../../monetdb5/optimizer/../mal/mal_builder.h 
../../../../monetdb5/optimizer/opt_prelude.h
-basket.o basket.lo: basket.c ../../../../gdk/gdk.h iot.h basket.h 
../../../../monetdb5/mal/mal_instruction.h ../../../../monetdb5/mal/mal_type.h 
../../../../monetdb5/mal/mal.h ../../../../monetdb5/mal/../../gdk/gdk.h 
../../../../monetdb5/mal/mal_stack.h ../../../../monetdb5/mal/mal_namespace.h 
../../../../monetdb5/mal/mal_errors.h ../../../../monetdb5/mal/mal_exception.h 
../../../../monetdb5/mal/mal_builder.h 
../../../../monetdb5/optimizer/opt_support.h 
../../../../monetdb5/optimizer/../mal/mal.h 
../../../../monetdb5/optimizer/../mal/mal_function.h 
../../../../monetdb5/optimizer/../mal/mal_scenario.h 
../../../../monetdb5/optimizer/../mal/mal_builder.h 
../../../../monetdb5/optimizer/opt_prelude.h
+iot.o iot.lo: iot.c iot.h ../../../../monetdb5/mal/../../gdk/gdk.h 
../../../../monetdb5/mal/mal.h ../../../../monetdb5/mal/mal_interpreter.h 
../sql.h ../sql_scenario.h basket.h petrinet.h 
../../../../monetdb5/optimizer/opt_prelude.h 
../../../../monetdb5/optimizer/opt_support.h 
../../../../monetdb5/optimizer/../mal/mal.h 
../../../../monetdb5/optimizer/../mal/mal_function.h 
../../../../monetdb5/optimizer/../mal/mal_scenario.h 
../../../../monetdb5/optimizer/../mal/mal_builder.h 
../../../../monetdb5/optimizer/opt_pipes.h 
../../../../monetdb5/optimizer/opt_iot.h ../sql_optimizer.h ../sql_gencode.h
+petrinet.o petrinet.lo: petrinet.c iot.h 
../../../../monetdb5/mal/../../gdk/gdk.h ../../../../monetdb5/mal/mal.h 
../../../../monetdb5/mal/mal_interpreter.h ../sql.h ../sql_scenario.h basket.h 
petrinet.h ../../../../monetdb5/mal/mal_builder.h 
../../../../monetdb5/optimizer/opt_support.h 
../../../../monetdb5/optimizer/../mal/mal.h 
../../../../monetdb5/optimizer/../mal/mal_function.h 
../../../../monetdb5/optimizer/../mal/mal_scenario.h 
../../../../monetdb5/optimizer/../mal/mal_builder.h 
../../../../monetdb5/optimizer/opt_prelude.h
+basket.o basket.lo: basket.c ../../../../gdk/gdk.h iot.h 
../../../../monetdb5/mal/../../gdk/gdk.h ../../../../monetdb5/mal/mal.h 
../../../../monetdb5/mal/mal_interpreter.h ../sql.h ../sql_scenario.h basket.h 
petrinet.h ../../../../monetdb5/mal/mal_instruction.h 
../../../../monetdb5/mal/mal_type.h ../../../../monetdb5/mal/mal_stack.h 
../../../../monetdb5/mal/mal_namespace.h ../../../../monetdb5/mal/mal_errors.h 
../../../../monetdb5/mal/mal_exception.h ../../../../monetdb5/mal/mal_builder.h 
../../../../monetdb5/optimizer/opt_support.h 
../../../../monetdb5/optimizer/../mal/mal.h 
../../../../monetdb5/optimizer/../mal/mal_function.h 
../../../../monetdb5/optimizer/../mal/mal_scenario.h 
../../../../monetdb5/optimizer/../mal/mal_builder.h 
../../../../monetdb5/optimizer/opt_prelude.h
 install-exec-local-basket.mal: basket.mal
        -mkdir -p $(DESTDIR)$(libdir)/monetdb5
        -$(RM) $(DESTDIR)$(libdir)/monetdb5/basket.mal
@@ -53,21 +53,21 @@ lib_iot_la_CFLAGS=-DLIBIOT $(AM_CFLAGS)
 iotdir = $(libdir)/monetdb5
 lib_iot_la_LIBADD = ../../../../monetdb5/tools/libmonetdb5.la 
../../../../gdk/libbat.la
 $(do)install-iotLTLIBRARIES : 
-lib_iot_la-iot.lo: iot.c iot.h ../../../../monetdb5/optimizer/opt_prelude.h 
../../../../monetdb5/optimizer/opt_support.h 
../../../../monetdb5/optimizer/../mal/mal.h 
../../../../monetdb5/optimizer/../mal/mal_function.h 
../../../../monetdb5/optimizer/../mal/mal_scenario.h 
../../../../monetdb5/optimizer/../mal/mal_builder.h 
../../../../monetdb5/optimizer/opt_pipes.h 
../../../../monetdb5/optimizer/opt_iot.h ../sql_optimizer.h ../sql_gencode.h
+lib_iot_la-iot.lo: iot.c iot.h ../../../../monetdb5/mal/../../gdk/gdk.h 
../../../../monetdb5/mal/mal.h ../../../../monetdb5/mal/mal_interpreter.h 
../sql.h ../sql_scenario.h basket.h petrinet.h 
../../../../monetdb5/optimizer/opt_prelude.h 
../../../../monetdb5/optimizer/opt_support.h 
../../../../monetdb5/optimizer/../mal/mal.h 
../../../../monetdb5/optimizer/../mal/mal_function.h 
../../../../monetdb5/optimizer/../mal/mal_scenario.h 
../../../../monetdb5/optimizer/../mal/mal_builder.h 
../../../../monetdb5/optimizer/opt_pipes.h 
../../../../monetdb5/optimizer/opt_iot.h ../sql_optimizer.h ../sql_gencode.h
        $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) 
$(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_iot_la_CFLAGS) $(CFLAGS) 
$(iot_CFLAGS) -c -o lib_iot_la-iot.lo `test -f 'iot.c' || echo 
'$(srcdir)/'`iot.c
-lib_iot_la-basket.lo: basket.c ../../../../gdk/gdk.h iot.h basket.h 
../../../../monetdb5/mal/mal_instruction.h ../../../../monetdb5/mal/mal_type.h 
../../../../monetdb5/mal/mal.h ../../../../monetdb5/mal/../../gdk/gdk.h 
../../../../monetdb5/mal/mal_stack.h ../../../../monetdb5/mal/mal_namespace.h 
../../../../monetdb5/mal/mal_errors.h ../../../../monetdb5/mal/mal_exception.h 
../../../../monetdb5/mal/mal_builder.h 
../../../../monetdb5/optimizer/opt_support.h 
../../../../monetdb5/optimizer/../mal/mal.h 
../../../../monetdb5/optimizer/../mal/mal_function.h 
../../../../monetdb5/optimizer/../mal/mal_scenario.h 
../../../../monetdb5/optimizer/../mal/mal_builder.h 
../../../../monetdb5/optimizer/opt_prelude.h
+lib_iot_la-basket.lo: basket.c ../../../../gdk/gdk.h iot.h 
../../../../monetdb5/mal/../../gdk/gdk.h ../../../../monetdb5/mal/mal.h 
../../../../monetdb5/mal/mal_interpreter.h ../sql.h ../sql_scenario.h basket.h 
petrinet.h ../../../../monetdb5/mal/mal_instruction.h 
../../../../monetdb5/mal/mal_type.h ../../../../monetdb5/mal/mal_stack.h 
../../../../monetdb5/mal/mal_namespace.h ../../../../monetdb5/mal/mal_errors.h 
../../../../monetdb5/mal/mal_exception.h ../../../../monetdb5/mal/mal_builder.h 
../../../../monetdb5/optimizer/opt_support.h 
../../../../monetdb5/optimizer/../mal/mal.h 
../../../../monetdb5/optimizer/../mal/mal_function.h 
../../../../monetdb5/optimizer/../mal/mal_scenario.h 
../../../../monetdb5/optimizer/../mal/mal_builder.h 
../../../../monetdb5/optimizer/opt_prelude.h
        $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) 
$(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_iot_la_CFLAGS) $(CFLAGS) 
$(basket_CFLAGS) -c -o lib_iot_la-basket.lo `test -f 'basket.c' || echo 
'$(srcdir)/'`basket.c
-lib_iot_la-petrinet.lo: petrinet.c iot.h petrinet.h 
../../../../monetdb5/mal/mal_builder.h 
../../../../monetdb5/optimizer/opt_support.h 
../../../../monetdb5/optimizer/../mal/mal.h 
../../../../monetdb5/optimizer/../mal/mal_function.h 
../../../../monetdb5/optimizer/../mal/mal_scenario.h 
../../../../monetdb5/optimizer/../mal/mal_builder.h 
../../../../monetdb5/optimizer/opt_prelude.h
+lib_iot_la-petrinet.lo: petrinet.c iot.h 
../../../../monetdb5/mal/../../gdk/gdk.h ../../../../monetdb5/mal/mal.h 
../../../../monetdb5/mal/mal_interpreter.h ../sql.h ../sql_scenario.h basket.h 
petrinet.h ../../../../monetdb5/mal/mal_builder.h 
../../../../monetdb5/optimizer/opt_support.h 
../../../../monetdb5/optimizer/../mal/mal.h 
../../../../monetdb5/optimizer/../mal/mal_function.h 
../../../../monetdb5/optimizer/../mal/mal_scenario.h 
../../../../monetdb5/optimizer/../mal/mal_builder.h 
../../../../monetdb5/optimizer/opt_prelude.h
        $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) 
$(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_iot_la_CFLAGS) $(CFLAGS) 
$(petrinet_CFLAGS) -c -o lib_iot_la-petrinet.lo `test -f 'petrinet.c' || echo 
'$(srcdir)/'`petrinet.c
 nodist_lib_iot_la_SOURCES =
-dist_lib_iot_la_SOURCES = iot.c basket.c petrinet.c
+dist_lib_iot_la_SOURCES = iot.c iot.h basket.c basket.h petrinet.c petrinet.h
 lib_iot_la_LDFLAGS = -module -avoid-version
 dist-hook:
        mkdir -p $(distdir)/Tests
        cp -pR $(srcdir)/Tests/* $(distdir)/Tests
 BUILT_SOURCES =
 MOSTLYCLEANFILES =
-EXTRA_DIST = Makefile.ag Makefile.msc 50_iot.mal 50_iot.sql basket.c 
basket.mal iot.c iot.mal petrinet.c petrinet.mal
+EXTRA_DIST = Makefile.ag Makefile.msc 50_iot.mal 50_iot.sql basket.c basket.h 
basket.mal iot.c iot.h iot.mal petrinet.c petrinet.h petrinet.mal
 iot_LTLIBRARIES = lib_iot.la
 uninstall-local: uninstall-local-50_iot.mal uninstall-local-50_iot.sql 
uninstall-local-basket.mal uninstall-local-iot.mal uninstall-local-petrinet.mal
 install-exec-local: install-exec-local-50_iot.mal 
install-exec-local-50_iot.sql install-exec-local-basket.mal 
install-exec-local-iot.mal install-exec-local-petrinet.mal
diff --git a/sql/backends/monet5/iot/Tests/All 
b/sql/backends/monet5/iot/Tests/All
--- a/sql/backends/monet5/iot/Tests/All
+++ b/sql/backends/monet5/iot/Tests/All
@@ -1,5 +1,8 @@
 iot00
-iot05
-iot99
+iot01
+iot02
+iot03
+receptor01
+cleaup
 petrinet00
 webtest
diff --git a/sql/backends/monet5/iot/Tests/iot99.sql 
b/sql/backends/monet5/iot/Tests/cleanup.sql
rename from sql/backends/monet5/iot/Tests/iot99.sql
rename to sql/backends/monet5/iot/Tests/cleanup.sql
diff --git a/sql/backends/monet5/iot/Tests/iot01.sql 
b/sql/backends/monet5/iot/Tests/iot01.sql
new file mode 100644
--- /dev/null
+++ b/sql/backends/monet5/iot/Tests/iot01.sql
@@ -0,0 +1,20 @@
+-- Setting stream parameters after iot00
+set schema iot;
+set optimizer='iot_pipe';
+
+-- Eating away the tuples from the stream
+create procedure cq01()
+begin
+       insert into result select min(t), count(*), avg(val) from stmp;
+       call iot.tumble('iot','stmp'); 
+end;
+call iot.query('iot','cq01');
+
+insert into stmp values('2005-09-23 12:34:26.000',1,11.0);
+insert into stmp values('2005-09-23 12:34:27.000',1,12.0);
+insert into stmp values('2005-09-23 12:34:28.000',1,13.0);
+
+select * from stmp;
+select * from result;
+
+select * from  iot.queries();
diff --git a/sql/backends/monet5/iot/Tests/iot02.sql 
b/sql/backends/monet5/iot/Tests/iot02.sql
new file mode 100644
--- /dev/null
+++ b/sql/backends/monet5/iot/Tests/iot02.sql
@@ -0,0 +1,28 @@
+-- Setting stream parameters after iot00
+set schema iot;
+set optimizer='iot_pipe';
+
+-- Example of a stream splitter
+create table result1(like stmp);
+create table result2(like stmp);
+
+create procedure cq02()
+begin
+       insert into result1 select * from stmp;
+       insert into result2 select * from stmp;
+       call iot.tumble('iot','stmp');
+end;
+call iot.query('iot','cq02');
+
+insert into stmp values('2005-09-23 12:34:26.000',1,11.0);
+insert into stmp values('2005-09-23 12:34:27.000',1,11.0);
+insert into stmp values('2005-09-23 12:34:28.000',1,13.0);
+insert into stmp values('2005-09-23 12:34:28.000',1,13.0);
+
+call iot.deactivate('iot','cq02');
+
+select * from stmp;
+select * from result1;
+select * from result2;
+
+select * from  iot.queries();
diff --git a/sql/backends/monet5/iot/Tests/iot03.sql 
b/sql/backends/monet5/iot/Tests/iot03.sql
new file mode 100644
--- /dev/null
+++ b/sql/backends/monet5/iot/Tests/iot03.sql
@@ -0,0 +1,26 @@
+-- Setting stream parameters after iot00
+set schema iot;
+set optimizer='iot_pipe';
+
+-- Example of a window based action
+create table result3(like stmp);
+
+create procedure cq03()
+begin
+       call iot.window('iot','stmp',2);
+       insert into result3 select min(t), count(*), avg(val) from stmp;
+       call iot.tumble('iot','stmp',2);
+end;
+call iot.query('iot','cq03');
+
+insert into stmp values('2005-09-23 12:34:26.000',1,11.0);
+insert into stmp values('2005-09-23 12:34:27.000',1,11.0);
+insert into stmp values('2005-09-23 12:34:28.000',1,13.0);
+insert into stmp values('2005-09-23 12:34:28.000',1,13.0);
+
+call iot.deactivate('iot','cq03');
+
+select * from stmp;
+select * from result3;
+
+select * from  iot.queries();
diff --git a/sql/backends/monet5/iot/Tests/iot12.sql 
b/sql/backends/monet5/iot/Tests/iot12.sql
new file mode 100644
--- /dev/null
+++ b/sql/backends/monet5/iot/Tests/iot12.sql
@@ -0,0 +1,42 @@
+-- introduce a heartbeat query
+set schema iot;
+set optimizer='iot_pipe';
+
+declare hbclk1 integer;
+declare hbclk2 integer;
+declare cnt integer;
+
+set hbclk1 = 0;
+set hbclk2 = 0;
+set cnt = 0;
+
+-- continuous queries should be encapsulated in procedures
+-- this way their naming becomes easier, and mult-statement
+-- actions are better supported.
+
+--However, these queries won't run because the SQL context
+--holding the variables is not generally known
+create procedure clk1()
+begin
+       set hbclk1 = hbclk1+1;
+end;
+
+create procedure clk3()
+begin
+       set hbclk1 = hbclk1+1;
+       set hbclk2 = hbclk2+2;
+       --set cnt =(select count(*) from stmp);
+end;
+
+-- alternative is a simple query
+call iot.query('iot','clk1');
+call iot.query('iot','clk3');
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to