Changeset: 4b8e12bcd4fc for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=4b8e12bcd4fc
Added Files:
sql/backends/monet5/datacell/Tests/scenario07.sql
Modified Files:
sql/backends/monet5/datacell/Tests/scenario01.sql
sql/backends/monet5/datacell/Tests/scenario02.sql
sql/backends/monet5/datacell/Tests/scenario03.sql
sql/backends/monet5/datacell/datacell.c
sql/backends/monet5/datacell/datacell.h
sql/backends/monet5/datacell/datacell.mal
Branch: default
Log Message:
Add double query with filter
Scenario07 shows how two continues queries process
the input through an intermediate basket, filtering out
all even events.
diffs (157 lines):
diff --git a/sql/backends/monet5/datacell/Tests/scenario01.sql
b/sql/backends/monet5/datacell/Tests/scenario01.sql
--- a/sql/backends/monet5/datacell/Tests/scenario01.sql
+++ b/sql/backends/monet5/datacell/Tests/scenario01.sql
@@ -12,40 +12,10 @@ create table datacell.bsktin(
);
create table datacell.bsktout( like datacell.bsktin);
--- initialize the baskets
--- call datacell.prelude(); performs the next two statements
-call datacell.basket('datacell.bsktin');
-call datacell.basket('datacell.bsktout');
+call datacell.receptor('datacell.bsktin','localhost',50501,'udp','passive');
--- initialize receptor
-call datacell.receptor('datacell.bsktin','localhost',50501);
-call datacell.mode('datacell.bsktin','passive');
-call datacell.protocol('datacell.bsktin','udp');
-call datacell.resume('datacell.bsktin');
-
--- externally, activate the sensor leaving some in the basket
---sensor --host=localhost --port=50501 --events=100 --columns=3 --delay=1
-
--- initialize emitter
-call datacell.emitter('datacell.bsktout','localhost',50601);
-call datacell.mode('datacell.bsktout','active');
-call datacell.protocol('datacell.bsktout','udp');
-call datacell.resume('datacell.bsktout');
-
--- externally, activate the actuator server to listen
--- nc -l -u 50601
-
--- compile the continous query
-call datacell.query('datacell.pass', 'insert into datacell.bsktout select *
from datacell.bsktin;');
-call datacell.register('datacell.pass');
-
--- start the datacell scheduler
-call datacell.resume();
-call datacell.dump();
-
--- wrapup
--- stop the datacell scheduler
-call datacell.postlude();
+call datacell.emitter('datacell.bsktout','localhost',50601,'tcp','active');
+select * from datacell.receptors(); select * from datacell.emitters(); select
* from datacell.baskets();
-- remove everything
drop table datacell.bsktin;
diff --git a/sql/backends/monet5/datacell/Tests/scenario02.sql
b/sql/backends/monet5/datacell/Tests/scenario02.sql
--- a/sql/backends/monet5/datacell/Tests/scenario02.sql
+++ b/sql/backends/monet5/datacell/Tests/scenario02.sql
@@ -16,9 +16,10 @@ call datacell.receptor('datacell.potin',
call datacell.emitter('datacell.potout','localhost',50602);
call datacell.query('datacell.putter', 'insert into datacell.potout select
now(), count(*) from datacell.potin;');
+call datacell.pause('potout'); -- hold the events
call datacell.resume();
-call datacell.dump();
+select * from datacell.receptors(); select * from datacell.emitters(); select
* from datacell.queries(); select * from datacell.baskets();
-- externally, activate the sensor
--sensor --host=localhost --port=50502 --events=100 --columns=3 --delay=1
diff --git a/sql/backends/monet5/datacell/Tests/scenario03.sql
b/sql/backends/monet5/datacell/Tests/scenario03.sql
--- a/sql/backends/monet5/datacell/Tests/scenario03.sql
+++ b/sql/backends/monet5/datacell/Tests/scenario03.sql
@@ -20,7 +20,7 @@ call datacell.emitter('datacell.bakout',
call datacell.query('datacell.schep', 'insert into datacell.bakout select
now(), count(*) from datacell.bakin where
datacell.threshold(\'datacell.bakin\',15);');
call datacell.resume();
-call datacell.dump();
+select * from datacell.receptors(); select * from datacell.emitters(); select
* from datacell.queries(); select * from datacell.baskets();
-- externally, activate the sensor
--sensor --host=localhost --port=50503 --events=100 --columns=3 --delay=1
diff --git a/sql/backends/monet5/datacell/Tests/scenario07.sql
b/sql/backends/monet5/datacell/Tests/scenario07.sql
new file mode 100644
--- /dev/null
+++ b/sql/backends/monet5/datacell/Tests/scenario07.sql
@@ -0,0 +1,37 @@
+-- Scenario to exercise the datacell implementation
+-- using a single receptor, emitter and a basket
+
+set optimizer='datacell_pipe';
+
+create table datacell.bsktin(
+ id integer,
+ tag integer,
+ payload integer
+);
+create table datacell.bsktmiddle (like datacell.bsktin);
+create table datacell.bsktout (like datacell.bsktin);
+
+call datacell.basket('datacell.bsktmiddle');
+
+call datacell.receptor('datacell.bsktin','localhost',50500);
+
+call datacell.emitter('datacell.bsktout','localhost',50600);
+
+call datacell.query('datacell.pass', 'insert into datacell.bsktmiddle select *
from datacell.bsktin;');
+call datacell.query('datacell.filter', 'insert into datacell.bsktout select *
from datacell.bsktmiddle where id %2 = 0;');
+
+select * from datacell.receptors(); select * from datacell.emitters(); select
* from datacell.queries(); select * from datacell.baskets();
+
+call datacell.resume();
+
+-- externally, activate the sensor
+-- sensor --host=localhost --port=50500 --events=100 --columns=3 --delay=1
--trace
+-- externally, activate the actuator server to listen
+-- nc -l -u 50600
+
+
+-- wrapup
+call datacell.postlude();
+drop table datacell.bsktin;
+drop table datacell.bsktout;
+
diff --git a/sql/backends/monet5/datacell/datacell.c
b/sql/backends/monet5/datacell/datacell.c
--- a/sql/backends/monet5/datacell/datacell.c
+++ b/sql/backends/monet5/datacell/datacell.c
@@ -172,6 +172,12 @@ DCreceptor(Client cntxt, MalBlkPtr mb, M
}
str
+DCbasket(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci){
+ BSKTregister(cntxt, mb, stk, pci);
+ return MAL_SUCCEED;
+}
+
+str
DCemitter(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
{
int *ret = (int *) getArgReference(stk, pci, 0);
diff --git a/sql/backends/monet5/datacell/datacell.h
b/sql/backends/monet5/datacell/datacell.h
--- a/sql/backends/monet5/datacell/datacell.h
+++ b/sql/backends/monet5/datacell/datacell.h
@@ -44,6 +44,7 @@
datacell_export str DCprelude(Client cntxt, MalBlkPtr mb, MalStkPtr stk,
InstrPtr pci);
datacell_export str DCinitialize(Client cntxt, MalBlkPtr mb, MalStkPtr stk,
InstrPtr pci);
+datacell_export str DCbasket(Client cntxt, MalBlkPtr mb, MalStkPtr stk,
InstrPtr pci);
datacell_export str DCreceptor(Client cntxt, MalBlkPtr mb, MalStkPtr stk,
InstrPtr pci);
datacell_export str DCemitter(Client cntxt, MalBlkPtr mb, MalStkPtr stk,
InstrPtr pci);
datacell_export str DCpauseObject(Client cntxt, MalBlkPtr mb, MalStkPtr stk,
InstrPtr pci);
diff --git a/sql/backends/monet5/datacell/datacell.mal
b/sql/backends/monet5/datacell/datacell.mal
--- a/sql/backends/monet5/datacell/datacell.mal
+++ b/sql/backends/monet5/datacell/datacell.mal
@@ -17,6 +17,10 @@
module datacell;
+pattern basket(tbl:str)
+address DCbasket
+comment "Define a basket table.";
+
pattern emitter(tbl:str, host:str, port:int)
address DCemitter
comment "Define a emitter based on a basket table.";
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list