Changeset: 351635b8d026 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=351635b8d026
Added Files:
        sql/backends/monet5/Tests/cquery19.sql
        sql/backends/monet5/Tests/cquery19.stable.err
        sql/backends/monet5/Tests/cquery19.stable.out
        sql/backends/monet5/Tests/cquery20.py
Modified Files:
        sql/backends/monet5/Tests/All
        sql/backends/monet5/sql_cquery.c
        sql/include/sql_catalog.h
        sql/server/rel_psm.c
        sql/server/rel_schema.c
        sql/server/sql_mvc.c
        sql/server/sql_mvc.h
        sql/server/sql_parser.y
        sql/storage/sql_storage.h
        sql/storage/store.c
Branch: trails
Log Message:

Temporary stream tables.


diffs (truncated from 1209 to 300 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
@@ -104,6 +104,8 @@ cquery15
 cquery16
 cquery17
 cquery18
+cquery19
+cquery20
 
 cqstream00
 cqstream01
diff --git a/sql/backends/monet5/Tests/cquery19.sql 
b/sql/backends/monet5/Tests/cquery19.sql
new file mode 100644
--- /dev/null
+++ b/sql/backends/monet5/Tests/cquery19.sql
@@ -0,0 +1,46 @@
+--test CQs with temporary stream tables
+create temporary stream table testing19 (aa int, b clob) set window 1;
+create table results19(aaa int);
+
+create procedure cq_query19a()
+begin
+       insert into results19 (select count(aa) from testing19);
+end;
+
+create procedure cq_query19b()
+begin
+       insert into results19 (select sum(aa) from testing19);
+end;
+
+start continuous procedure cq_query19a() with cycles 1;
+
+insert into testing19 values (1, '1');
+
+call cquery.wait(1000);
+
+select aaa from results19; --output 1
+
+alter stream table testing19 set window 2;
+
+insert into testing19 values (2, '2'), (3, '3'), (4, '4');
+
+call cquery.wait(1000);
+
+select aaa from results19; --output 1
+
+start continuous procedure cq_query19b() with cycles 2;
+
+call cquery.wait(1000);
+
+select aaa from results19; --output 1, 5
+
+insert into testing19 values (5, '5');
+
+call cquery.wait(1000);
+
+select aaa from results19; --output 1, 5, 9
+
+drop procedure cq_query19a;
+drop procedure cq_query19b;
+drop table testing19;
+drop table results19;
diff --git a/sql/backends/monet5/Tests/cquery19.stable.err 
b/sql/backends/monet5/Tests/cquery19.stable.err
new file mode 100644
--- /dev/null
+++ b/sql/backends/monet5/Tests/cquery19.stable.err
@@ -0,0 +1,34 @@
+stderr of test 'cquery19` in directory 'sql/backends/monet5` itself:
+
+
+# 16:20:37 >  
+# 16:20:37 >  "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" 
"mapi_open=true" "--set" "mapi_port=31249" "--set" 
"mapi_usock=/var/tmp/mtest-17272/.s.monetdb.31249" "--set" "monet_prompt=" 
"--forcemito" 
"--dbpath=/home/ferreira/MonetDB-trails/BUILD/var/MonetDB/mTests_sql_backends_monet5"
+# 16:20:37 >  
+
+# builtin opt  gdk_dbpath = 
/home/ferreira/MonetDB-trails/BUILD/var/monetdb5/dbfarm/demo
+# builtin opt  gdk_debug = 0
+# builtin opt  gdk_vmtrim = no
+# builtin opt  monet_prompt = >
+# builtin opt  monet_daemon = no
+# builtin opt  mapi_port = 50000
+# builtin opt  mapi_open = false
+# builtin opt  mapi_autosense = false
+# builtin opt  sql_optimizer = default_pipe
+# builtin opt  sql_debug = 0
+# cmdline opt  gdk_nr_threads = 0
+# cmdline opt  mapi_open = true
+# cmdline opt  mapi_port = 31249
+# cmdline opt  mapi_usock = /var/tmp/mtest-17272/.s.monetdb.31249
+# cmdline opt  monet_prompt = 
+# cmdline opt  gdk_dbpath = 
/home/ferreira/MonetDB-trails/BUILD/var/MonetDB/mTests_sql_backends_monet5
+# cmdline opt  gdk_debug = 536870922
+
+# 16:20:37 >  
+# 16:20:37 >  "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e" 
"--host=/var/tmp/mtest-17272" "--port=31249"
+# 16:20:37 >  
+
+
+# 16:20:42 >  
+# 16:20:42 >  "Done."
+# 16:20:42 >  
+
diff --git a/sql/backends/monet5/Tests/cquery19.stable.out 
b/sql/backends/monet5/Tests/cquery19.stable.out
new file mode 100644
--- /dev/null
+++ b/sql/backends/monet5/Tests/cquery19.stable.out
@@ -0,0 +1,123 @@
+stdout of test 'cquery19` in directory 'sql/backends/monet5` itself:
+
+
+# 16:20:37 >  
+# 16:20:37 >  "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" 
"mapi_open=true" "--set" "mapi_port=31249" "--set" 
"mapi_usock=/var/tmp/mtest-17272/.s.monetdb.31249" "--set" "monet_prompt=" 
"--forcemito" 
"--dbpath=/home/ferreira/MonetDB-trails/BUILD/var/MonetDB/mTests_sql_backends_monet5"
+# 16:20:37 >  
+
+# MonetDB 5 server v11.28.0
+# This is an unreleased version
+# Serving database 'mTests_sql_backends_monet5', using 8 threads
+# Compiled for x86_64-pc-linux-gnu/64bit with 128bit integers
+# Found 15.498 GiB available main-memory.
+# Copyright (c) 1993-July 2008 CWI.
+# Copyright (c) August 2008-2017 MonetDB B.V., all rights reserved
+# Visit https://www.monetdb.org/ for further information
+# Listening for connection requests on 
mapi:monetdb://dhcp-120.eduroam.cwi.nl:31249/
+# Listening for UNIX domain connection requests on 
mapi:monetdb:///var/tmp/mtest-17272/.s.monetdb.31249
+# MonetDB/GIS module loaded
+# MonetDB/SQL module loaded
+# MonetDB/Timetrails module loaded
+
+Ready.
+# SQL catalog created, loading sql scripts once
+# loading sql script: 09_like.sql
+# loading sql script: 10_math.sql
+# loading sql script: 11_times.sql
+# loading sql script: 12_url.sql
+# loading sql script: 13_date.sql
+# loading sql script: 14_inet.sql
+# loading sql script: 15_querylog.sql
+# loading sql script: 16_tracelog.sql
+# loading sql script: 17_temporal.sql
+# loading sql script: 18_index.sql
+# loading sql script: 20_vacuum.sql
+# loading sql script: 21_dependency_functions.sql
+# loading sql script: 22_clients.sql
+# loading sql script: 23_skyserver.sql
+# loading sql script: 25_debug.sql
+# loading sql script: 26_sysmon.sql
+# loading sql script: 27_rejects.sql
+# loading sql script: 39_analytics.sql
+# loading sql script: 39_analytics_hge.sql
+# loading sql script: 40_geom.sql
+# loading sql script: 40_json.sql
+# loading sql script: 40_json_hge.sql
+# loading sql script: 41_md5sum.sql
+# loading sql script: 45_uuid.sql
+# loading sql script: 46_profiler.sql
+# loading sql script: 50_cquery.sql
+# loading sql script: 51_sys_schema_extension.sql
+# loading sql script: 60_wlcr.sql
+# loading sql script: 72_fits.sql
+# loading sql script: 74_netcdf.sql
+# loading sql script: 75_lidar.sql
+# loading sql script: 75_shp.sql
+# loading sql script: 75_storagemodel.sql
+# loading sql script: 80_statistics.sql
+# loading sql script: 80_udf.sql
+# loading sql script: 80_udf_hge.sql
+# loading sql script: 85_bam.sql
+# loading sql script: 90_generator.sql
+# loading sql script: 90_generator_hge.sql
+# loading sql script: 99_system.sql
+
+# 16:20:37 >  
+# 16:20:37 >  "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e" 
"--host=/var/tmp/mtest-17272" "--port=31249"
+# 16:20:37 >  
+
+#create temporary stream table testing19 (aa int, b clob) set window 1;
+#create table results19(aaa int);
+#create procedure cq_query19a()
+#begin
+#      insert into results19 (select count(aa) from testing19);
+#end;
+#create procedure cq_query19b()
+#begin
+#      insert into results19 (select sum(aa) from testing19);
+#end;
+#start continuous procedure cq_query19a() with cycles 1;
+#insert into testing19 values (1, '1');
+[ 1    ]
+#select aaa from results19; --output 1
+% sys.results19 # table_name
+% aaa # name
+% int # type
+% 1 # length
+[ 1    ]
+#alter stream table testing19 set window 2;
+#insert into testing19 values (2, '2'), (3, '3'), (4, '4');
+[ 3    ]
+#select aaa from results19; --output 1
+% sys.results19 # table_name
+% aaa # name
+% int # type
+% 1 # length
+[ 1    ]
+#start continuous procedure cq_query19b() with cycles 2;
+#select aaa from results19; --output 1, 5
+% sys.results19 # table_name
+% aaa # name
+% int # type
+% 1 # length
+[ 1    ]
+[ 5    ]
+#insert into testing19 values (5, '5');
+[ 1    ]
+#select aaa from results19; --output 1, 5, 9
+% sys.results19 # table_name
+% aaa # name
+% int # type
+% 1 # length
+[ 1    ]
+[ 5    ]
+[ 9    ]
+#drop procedure cq_query19a;
+#drop procedure cq_query19b;
+#drop table testing19;
+#drop table results19;
+
+# 16:20:42 >  
+# 16:20:42 >  "Done."
+# 16:20:42 >  
+
diff --git a/sql/backends/monet5/Tests/cquery20.py 
b/sql/backends/monet5/Tests/cquery20.py
new file mode 100644
--- /dev/null
+++ b/sql/backends/monet5/Tests/cquery20.py
@@ -0,0 +1,49 @@
+import sys
+
+try:
+    from MonetDBtesting import process
+except ImportError:
+    import process
+
+def server_stop(s):
+    out, err = s.communicate()
+    sys.stdout.write(out)
+    sys.stderr.write(err)
+
+def client(input):
+    c = process.client('sql', stdin = process.PIPE, stdout = process.PIPE, 
stderr = process.PIPE)
+    out, err = c.communicate(input)
+    sys.stdout.write(out)
+    sys.stderr.write(err)
+
+script1 = '''\
+create temporary stream table sta (a int);
+'''
+
+script2 = '''\
+create stream table stb (a int);
+'''
+
+script3 = '''\
+select count(*) from streams;
+'''
+
+script4 = '''\
+drop table stb;
+'''
+
+def main():
+    s = process.server(args = [], stdin = process.PIPE, stdout = process.PIPE, 
stderr = process.PIPE)
+    client(script1)
+    client(script3)
+    client(script2)
+    client(script3)
+    server_stop(s)
+    s = process.server(args = [], stdin = process.PIPE, stdout = process.PIPE, 
stderr = process.PIPE)
+    client(script3)
+    client(script4)
+    client(script3)
+    server_stop(s)
+
+if __name__ == '__main__':
+    main()
diff --git a/sql/backends/monet5/sql_cquery.c b/sql/backends/monet5/sql_cquery.c
--- a/sql/backends/monet5/sql_cquery.c
+++ b/sql/backends/monet5/sql_cquery.c
@@ -47,6 +47,7 @@
 #include "sql_gencode.h"
 #include "sql_cquery.h"
 #include "sql_basket.h"
+#include "sql_execute.h"
 #include "mal_builder.h"
 #include "opt_prelude.h"
 #include "mtime.h"
@@ -68,6 +69,8 @@ static BAT *CQ_id_error = 0;
 static CQnode *pnet = 0;
 static int pnetLimit = 0, pnettop = 0;
 
+#define CQ_SQL_QUERY_SIZE  1024
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to