Changeset: 2f8b314a62a6 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=2f8b314a62a6 Added Files: sql/test/BugTracker-2020/Tests/functions-not-persist.Bug-6819.py sql/test/BugTracker-2020/Tests/functions-not-persist.Bug-6819.stable.err sql/test/BugTracker-2020/Tests/functions-not-persist.Bug-6819.stable.out Modified Files: sql/server/rel_psm.c sql/test/BugTracker-2020/Tests/All Branch: linear-hashing Log Message:
Merged with Nov2019 diffs (297 lines): diff --git a/sql/server/rel_psm.c b/sql/server/rel_psm.c --- a/sql/server/rel_psm.c +++ b/sql/server/rel_psm.c @@ -884,34 +884,44 @@ rel_create_func(sql_query *query, dlist return sql_error(sql, 01, SQLSTATE(42000) "CREATE %s%s: failed to get restype", KF, F); } if (body && LANG_EXT(lang)) { - char *lang_body = body->h->data.sval, *mod = NULL, *slang = NULL; + const char *lang_body = body->h->data.sval, *mod = "unknown", *slang = "Unknown"; switch (lang) { - case FUNC_LANG_R: - mod = "rapi"; - slang = "R"; - break; - case FUNC_LANG_C: - mod = "capi"; - slang = "C"; - break; - case FUNC_LANG_CPP: - mod = "capi"; - slang = "CPP"; - break; - case FUNC_LANG_J: - mod = "japi"; - slang = "Javascript"; - break; - case FUNC_LANG_PY: - mod = "pyapi"; - slang = "Python"; - break; - case FUNC_LANG_MAP_PY: - mod = "pyapimap"; - slang = "Python"; - break; - default: - assert(0); + case FUNC_LANG_R: + mod = "rapi"; + slang = "R"; + break; + case FUNC_LANG_C: + mod = "capi"; + slang = "C"; + break; + case FUNC_LANG_CPP: + mod = "capi"; + slang = "CPP"; + break; + case FUNC_LANG_J: + mod = "japi"; + slang = "Javascript"; + break; + case FUNC_LANG_PY: + case FUNC_LANG_PY2: + mod = "pyapi"; + slang = "Python"; + break; + case FUNC_LANG_MAP_PY: + case FUNC_LANG_MAP_PY2: + mod = "pyapimap"; + slang = "Python"; + break; + case FUNC_LANG_PY3: + mod = "pyapi3"; + slang = "Python"; + break; + case FUNC_LANG_MAP_PY3: + mod = "pyapi3map"; + slang = "Python"; + break; + default: + assert(0); } sql->params = NULL; if (create) { diff --git a/sql/test/BugTracker-2020/Tests/All b/sql/test/BugTracker-2020/Tests/All --- a/sql/test/BugTracker-2020/Tests/All +++ b/sql/test/BugTracker-2020/Tests/All @@ -3,3 +3,4 @@ ifthenelse-crash.Bug-6815 alter-table-add-column.Bug-6816 analyze-stream-table.Bug-6817 select-where-in-rtrim-crash.Bug-6818 +NOT_WIN32&HAVE_LIBR&HAVE_LIBPY3?functions-not-persist.Bug-6819 diff --git a/sql/test/BugTracker-2020/Tests/functions-not-persist.Bug-6819.py b/sql/test/BugTracker-2020/Tests/functions-not-persist.Bug-6819.py new file mode 100644 --- /dev/null +++ b/sql/test/BugTracker-2020/Tests/functions-not-persist.Bug-6819.py @@ -0,0 +1,54 @@ +import sys + +try: + from MonetDBtesting import process +except ImportError: + import process + + +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) + +def server_stop(s): + out, err = s.communicate() + sys.stdout.write(out) + sys.stderr.write(err) + +create = '''\ +CREATE FUNCTION myfunc1(input1 INT, input2 INT) RETURNS INT BEGIN RETURN input1 + input2; END;\ +CREATE FUNCTION myfunc2(input1 INT, input2 INT) RETURNS INT LANGUAGE PYTHON {return (input1 + input2)};\ +CREATE FUNCTION myfunc3(input1 INT, input2 INT) RETURNS INT LANGUAGE PYTHON_MAP {return (input1 + input2)};\ +CREATE FUNCTION myfunc4(input1 INT, input2 INT) RETURNS INT LANGUAGE PYTHON3 {return (input1 + input2)};\ +CREATE FUNCTION myfunc5(input1 INT, input2 INT) RETURNS INT LANGUAGE PYTHON3_MAP {return (input1 + input2)};\ +CREATE FUNCTION myfunc6(input1 INT, input2 INT) RETURNS INT LANGUAGE R {return (input1 + input2)};\ +CREATE FUNCTION myfunc7(input1 INT, input2 INT) RETURNS INTEGER LANGUAGE C {\ + result->initialize(result, input1.count);\ + for(size_t i = 0; i < input1.count; i++) {\ + result->data[i] = input1.data[i] + input2.data[i];\ + }\ +}; +''' +run = 'SELECT CAST(myfunc1(1, 1) + myfunc2(1, 1) + myfunc3(1, 1) + myfunc4(1, 1) + myfunc5(1, 1) + myfunc6(1, 1) + myfunc7(1, 1) AS BIGINT);' + +drop = ''' +DROP FUNCTION myfunc1;\ +DROP FUNCTION myfunc2;\ +DROP FUNCTION myfunc3;\ +DROP FUNCTION myfunc4;\ +DROP FUNCTION myfunc5;\ +DROP FUNCTION myfunc6;\ +DROP FUNCTION myfunc7; +''' + +server_args = ['--set', 'embedded_py=3', '--set', 'embedded_r=true', '--set', 'embedded_c=true'] + +s = process.server(args = server_args, stdin = process.PIPE, stdout = process.PIPE, stderr = process.PIPE) +client(create + run) +server_stop(s) + +s = process.server(args = server_args, stdin = process.PIPE, stdout = process.PIPE, stderr = process.PIPE) +client(run + drop) +server_stop(s) diff --git a/sql/test/BugTracker-2020/Tests/functions-not-persist.Bug-6819.stable.err b/sql/test/BugTracker-2020/Tests/functions-not-persist.Bug-6819.stable.err new file mode 100644 --- /dev/null +++ b/sql/test/BugTracker-2020/Tests/functions-not-persist.Bug-6819.stable.err @@ -0,0 +1,42 @@ +stderr of test 'functions-not-persist.Bug-6819` in directory 'sql/test/BugTracker-2020` itself: + + +# 09:06:57 > +# 09:06:57 > "/usr/bin/python3" "functions-not-persist.Bug-6819.py" "functions-not-persist.Bug-6819" +# 09:06:57 > + +# builtin opt gdk_dbpath = /home/ferreira/repositories/MonetDB-Nov2019/BUILD/var/monetdb5/dbfarm/demo +# builtin opt mapi_port = 50000 +# builtin opt mapi_open = false +# builtin opt mapi_ipv6 = 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 = 32197 +# cmdline opt mapi_usock = /var/tmp/mtest-11769/.s.monetdb.32197 +# cmdline opt gdk_dbpath = /home/ferreira/repositories/MonetDB-Nov2019/BUILD/var/MonetDB/mTests_sql_test_BugTracker-2020 +# cmdline opt embedded_py = 3 +# cmdline opt embedded_r = true +# cmdline opt embedded_c = true +# builtin opt gdk_dbpath = /home/ferreira/repositories/MonetDB-Nov2019/BUILD/var/monetdb5/dbfarm/demo +# builtin opt mapi_port = 50000 +# builtin opt mapi_open = false +# builtin opt mapi_ipv6 = 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 = 32197 +# cmdline opt mapi_usock = /var/tmp/mtest-11769/.s.monetdb.32197 +# cmdline opt gdk_dbpath = /home/ferreira/repositories/MonetDB-Nov2019/BUILD/var/MonetDB/mTests_sql_test_BugTracker-2020 +# cmdline opt embedded_py = 3 +# cmdline opt embedded_r = true +# cmdline opt embedded_c = true + +# 09:06:59 > +# 09:06:59 > "Done." +# 09:06:59 > + diff --git a/sql/test/BugTracker-2020/Tests/functions-not-persist.Bug-6819.stable.out b/sql/test/BugTracker-2020/Tests/functions-not-persist.Bug-6819.stable.out new file mode 100644 --- /dev/null +++ b/sql/test/BugTracker-2020/Tests/functions-not-persist.Bug-6819.stable.out @@ -0,0 +1,103 @@ +stdout of test 'functions-not-persist.Bug-6819` in directory 'sql/test/BugTracker-2020` itself: + + +# 09:06:57 > +# 09:06:57 > "/usr/bin/python3" "functions-not-persist.Bug-6819.py" "functions-not-persist.Bug-6819" +# 09:06:57 > + +#CREATE FUNCTION myfunc1(input1 INT, input2 INT) RETURNS INT BEGIN RETURN input1 + input2; END;CREATE FUNCTION myfunc2(input1 INT, input2 INT) RETURNS INT LANGUAGE P {return (input1 + input2)};CREATE FUNCTION myfunc3(input1 INT, input2 INT) RETURNS INT LANGUAGE R {return (input1 + input2)};CREATE FUNCTION myfunc4(input1 INT, input2 INT) RETURNS INTEGER LANGUAGE C { result->initialize(result, input1.count); for(size_t i = 0; i < input1.count; i++) { result->data[i] = input1.data[i] + input2.data[i]; }}; +#CREATE FUNCTION myfunc1(input1 INT, input2 INT) RETURNS INT BEGIN RETURN input1 + input2; END;CREATE FUNCTION myfunc2(input1 INT, input2 INT) RETURNS INT LANGUAGE P {return (input1 + input2)};CREATE FUNCTION myfunc3(input1 INT, input2 INT) RETURNS INT LANGUAGE R {return (input1 + input2)};CREATE FUNCTION myfunc4(input1 INT, input2 INT) RETURNS INTEGER LANGUAGE C { result->initialize(result, input1.count); for(size_t i = 0; i < input1.count; i++) { result->data[i] = input1.data[i] + input2.data[i]; }}; +#CREATE FUNCTION myfunc1(input1 INT, input2 INT) RETURNS INT BEGIN RETURN input1 + input2; END;CREATE FUNCTION myfunc2(input1 INT, input2 INT) RETURNS INT LANGUAGE P {return (input1 + input2)};CREATE FUNCTION myfunc3(input1 INT, input2 INT) RETURNS INT LANGUAGE R {return (input1 + input2)};CREATE FUNCTION myfunc4(input1 INT, input2 INT) RETURNS INTEGER LANGUAGE C { result->initialize(result, input1.count); for(size_t i = 0; i < input1.count; i++) { result->data[i] = input1.data[i] + input2.data[i]; }}; +#CREATE FUNCTION myfunc1(input1 INT, input2 INT) RETURNS INT BEGIN RETURN input1 + input2; END;CREATE FUNCTION myfunc2(input1 INT, input2 INT) RETURNS INT LANGUAGE P {return (input1 + input2)};CREATE FUNCTION myfunc3(input1 INT, input2 INT) RETURNS INT LANGUAGE R {return (input1 + input2)};CREATE FUNCTION myfunc4(input1 INT, input2 INT) RETURNS INTEGER LANGUAGE C { result->initialize(result, input1.count); for(size_t i = 0; i < input1.count; i++) { result->data[i] = input1.data[i] + input2.data[i]; }}; +#SELECT CAST(myfunc1(1, 1) + myfunc2(1, 1) + myfunc3(1, 1) + myfunc4(1, 1) AS BIGINT); +% .L2 # table_name +% L2 # name +% bigint # type +% 2 # length +[ 14 ] +# MonetDB 5 server v11.35.10 (hg id: f9ad2ccd83b7) +# This is an unreleased version +# Serving database 'mTests_sql_test_BugTracker-2020', using 8 threads +# Compiled for x86_64-pc-linux-gnu/64bit with 128bit integers +# Found 15.496 GiB available main-memory of which we use 12.630 GiB +# Copyright (c) 1993 - July 2008 CWI. +# Copyright (c) August 2008 - 2020 MonetDB B.V., all rights reserved +# Visit https://www.monetdb.org/ for further information +# Listening for connection requests on mapi:monetdb://localhost.localdomain:32197/ +# Listening for UNIX domain connection requests on mapi:monetdb:///var/tmp/mtest-11769/.s.monetdb.32197 +# MonetDB/GIS module loaded +# SQL catalog created, loading sql scripts once +# loading sql script: 09_like.sql +# loading sql script: 10_math.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_views.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: 51_sys_schema_extension.sql +# loading sql script: 60_wlcr.sql +# loading sql script: 61_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 +# MonetDB/SQL module loaded +# MonetDB/Python3 module loaded +# MonetDB/R module loaded +#SELECT CAST(myfunc1(1, 1) + myfunc2(1, 1) + myfunc3(1, 1) + myfunc4(1, 1) AS BIGINT); +% .L2 # table_name +% L2 # name +% bigint # type +% 2 # length +[ 14 ] +#DROP FUNCTION myfunc1;DROP FUNCTION myfunc2;DROP FUNCTION myfunc3;DROP FUNCTION myfunc4;DROP FUNCTION myfunc5;DROP FUNCTION myfunc6;DROP FUNCTION myfunc7; +#DROP FUNCTION myfunc1;DROP FUNCTION myfunc2;DROP FUNCTION myfunc3;DROP FUNCTION myfunc4;DROP FUNCTION myfunc5;DROP FUNCTION myfunc6;DROP FUNCTION myfunc7; +#DROP FUNCTION myfunc1;DROP FUNCTION myfunc2;DROP FUNCTION myfunc3;DROP FUNCTION myfunc4;DROP FUNCTION myfunc5;DROP FUNCTION myfunc6;DROP FUNCTION myfunc7; +#DROP FUNCTION myfunc1;DROP FUNCTION myfunc2;DROP FUNCTION myfunc3;DROP FUNCTION myfunc4;DROP FUNCTION myfunc5;DROP FUNCTION myfunc6;DROP FUNCTION myfunc7; +#DROP FUNCTION myfunc1;DROP FUNCTION myfunc2;DROP FUNCTION myfunc3;DROP FUNCTION myfunc4;DROP FUNCTION myfunc5;DROP FUNCTION myfunc6;DROP FUNCTION myfunc7; +#DROP FUNCTION myfunc1;DROP FUNCTION myfunc2;DROP FUNCTION myfunc3;DROP FUNCTION myfunc4;DROP FUNCTION myfunc5;DROP FUNCTION myfunc6;DROP FUNCTION myfunc7; +#DROP FUNCTION myfunc1;DROP FUNCTION myfunc2;DROP FUNCTION myfunc3;DROP FUNCTION myfunc4;DROP FUNCTION myfunc5;DROP FUNCTION myfunc6;DROP FUNCTION myfunc7; +# MonetDB 5 server v11.35.10 (hg id: f9ad2ccd83b7) +# This is an unreleased version +# Serving database 'mTests_sql_test_BugTracker-2020', using 8 threads +# Compiled for x86_64-pc-linux-gnu/64bit with 128bit integers +# Found 15.496 GiB available main-memory of which we use 12.630 GiB +# Copyright (c) 1993 - July 2008 CWI. +# Copyright (c) August 2008 - 2020 MonetDB B.V., all rights reserved +# Visit https://www.monetdb.org/ for further information +# Listening for connection requests on mapi:monetdb://localhost.localdomain:32197/ +# Listening for UNIX domain connection requests on mapi:monetdb:///var/tmp/mtest-11769/.s.monetdb.32197 +# MonetDB/GIS module loaded +# MonetDB/SQL module loaded +# MonetDB/Python3 module loaded +# MonetDB/R module loaded + +# 09:06:59 > +# 09:06:59 > "Done." +# 09:06:59 > + _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list