Changeset: c6964911bccb for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c6964911bccb Added Files: sql/backends/monet5/Tests/cfunction01.sql Modified Files: sql/backends/monet5/Tests/All sql/backends/monet5/Tests/cfunction00.sql Branch: trails Log Message:
Added the continuous functions diffs (100 lines): diff --git a/sql/backends/monet5/Tests/All b/sql/backends/monet5/Tests/All --- a/sql/backends/monet5/Tests/All +++ b/sql/backends/monet5/Tests/All @@ -100,3 +100,5 @@ cqstream02 cqstream03 cqstream08 +cfunction00 +cfunction01 diff --git a/sql/backends/monet5/Tests/cfunction00.sql b/sql/backends/monet5/Tests/cfunction00.sql --- a/sql/backends/monet5/Tests/cfunction00.sql +++ b/sql/backends/monet5/Tests/cfunction00.sql @@ -1,4 +1,4 @@ -create function myaggr() +create function aggr00() returns integer begin declare s int; @@ -10,18 +10,18 @@ begin end while; return s; END; -select * from functions where name ='myaggr'; +select * from functions where name ='aggr00'; -- a continuous procedure can be called like any other procedure -start continuous myaggr(); +start continuous aggr00(); -select myaggr(); #should return 1 -select myaggr(); #should return 2 +select aggr00(); #should return 1 +select aggr00(); #should return 2 -drop function myproc; +drop function aggr00; ---factory factories.myaggr():int; #[0] (0) 0 ---#function user.myaggr():int; #[0] (0) 0 +--factory factories.aggr00():int; #[0] (0) 0 +--#function user.aggr00():int; #[0] (0) 0 -- As := nil:int; #[1] (0) 2 <- 3 -- As := 0:int; #[2] (0) 2 <- 5 --barrier X_8 := true; #[3] (0) 8 <- 7 @@ -31,9 +31,9 @@ drop function myproc; -- X_16:lng := calc.+(X_13, 1:lng); #[7] (0) CMDvarADDsignal 16 <- 13 15 -- X_17 := calc.int(X_16); #[8] (0) CMDvarCONVERT 17 <- 16 -- As := X_17; #[9] (0) 2 <- 17 --- yield myaggr:int := As; --- # return myaggr:int := As; #[10] (0) 0 <- 2 +-- yield aggr00:int := As; +-- # return aggr00:int := As; #[10] (0) 0 <- 2 -- redo X_8 := true; #[11] (0) 8 <- 7 --exit X_8; #[12] (0) 8 --- return myaggr:int := As; #[13] (0) 0 <- 2 ---end factories.myaggr; #[14] (0) +-- return aggr00:int := As; #[13] (0) 0 <- 2 +--end factories.aggr00; #[14] (0) diff --git a/sql/backends/monet5/Tests/cfunction01.sql b/sql/backends/monet5/Tests/cfunction01.sql new file mode 100644 --- /dev/null +++ b/sql/backends/monet5/Tests/cfunction01.sql @@ -0,0 +1,37 @@ +-- continues functions +create stream table ftmp(i integer) set window 2; + +create function aggr01() +returns integer +begin + declare s int; + set s = 0; + while (true) + do + set s = s + (select count(*) from ftmp); + yield s ; + end while; + return s; +END; +select * from functions where name ='aggr01'; + +-- a continuous function can be called used like any other function? +select aggr01(); -- causes error + +start continuous aggr01(); + +insert into ftmp values(1),(1); +select aggr01(); #should return 2 + +insert into ftmp values(2),(2); +insert into ftmp values(3),(3); + +call cquery.wait(1000); +select aggr01(); #should return 6 + +call cquery.wait(1000); +select aggr01(); #should return 6 + +stop continuous aggr01(); +drop function aggr01; +drop table ftmp; _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list