Changeset: 1a922c962466 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=1a922c962466
Added Files:
        sql/backends/monet5/Tests/pyapi33.sql
        sql/backends/monet5/Tests/pyapi33.stable.err
        sql/backends/monet5/Tests/pyapi33.stable.out
Modified Files:
        gdk/gdk_storage.c
        sql/backends/monet5/Tests/All
        sql/backends/monet5/UDF/pyapi/pyapi.c
        sql/server/rel_select.c
        tools/merovingian/daemon/controlrunner.c
Branch: default
Log Message:

Merge with Dec2016 branch.


diffs (250 lines):

diff --git a/gdk/gdk_storage.c b/gdk/gdk_storage.c
--- a/gdk/gdk_storage.c
+++ b/gdk/gdk_storage.c
@@ -637,6 +637,7 @@ DESCclean(BAT *b)
 #define MSYNC_BACKGROUND
 
 #ifndef DISABLE_MSYNC
+#ifndef MS_ASYNC
 struct msync {
        bat id;
        Heap *h;
@@ -646,26 +647,24 @@ static void
 BATmsyncImplementation(void *arg)
 {
        Heap *h = ((struct msync *) arg)->h;
-       char *adr;
-       size_t len;
-       size_t offset;
 
-       adr = h->base;
-       offset = ((size_t) adr % MT_pagesize());
-       len = MT_pagesize() * (1 + ((h->base + h->free - adr) / MT_pagesize()));
-       if (offset)
-               adr -= MT_pagesize() - offset;
-       if (len)
-               (void) MT_msync(adr, len);
+       (void) MT_msync(h->base, h->size);
        BBPunfix(((struct msync *) arg)->id);
        GDKfree(arg);
 }
 #endif
+#endif
 
 void
 BATmsync(BAT *b)
 {
 #ifndef DISABLE_MSYNC
+#ifdef MS_ASYNC
+       if (b->theap.storage == STORE_MMAP)
+               (void) msync(b->theap.base, b->theap.free, MS_ASYNC);
+       if (b->tvheap && b->tvheap->storage == STORE_MMAP)
+               (void) msync(b->tvheap->base, b->tvheap->free, MS_ASYNC);
+#else
 #ifdef MSYNC_BACKGROUND
        MT_Id tid;
 #endif
@@ -703,6 +702,7 @@ BATmsync(BAT *b)
                BATmsyncImplementation(arg);
 #endif
        }
+#endif
 #else
        (void) b;
 #endif /* DISABLE_MSYNC */
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
@@ -52,6 +52,7 @@ HAVE_LIBPY?pyapi28
 HAVE_LIBPY?pyapi29
 HAVE_LIBPY?pyapi30
 HAVE_LIBPY?pyapi32
+HAVE_LIBPY?pyapi33
 
 HAVE_LIBPY?pyloader01
 HAVE_LIBPY?pyloader02
diff --git a/sql/backends/monet5/Tests/pyapi33.sql 
b/sql/backends/monet5/Tests/pyapi33.sql
new file mode 100644
--- /dev/null
+++ b/sql/backends/monet5/Tests/pyapi33.sql
@@ -0,0 +1,8 @@
+
+START TRANSACTION;
+
+CREATE FUNCTION pyapi33() RETURNS STRING LANGUAGE PYTHON { return 'hello'; };
+
+SELECT pyapi33();
+
+ROLLBACK;
diff --git a/sql/backends/monet5/Tests/pyapi33.stable.err 
b/sql/backends/monet5/Tests/pyapi33.stable.err
new file mode 100644
--- /dev/null
+++ b/sql/backends/monet5/Tests/pyapi33.stable.err
@@ -0,0 +1,35 @@
+stderr of test 'pyapi33` in directory 'sql/backends/monet5` itself:
+
+
+# 14:44:15 >  
+# 14:44:15 >  "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" 
"mapi_open=true" "--set" "mapi_port=34589" "--set" 
"mapi_usock=/var/tmp/mtest-6105/.s.monetdb.34589" "--set" "monet_prompt=" 
"--forcemito" "--dbpath=/Users/myth/opt/var/MonetDB/mTests_sql_backends_monet5" 
"--set" "embedded_py=true"
+# 14:44:15 >  
+
+# builtin opt  gdk_dbpath = /Users/myth/opt/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 = 34589
+# cmdline opt  mapi_usock = /var/tmp/mtest-6105/.s.monetdb.34589
+# cmdline opt  monet_prompt = 
+# cmdline opt  gdk_dbpath = 
/Users/myth/opt/var/MonetDB/mTests_sql_backends_monet5
+# cmdline opt  embedded_py = true
+# cmdline opt  gdk_debug = 536870922
+
+# 14:44:15 >  
+# 14:44:15 >  "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e" 
"--host=/var/tmp/mtest-6105" "--port=34589"
+# 14:44:15 >  
+
+
+# 14:44:16 >  
+# 14:44:16 >  "Done."
+# 14:44:16 >  
+
diff --git a/sql/backends/monet5/Tests/pyapi33.stable.out 
b/sql/backends/monet5/Tests/pyapi33.stable.out
new file mode 100644
--- /dev/null
+++ b/sql/backends/monet5/Tests/pyapi33.stable.out
@@ -0,0 +1,75 @@
+stdout of test 'pyapi33` in directory 'sql/backends/monet5` itself:
+
+
+# 14:44:15 >  
+# 14:44:15 >  "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" 
"mapi_open=true" "--set" "mapi_port=34589" "--set" 
"mapi_usock=/var/tmp/mtest-6105/.s.monetdb.34589" "--set" "monet_prompt=" 
"--forcemito" "--dbpath=/Users/myth/opt/var/MonetDB/mTests_sql_backends_monet5" 
"--set" "embedded_py=true"
+# 14:44:15 >  
+
+# MonetDB 5 server v11.25.6
+# This is an unreleased version
+# Serving database 'mTests_sql_backends_monet5', using 4 threads
+# Compiled for x86_64-apple-darwin15.6.0/64bit with 128bit integers
+# Found 8.000 GiB available main-memory.
+# Copyright (c) 1993-July 2008 CWI.
+# Copyright (c) August 2008-2017 MonetDB B.V., all rights reserved
+# Visit http://www.monetdb.org/ for further information
+# Listening for connection requests on 
mapi:monetdb://dhcp-46.eduroam.cwi.nl:34589/
+# Listening for UNIX domain connection requests on 
mapi:monetdb:///var/tmp/mtest-6105/.s.monetdb.34589
+# MonetDB/SQL module loaded
+# MonetDB/Python 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_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: 72_fits.sql
+# loading sql script: 74_netcdf.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: 90_generator.sql
+# loading sql script: 90_generator_hge.sql
+# loading sql script: 99_system.sql
+
+# 14:44:15 >  
+# 14:44:15 >  "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e" 
"--host=/var/tmp/mtest-6105" "--port=34589"
+# 14:44:15 >  
+
+#START TRANSACTION;
+#CREATE FUNCTION pyapi33() RETURNS STRING LANGUAGE PYTHON { return 'hello'; };
+#SELECT pyapi33();
+% .L2 # table_name
+% L2 # name
+% clob # type
+% 5 # length
+[ "hello"      ]
+#ROLLBACK;
+
+# 14:44:16 >  
+# 14:44:16 >  "Done."
+# 14:44:16 >  
+
diff --git a/sql/backends/monet5/UDF/pyapi/pyapi.c 
b/sql/backends/monet5/UDF/pyapi/pyapi.c
--- a/sql/backends/monet5/UDF/pyapi/pyapi.c
+++ b/sql/backends/monet5/UDF/pyapi/pyapi.c
@@ -1119,15 +1119,19 @@ returnvalues:
         }
 
         msg = MAL_SUCCEED;
-        if (isaBatType(getArgType(mb,pci,i)))
-        {
+        if (isaBatType(getArgType(mb,pci,i))) {
             *getArgReference_bat(stk, pci, i) = b->batCacheid;
             BBPkeepref(b->batCacheid);
         }
-        else
-        { // single value return, only for non-grouped aggregations
-            if (VALinit(&stk->stk[pci->argv[i]], bat_type, Tloc(b, 0)) == NULL)
-                msg = createException(MAL, "pyapi.eval", MAL_MALLOC_FAIL);
+        else { // single value return, only for non-grouped aggregations
+            if (bat_type != TYPE_str) {
+                if (VALinit(&stk->stk[pci->argv[i]], bat_type, Tloc(b, 0)) == 
NULL)
+                    msg = createException(MAL, "pyapi.eval", MAL_MALLOC_FAIL);
+            } else {
+                BATiter li = bat_iterator(b);
+                if (VALinit(&stk->stk[pci->argv[i]], bat_type, BUNtail(li, 0)) 
== NULL)
+                    msg = createException(MAL, "pyapi.eval", MAL_MALLOC_FAIL);
+            }
         }
         if (argnode) {
             argnode = argnode->next;
diff --git a/sql/server/rel_select.c b/sql/server/rel_select.c
--- a/sql/server/rel_select.c
+++ b/sql/server/rel_select.c
@@ -4664,6 +4664,8 @@ rel_select_exp(mvc *sql, sql_rel *rel, S
                        rel = rel_groupby(sql, rel, gbe);
                        aggr = 1;
                }
+               if (!sn->having)
+                       set_processed(rel);
        }
 
        if (sn->having) {
diff --git a/tools/merovingian/daemon/controlrunner.c 
b/tools/merovingian/daemon/controlrunner.c
--- a/tools/merovingian/daemon/controlrunner.c
+++ b/tools/merovingian/daemon/controlrunner.c
@@ -413,6 +413,7 @@ static void ctl_handle_client(
                                                        free(sadbfarm);
                                                        setlen = 
mo_add_option(&set, setlen, opt_cmdline, "gdk_dbpath", buf2);
                                                        setlen = 
mo_system_config(&set, setlen);
+                                                       BBPaddfarm(buf2, (1 << 
PERSISTENT) | (1 << TRANSIENT));
                                                        /* the child, pollute 
scope by loading BBP */
                                                        if (chdir(q) < 0) {
                                                                /* Fabian says 
"Ignore the output.
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to