MonetDB: gdk-tracer - Merge branch 'branches/default' into branc...

2019-11-21 Thread Thodoris Zois
Changeset: 41792ef57001 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=41792ef57001
Added Files:
MonetDB5/NT/M5server.bat
Modified Files:
MonetDB5/mal/mal.c
MonetDB5/mal/mal.h
MonetDB5/optimizer/opt_mitosis.c
clients/NT/mclient.bat
clients/NT/msqldump.bat
clients/NT/stethoscope.bat
clients/Tests/exports.stable.out
clients/odbc/driver/README
gdk/gdk_bbp.c
gdk/gdk_heap.c
tools/mserver/mserver5.c
Branch: gdk-tracer
Log Message:

Merge branch 'branches/default' into branches/gdk-tracer


diffs (truncated from 326 to 300 lines):

diff --git a/MonetDB5/NT/M5server.bat b/MonetDB5/NT/M5server.bat
new file mode 100755
--- /dev/null
+++ b/MonetDB5/NT/M5server.bat
@@ -0,0 +1,57 @@
+@REM This Source Code Form is subject to the terms of the Mozilla Public
+@REM License, v. 2.0.  If a copy of the MPL was not distributed with this
+@REM file, You can obtain one at http://mozilla.org/MPL/2.0/.
+@REM
+@REM Copyright 1997 - July 2008 CWI, August 2008 - 2019 MonetDB B.V.
+
+@echo off
+
+setlocal
+
+rem figure out the folder name
+set MONETDB=%~dp0
+
+rem remove the final backslash from the path
+set MONETDB=%MONETDB:~0,-1%
+
+rem extend the search path with our EXE and DLL folders
+set PATH=%MONETDB%\bin;%MONETDB%\lib\monetdb5;%PATH%
+
+rem prepare the arguments to mserver5 to tell it where to put the dbfarm
+
+if "%APPDATA%" == "" goto usevar
+rem if the APPDATA variable does exist, put the database there
+set MONETDBDIR=%APPDATA%\MonetDB5
+set MONETDBFARM="--dbpath=%MONETDBDIR%\dbfarm\demo"
+goto skipusevar
+:usevar
+rem if the APPDATA variable does not exist, put the database in the
+rem installation folder (i.e. default location, so no command line argument)
+set MONETDBDIR=%MONETDB%\var\MonetDB5
+set MONETDBFARM=
+:skipusevar
+
+rem the SQL log directory used to be in %MONETDBDIR%, but we now
+rem prefer it inside the dbfarm, so move it there
+
+if not exist "%MONETDBDIR%\sql_logs" goto skipmove
+for /d %%i in ("%MONETDBDIR%"\sql_logs\*) do move "%%i" 
"%MONETDBDIR%\dbfarm"\%%~ni\sql_logs
+rmdir "%MONETDBDIR%\sql_logs"
+:skipmove
+
+set MONETDBPYTHONUDF=embedded_py=false
+
+if not exist "%MONETDB%\pyapi_locatepython3.bat" goto skippython3
+call "%MONETDB%\pyapi_locatepython3.bat"
+if not "%MONETDBPYTHONUDF%" == "embedded_py=false" goto skippython2
+:skippython3
+if not exist "%MONETDB%\pyapi_locatepython2.bat" goto skippython2
+call "%MONETDB%\pyapi_locatepython2.bat"
+:skippython2
+
+rem start the real server
+"%MONETDB%\bin\mserver5.exe" --set "prefix=%MONETDB%" --set %MONETDBPYTHONUDF% 
--set "exec_prefix=%MONETDB%" %MONETDBFARM% %*
+
+if ERRORLEVEL 1 pause
+
+endlocal
diff --git a/MonetDB5/mal/mal.c b/MonetDB5/mal/mal.c
--- a/MonetDB5/mal/mal.c
+++ b/MonetDB5/mal/mal.c
@@ -12,7 +12,6 @@
 #include "gdk_tracer.h"
 
 char   monet_cwd[FILENAME_MAX] = { 0 };
-size_t monet_memory = 0;
 char   monet_characteristics[4096];
 stream *maleventstream = 0;
 
@@ -66,7 +65,6 @@ int mal_init(void){
return -1;
}
 #endif
-   monet_memory = MT_npages() * MT_pagesize();
initNamespace();
initParser();
 #ifndef HAVE_EMBEDDED
@@ -130,7 +128,6 @@ void mserver_reset(void)
 #endif
 
memset((char*)monet_cwd, 0, sizeof(monet_cwd));
-   monet_memory = 0;
memset((char*)monet_characteristics,0, sizeof(monet_characteristics));
mal_namespace_reset();
/* No need to clean up the namespace, it will simply be extended
diff --git a/MonetDB5/mal/mal.h b/MonetDB5/mal/mal.h
--- a/MonetDB5/mal/mal.h
+++ b/MonetDB5/mal/mal.h
@@ -44,10 +44,9 @@ mal_export lng MALdebug;
  * leaving a small portion for other programs.
  */
 #define GB (((lng)1024)*1024*1024)
-#define MEMORY_THRESHOLD  (0.2 * monet_memory > 8 * GB?  monet_memory - 8 * 
GB: 0.8 * monet_memory)
+#define MEMORY_THRESHOLD  (0.2 * GDK_mem_maxsize > 8 * GB?  GDK_mem_maxsize - 
8 * GB: 0.8 * GDK_mem_maxsize)
 
 mal_export char monet_cwd[FILENAME_MAX];
-mal_export size_t  monet_memory;
 mal_export charmonet_characteristics[4096];
 mal_export stream  *maleventstream;
 
diff --git a/MonetDB5/optimizer/opt_mitosis.c b/MonetDB5/optimizer/opt_mitosis.c
--- a/MonetDB5/optimizer/opt_mitosis.c
+++ b/MonetDB5/optimizer/opt_mitosis.c
@@ -125,10 +125,10 @@ OPTmitosisImplementation(Client cntxt, M
 * Take into account the number of client connections, 
 * because all user together are responsible for resource contentions
 */
-   m = monet_memory / argsize;
+   m = GDK_mem_maxsize / argsize;
/* if data exceeds memory size,
-* i.e., (rowcnt*argsize > monet_memory),
-* i.e., (rowcnt > monet_memory/argsize = m) */
+* i.e., (rowcnt*argsize > GDK_mem_maxsize),
+* i.e., (rowcnt > GDK_mem_maxsize/argsize = m) */
assert(threads > 0);
assert(activeClients > 0);
if (rowcnt > m && m / threads / activeClients 

MonetDB: gdk-tracer - Merge branch 'branches/default' into branc...

2019-11-19 Thread Thodoris Zois
Changeset: 450910441486 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=450910441486
Modified Files:
MonetDB5/optimizer/opt_postfix.c
sql/server/rel_optimizer.c
sql/test/BugTracker-2018/Tests/case_with_orderby_limit.Bug-6512.sql

sql/test/BugTracker-2018/Tests/case_with_orderby_limit.Bug-6512.stable.out
sql/test/pg_regress/Tests/loadwisconsin.sql
sql/test/pg_regress/Tests/loadwisconsin.stable.out
Branch: gdk-tracer
Log Message:

Merge branch 'branches/default' into branches/gdk-tracer


diffs (truncated from 118880 to 300 lines):

diff --git a/MonetDB5/optimizer/opt_postfix.c b/MonetDB5/optimizer/opt_postfix.c
--- a/MonetDB5/optimizer/opt_postfix.c
+++ b/MonetDB5/optimizer/opt_postfix.c
@@ -37,17 +37,13 @@ OPTpostfixImplementation(Client cntxt, M
p= getInstrPtr(mb, i);
if ( getModuleId(p) == algebraRef && getFunctionId(p) == 
joinRef && getVarEolife(mb, getArg(p, p->retc -1)) == i){
delArgument(p, p->retc -1);
-   /* The typechecker is overruled here, because we only 
change the function binding */
-   p->fcn = ALGjoin1; 
-   //typeChecker(cntxt->usermodule, mb, p, TRUE);
+   typeChecker(cntxt->usermodule, mb, p, TRUE);
actions++;
continue;
}
if ( getModuleId(p) == algebraRef && getFunctionId(p) == 
leftjoinRef && getVarEolife(mb, getArg(p, p->retc -1)) == i){
delArgument(p, p->retc -1);
-   /* The typechecker is overruled here, because we only 
change the function binding */
-   p->fcn = ALGleftjoin1; 
-   //typeChecker(cntxt->usermodule, mb, p, TRUE);
+   typeChecker(cntxt->usermodule, mb, p, TRUE);
actions++;
continue;
}
diff --git a/sql/server/rel_optimizer.c b/sql/server/rel_optimizer.c
--- a/sql/server/rel_optimizer.c
+++ b/sql/server/rel_optimizer.c
@@ -1372,7 +1372,7 @@ static sql_exp *
if (get_cmp(e) == cmp_or || get_cmp(e) == cmp_filter) {
list *l, *r;
 
-   l = exps_push_down(sql, e->l, f, t);
+   l = exps_push_down(sql, e->l, f, t);
if (!l)
return NULL;
r = exps_push_down(sql, e->r, f, t);
@@ -1446,7 +1446,6 @@ exp_push_down(mvc *sql, sql_exp *e, sql_
return _exp_push_down(sql, e, f, t);
 }
 
-
 /* some projections results are order dependend (row_number etc) */
 static int 
 project_unsafe(sql_rel *rel, int allow_identity)
@@ -1758,13 +1757,13 @@ rel_push_count_down(int *changes, mvc *s
if (!is_groupby(rel->op))
return rel;
 
-   r = rel->l;
+   r = rel->l;
 
if (is_groupby(rel->op) && !rel_is_ref(rel) &&
-r && !r->exps && r->op == op_join && !(rel_is_ref(r)) && 
-   /* currently only single count aggregation is handled, no other 
projects or aggregation */
-   list_length(rel->exps) == 1 && 
exp_aggr_is_count(rel->exps->h->data)) {
-   sql_exp *nce, *oce;
+   r && !r->exps && r->op == op_join && !(rel_is_ref(r)) && 
+   /* currently only single count aggregation is handled, no other 
projects or aggregation */
+   list_length(rel->exps) == 1 && 
exp_aggr_is_count(rel->exps->h->data)) {
+   sql_exp *nce, *oce;
sql_rel *gbl, *gbr; /* Group By */
sql_rel *cp;/* Cross Product */
sql_subfunc *mult;
@@ -1778,7 +1777,7 @@ rel_push_count_down(int *changes, mvc *s
rname = exp_relname(oce);
name  = exp_name(oce);
 
-   args = new_exp_list(sql->sa);
+   args = new_exp_list(sql->sa);
srel = r->l;
{
sql_subaggr *cf = sql_bind_aggr(sql->sa, 
sql->session->schema, "count", NULL);
@@ -6067,7 +6066,7 @@ exps_remove_dictexps(mvc *sql, list *exp
 static sql_rel *
 rel_remove_join(int *changes, mvc *sql, sql_rel *rel)
 {
-   if (is_join(rel->op) && !is_outerjoin(rel->op) && /* DISABLES CODE */ 
(0)) {
+   if (is_join(rel->op) && !is_outerjoin(rel->op)) {
sql_rel *l = rel->l;
sql_rel *r = rel->r;
int lconst = 0, rconst = 0;
@@ -6098,7 +6097,7 @@ rel_remove_join(int *changes, mvc *sql, 
list_merge(rel->exps, r->exps, (fdup)NULL);
}
}
-   if (is_join(rel->op) && /* DISABLES CODE */ (0)) {
+   if (is_join(rel->op)) {
sql_rel *l = rel->l;
sql_rel *r = rel->r;
int ldict = 0, rdict = 0;
@@ -6135,7 +6134,7 @@ rel_remove_join(int 

MonetDB: gdk-tracer - Merge branch 'branches/default' into branc...

2019-11-19 Thread Thodoris Zois
Changeset: 5eca024e0234 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=5eca024e0234
Added Files:
MonetDB5/modules/mal/Tests/inspect05.stable.out
MonetDB5/modules/mal/clients.h
Modified Files:
MonetDB5/ChangeLog
MonetDB5/modules/mal/clients.c
MonetDB5/modules/mal/clients.mal
MonetDB5/optimizer/opt_garbageCollector.c
MonetDB5/optimizer/opt_mitosis.c
clients/Tests/MAL-signatures.stable.out
clients/Tests/MAL-signatures.stable.out.int128
clients/Tests/exports.stable.out
gdk/gdk_join.c
sql/ChangeLog
sql/backends/monet5/rel_bin.c
sql/backends/monet5/sql_upgrades.c
sql/common/sql_types.c
sql/scripts/22_clients.sql
sql/server/rel_rel.h
sql/server/rel_select.c
sql/server/rel_select.h
sql/test/BugTracker-2014/Tests/aggregates-intervals.Bug-3533.sql
sql/test/BugTracker-2014/Tests/aggregates-intervals.Bug-3533.stable.err
sql/test/BugTracker-2014/Tests/aggregates-intervals.Bug-3533.stable.out

sql/test/BugTracker-2019/Tests/duplicates-not-eliminated-long-CASE-stmt.Bug-6697.stable.out.single
sql/test/BugTracker/Tests/explain.SF-1739353.stable.out
sql/test/BugTracker/Tests/jdbc_no_debug.SF-1739356.stable.out

sql/test/FeatureRequests/Tests/foreign_key_outer_join_dead_code_elimination-explain-2join-query.stable.out

sql/test/FeatureRequests/Tests/foreign_key_outer_join_dead_code_elimination-explain-2join-view.stable.out
sql/test/emptydb-upgrade-chain-hge/Tests/package.py
sql/test/emptydb-upgrade-chain/Tests/package.py
sql/test/emptydb/Tests/check.stable.out
sql/test/emptydb/Tests/check.stable.out.32bit
sql/test/emptydb/Tests/check.stable.out.int128
sql/test/emptydb/Tests/package-hge.py
sql/test/emptydb/Tests/package.py
sql/test/sys-schema/Tests/systemfunctions.stable.out
sql/test/sys-schema/Tests/systemfunctions.stable.out.int128
sql/test/testdb-upgrade-chain-hge/Tests/package.py
sql/test/testdb-upgrade-chain/Tests/package.py
sql/test/testdb/Tests/package-hge.py
sql/test/testdb/Tests/package.py
testing/Mtest.py.in
Branch: gdk-tracer
Log Message:

Merge branch 'branches/default' into branches/gdk-tracer


diffs (truncated from 1385 to 300 lines):

diff --git a/MonetDB5/ChangeLog b/MonetDB5/ChangeLog
--- a/MonetDB5/ChangeLog
+++ b/MonetDB5/ChangeLog
@@ -1,6 +1,14 @@
 # ChangeLog file for MonetDB5
 # This file is updated with Maddlog
 
+* Tue Nov 19 2019 Pedro Ferreira 
+- Added session identifier, number of workers and memory claim to the
+  sysmon queue. 
+- The worker (number of threads), memory (in MB) and optimizer pipeline 
+  limits can now be set per user session basis. The query and session
+  timeouts are now set in seconds.
+- With required privileges an user can set resource limits for a session.
+
 * Wed Nov 13 2019 Sjoerd Mullender 
 - There are now versions of group.(sub)group(done) that produce a single
   output containing just the groups.
diff --git a/MonetDB5/modules/mal/Tests/inspect05.stable.out 
b/MonetDB5/modules/mal/Tests/inspect05.stable.out
new file mode 100644
--- /dev/null
+++ b/MonetDB5/modules/mal/Tests/inspect05.stable.out
@@ -0,0 +1,106 @@
+stdout of test 'inspect05` in directory 'monetdb5/modules/mal` itself:
+
+
+# 18:15:32 >  
+# 18:15:32 >  "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" 
"gdk_dbfarm=/home/sjoerd/Monet-devel/var/MonetDB" "--set" "mapi_open=true" 
"--set" "mapi_port=37682" "--set" "monet_prompt=" "--trace" "--forcemito" 
"--set" "mal_listing=2" "--dbname=mTests_modules_mal" "inspect05.mal"
+# 18:15:32 >  
+
+# MonetDB 5 server v11.10.0 (hg id: d6a857b5d084)
+# This is an unreleased version
+# Serving database 'mTests_modules_mal', using 2 threads
+# Compiled for x86_64-unknown-linux-gnu/64bit with 64bit OIDs dynamically 
linked
+# Found 3.861 GiB available main-memory.
+# Copyright (c) 1993-July 2008 CWI.
+# Copyright (c) August 2008-2015 MonetDB B.V., all rights reserved
+# Visit http://www.monetdb.org/ for further information
+# Listening for connection requests on 
mapi:monetdb://koolmees.mullender.nl:37682/
+# MonetDB/GIS module loaded
+# MonetDB/JAQL module loaded
+# MonetDB/SQL module loaded
+# MonetDB/R   module loaded
+
+
+# 09:46:13 >  
+# 09:46:13 >  "mclient" "-lmal" "-ftest" "-Eutf-8" 
"--host=/var/tmp/mtest-26774" "--port=35410"
+# 09:46:13 >  
+
+#--#
+# tt   t   t   t  # name
+# str  str str str str  # type
+#--#
+[ 0@0, "append",   "command",  "bat",  "(i:bat[:any_1], 
u:any_1):bat[:any_1] ","BKCappend_val_wrap;"   ]
+[ 1@0, "append",   "command",  "bat",  "(tt:int, 
heapfile:str):bat[:any_1] ",  "BKCattach;"]
+[ 2@0, "append",   "command",  "bat",  "(i:bat[:any_1], u:any_1, 

MonetDB: gdk-tracer - Merge branch 'branches/default' into branc...

2019-11-18 Thread Thodoris Zois
Changeset: f4a1b0065b7c for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f4a1b0065b7c
Added Files:
MonetDB5/ChangeLog-Archive
MonetDB5/ChangeLog.Nov2019
debian/libmonetdb19.install
Removed Files:
ChangeLog.Apr2019
buildtools/ChangeLog.Apr2019
buildtools/selinux/ChangeLog.Apr2019
clients/ChangeLog.Apr2019
clients/mapilib/ChangeLog.Apr2019
common/stream/ChangeLog.Apr2019
debian/libmonetdb18.install
gdk/ChangeLog.Apr2019
geom/ChangeLog.Apr2019
sql/ChangeLog.Apr2019
testing/ChangeLog.Apr2019
tools/merovingian/ChangeLog.Apr2019
Modified Files:
.hgtags
MonetDB.spec
debian/changelog
debian/control
gdk/ChangeLog-Archive
gdk/ChangeLog.Nov2019
libversions
sql/ChangeLog-Archive
sql/ChangeLog.Nov2019
tools/merovingian/ChangeLog-Archive
tools/merovingian/ChangeLog.Nov2019
Branch: gdk-tracer
Log Message:

Merge branch 'branches/default' into branches/gdk-tracer


diffs (truncated from 1253 to 300 lines):

diff --git a/.hgtags b/.hgtags
--- a/.hgtags
+++ b/.hgtags
@@ -737,3 +737,5 @@ 6566d90185b83ed95129db9ea68baf52f2de5cc7
 a6674f7048a13fe7dc53995a4f723d33a34bce23 Apr2019_SP1_release
 6566d90185b83ed95129db9ea68baf52f2de5cc7 Apr2019_SP1_release
 d4c1a8c3cbcd965169f1836eaa635101436db81c Nov2019_root
+90486f8f87ff0602f3ab143c629ba0aed2153d64 Nov2019_1
+90486f8f87ff0602f3ab143c629ba0aed2153d64 Nov2019_release
diff --git a/ChangeLog.Apr2019 b/ChangeLog.Apr2019
deleted file mode 100644
--- a/ChangeLog.Apr2019
+++ /dev/null
@@ -1,2 +0,0 @@
-# ChangeLog file for devel
-# This file is updated with Maddlog
diff --git a/MonetDB.spec b/MonetDB.spec
--- a/MonetDB.spec
+++ b/MonetDB.spec
@@ -114,7 +114,7 @@ Group: Applications/Databases
 License: MPLv2.0
 URL: https://www.monetdb.org/
 BugURL: https://bugs.monetdb.org/
-Source: 
https://www.monetdb.org/downloads/sources/Apr2019-SP1/%{name}-%{version}.tar.bz2
+Source: 
https://www.monetdb.org/downloads/sources/Nov2019/%{name}-%{version}.tar.bz2
 
 # we need systemd for the _unitdir macro to exist
 # we need checkpolicy and selinux-policy-devel for the SELinux policy
@@ -1059,6 +1059,146 @@ fi
 %postun -p /sbin/ldconfig
 
 %changelog
+* Mon Nov 18 2019 Sjoerd Mullender  - 11.35.1-20191118
+- Rebuilt.
+- BZ#6134: Query produces error: HEAPalloc: Insufficient space for HEAP
+  of 1168033427456 bytes.
+- BZ#6613: LATERAL crash /.../rel_bin.c:1473: rel2bin_table: Assertion
+  `0' failed.
+- BZ#6683: Bug in subselect
+- BZ#6686: Bug in subselect (count function)
+- BZ#6688: Bug in subselect (or condition)
+- BZ#6689: Trying to improve the performance of SQL queries with a large
+  list of members in IN clause.
+- BZ#6695: timestamp transformation
+- BZ#6700: Monetdb Bugs in Subselect statements:
+- BZ#6722: window functions issues
+- BZ#6740: while upgrading the database from verison (MonetDB-11.27.13)
+  to (MonetDB-11.33.3) we are unable to bring up the database
+- BZ#6754: in mclient a strang msg is reported after issueing command:
+  set schema sys;
+- BZ#6755: Assertion failure in rel_bin.c
+- BZ#6756: Error in optimizer garbageCollector on merge tables select
+- BZ#6757: Double free or corruption (out)
+- BZ#6758: SIGSEGV in __strcmp_sse2_unaligned()
+- BZ#6759: Python JSON loader creates invalid data type for strings
+- BZ#6761: Error: Program contains errors.:(NONE).multiplex
+- BZ#6762: mserver5 crashes on (re-)start
+- BZ#6764: mserver5 crashes with corruption, double free, invalid size
+  or invalid pointer
+- BZ#6766: Missing bulk implementation for get_value and next_value calls
+- BZ#6769: ProfilerStart is not threadsafe
+- BZ#6771: R-devel
+- BZ#6773: json.filter returns corrupted string when selecting JSON
+  null value
+- BZ#6774: PROD aggregation gives wrong result
+- BZ#6775: NOT IN with an AND containing an OR gives wrong result
+- BZ#6776: Creating a table with a full outer join query gives type with
+  wrong digits on the joined key.
+- BZ#6779: Using Windows Messages translation for errno error codes.
+- BZ#6780: Wrong value of the rank function
+- BZ#6781: Insert after index creation crash
+- BZ#6782: JDBC IsValid(int) does not reset lastquerytimeout on server
+- BZ#6783: AVG changes scale of its results
+- BZ#6784: function sys.isauuid(string) should return false if string
+  value cannot be converted to a UUID
+
+* Mon Nov  4 2019 Pedro Ferreira  - 
11.35.1-20191118
+- sql: Removed functions json.text(string) returns string and json.text(int)
+  returns string. Their MAL implementation didn't exist, so they were
+  meaningless.
+
+* Thu Oct 17 2019 Pedro Ferreira  - 
11.35.1-20191118
+- merovingian: Added "vmmaxsize" and "memmaxsize" mserver5 options to the 
daemon in
+  order to set mserver5's maximum virtual and committed memory
+  respectively.
+
+* Wed Sep 25 2019 Sjoerd Mullender  - 11.35.1-20191118
+- sql: Strings are now limited 

MonetDB: gdk-tracer - Merge branch 'branches/default' into branc...

2019-11-14 Thread Thodoris Zois
Changeset: eccc66ae079d for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=eccc66ae079d
Modified Files:
MonetDB5/modules/kernel/algebra.c
Branch: gdk-tracer
Log Message:

Merge branch 'branches/default' into branches/gdk-tracer


diffs (30 lines):

diff --git a/MonetDB5/modules/kernel/algebra.c 
b/MonetDB5/modules/kernel/algebra.c
--- a/MonetDB5/modules/kernel/algebra.c
+++ b/MonetDB5/modules/kernel/algebra.c
@@ -438,7 +438,7 @@ do_join(bat *r1, bat *r2, const bat *lid
assert(rangefunc == NULL);
assert(difffunc == NULL);
assert(interfunc == NULL);
-   if ((*thetafunc)(, , left, right, candleft, 
candright, op, *nil_matches, est) != GDK_SUCCEED)
+   if ((*thetafunc)(, r2 ?  : NULL, left, right, 
candleft, candright, op, *nil_matches, est) != GDK_SUCCEED)
goto fail;
} else if (joinfunc) {
assert(bandfunc == NULL);
@@ -452,7 +452,7 @@ do_join(bat *r1, bat *r2, const bat *lid
assert(rangefunc == NULL);
assert(difffunc == NULL);
assert(interfunc == NULL);
-   if ((*bandfunc)(, , left, right, candleft, 
candright, c1, c2, li, hi, est) != GDK_SUCCEED)
+   if ((*bandfunc)(, r2 ?  : NULL, left, right, 
candleft, candright, c1, c2, li, hi, est) != GDK_SUCCEED)
goto fail;
} else if (rangefunc) {
assert(difffunc == NULL);
@@ -461,7 +461,7 @@ do_join(bat *r1, bat *r2, const bat *lid
err = SQLSTATE(HY002) RUNTIME_OBJECT_MISSING;
goto fail;
}
-   if ((*rangefunc)(, , left, right, right2, 
candleft, candright, li, hi, est) != GDK_SUCCEED)
+   if ((*rangefunc)(, r2 ?  : NULL, left, right, 
right2, candleft, candright, li, hi, est) != GDK_SUCCEED)
goto fail;
BBPunfix(right2->batCacheid);
} else if (difffunc) {
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: gdk-tracer - Merge branch 'branches/default' into branc...

2019-11-14 Thread Thodoris Zois
Changeset: fb02f301830a for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=fb02f301830a
Added Files:
MonetDB5/ChangeLog
MonetDB5/mal/mal_session.c
MonetDB5/modules/kernel/group.c
MonetDB5/modules/kernel/group.h
MonetDB5/modules/kernel/group.mal
Modified Files:
MonetDB5/modules/kernel/algebra.c
MonetDB5/modules/kernel/algebra.h
MonetDB5/modules/kernel/algebra.mal
clients/Tests/MAL-signatures.stable.out
clients/Tests/MAL-signatures.stable.out.int128
clients/Tests/exports.stable.out
common/utils/msabaoth.c
common/utils/msabaoth.h
gdk/gdk_join.c
gdk/gdk_select.c
gdk/gdk_utils.c
sql/backends/monet5/rel_bin.c
sql/server/rel_exp.c
sql/server/rel_optimizer.c
sql/server/rel_unnest.c
sql/test/BugTracker-2017/Tests/complicated_logic.Bug-105.stable.out
tools/merovingian/client/monetdb.c
tools/merovingian/daemon/client.c
tools/merovingian/daemon/controlrunner.c
tools/merovingian/daemon/discoveryrunner.c
tools/merovingian/daemon/forkmserver.c
tools/merovingian/daemon/forkmserver.h
tools/merovingian/utils/database.c
Branch: gdk-tracer
Log Message:

Merge branch 'branches/default' into branches/gdk-tracer


diffs (truncated from 2968 to 300 lines):

diff --git a/MonetDB5/ChangeLog b/MonetDB5/ChangeLog
new file mode 100644
--- /dev/null
+++ b/MonetDB5/ChangeLog
@@ -0,0 +1,10 @@
+# ChangeLog file for MonetDB5
+# This file is updated with Maddlog
+
+* Wed Nov 13 2019 Sjoerd Mullender 
+- There are now versions of group.(sub)group(done) that produce a single
+  output containing just the groups.
+- algebra.join and algebra.leftjoin now have forms which return a single
+  column.  The column that is returned is the left column of the two
+  column version.
+
diff --git a/MonetDB5/mal/mal_session.c b/MonetDB5/mal/mal_session.c
new file mode 100644
--- /dev/null
+++ b/MonetDB5/mal/mal_session.c
@@ -0,0 +1,737 @@
+/*
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0.  If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * Copyright 1997 - July 2008 CWI, August 2008 - 2019 MonetDB B.V.
+ */
+
+/* (author) M.L. Kersten
+ */
+#include "monetdb_config.h"
+#include "mal_session.h"
+#include "mal_instruction.h" /* for pushEndInstruction() */
+#include "mal_interpreter.h" /* for runMAL(), garbageElement() */
+#include "mal_parser.h" /* for parseMAL() */
+#include "mal_namespace.h"
+#include "mal_authorize.h"
+#include "mal_builder.h"
+#include "msabaoth.h"
+#include "mal_private.h"
+#include "gdk.h"   /* for opendir and friends */
+#include "gdk_tracer.h"
+
+/*
+ * The MonetDB server uses a startup script to boot the system.
+ * This script is an ordinary MAL program, but will mostly
+ * consist of include statements to load modules of general interest.
+ * The startup script is run as user Admin.
+ */
+str
+malBootstrap(void)
+{
+   Client c;
+   str msg = MAL_SUCCEED;
+   str bootfile = "mal_init";
+
+   c = MCinitClient((oid) 0, NULL, NULL);
+   if(c == NULL) {
+   throw(MAL, "malBootstrap", "Failed to initialize client");
+   }
+   assert(c != NULL);
+   c->curmodule = c->usermodule = userModule();
+   if(c->usermodule == NULL) {
+   MCfreeClient(c);
+   throw(MAL, "malBootstrap", "Failed to initialize client MAL 
module");
+   }
+   if ( (msg = defaultScenario(c)) ) {
+   MCfreeClient(c);
+   return msg;
+   }
+   if((msg = MSinitClientPrg(c, "user", "main")) != MAL_SUCCEED) {
+   MCfreeClient(c);
+   return msg;
+   }
+   if( MCinitClientThread(c) < 0){
+   MCfreeClient(c);
+   throw(MAL, "malBootstrap", "Failed to create client thread");
+   }
+   if ((msg = malInclude(c, bootfile, 0)) != MAL_SUCCEED) {
+   MCfreeClient(c);
+   return msg;
+   }
+   pushEndInstruction(c->curprg->def);
+   chkProgram(c->usermodule, c->curprg->def);
+   if ( (msg= c->curprg->def->errors) != MAL_SUCCEED ) {
+   MCfreeClient(c);
+   return msg;
+   }
+   msg = MALengine(c);
+   MCfreeClient(c);
+   return msg;
+}
+
+/*
+ * Every client has a 'main' function to collect the statements.  Once
+ * the END instruction has been found, it is added to the symbol table
+ * and a fresh container is being constructed.  Note, this scheme makes
+ * testing for recursive function calls a little more difficult.
+ * Therefore, type checking should be performed afterwards.
+ *
+ * In interactive mode,  the closing statement is never reached.  The
+ * 'main' procedure is typically cleaned between successive external
+ * messages except for its variables, 

MonetDB: gdk-tracer - Merge branch 'branches/default' into branc...

2019-11-12 Thread Thodoris Zois
Changeset: d55ca7c4b052 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=d55ca7c4b052
Added Files:
MonetDB5/modules/atoms/uuid.c
sql/test/BugTracker-2019/Tests/isaUUID.Bug-6784.sql
sql/test/BugTracker-2019/Tests/isaUUID.Bug-6784.stable.err
sql/test/BugTracker-2019/Tests/isaUUID.Bug-6784.stable.out
Modified Files:
sql/backends/monet5/rel_bin.c
sql/server/rel_schema.c
sql/test/BugTracker-2019/Tests/All
testing/exportutils.py
Branch: gdk-tracer
Log Message:

Merge branch 'branches/default' into branches/gdk-tracer


diffs (truncated from 620 to 300 lines):

diff --git a/MonetDB5/modules/atoms/uuid.c b/MonetDB5/modules/atoms/uuid.c
new file mode 100644
--- /dev/null
+++ b/MonetDB5/modules/atoms/uuid.c
@@ -0,0 +1,296 @@
+/*
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0.  If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * Copyright 1997 - July 2008 CWI, August 2008 - 2019 MonetDB B.V.
+ */
+
+/*
+ * K.S. Mullender & A. de Rijke
+ * The UUID module
+ * The UUID module contains a wrapper for all function in
+ * libuuid.
+ */
+
+#include "monetdb_config.h"
+#include "mal.h"
+#include "mal_exception.h"
+#include "mal_atom.h"  /* for malAtomSize */
+#ifdef HAVE_UUID_UUID_H
+#include 
+#endif
+#ifndef HAVE_UUID
+#ifdef HAVE_OPENSSL
+# include 
+#else
+#ifdef HAVE_COMMONCRYPTO
+#include 
+#endif
+#endif
+#endif
+
+#ifdef HAVE_UUID
+#define UUID_SIZE  ((int) sizeof(uuid_t)) /* size of a UUID */
+#else
+#define UUID_SIZE  16  /* size of a UUID */
+#endif
+#define UUID_STRLEN36  /* length of string 
representation */
+
+typedef union {
+#ifdef HAVE_HGE
+   hge h;  /* force alignment, not 
otherwise used */
+#else
+   lng l[2];   /* force alignment, not 
otherwise used */
+#endif
+#ifdef HAVE_UUID
+   uuid_t u;
+#else
+   unsigned char u[UUID_SIZE];
+#endif
+} uuid;
+
+mal_export str UUIDprelude(void *ret);
+mal_export int UUIDcompare(const uuid *l, const uuid *r);
+mal_export ssize_t UUIDfromString(const char *svalue, size_t *len, uuid 
**retval, bool external);
+mal_export BUN UUIDhash(const void *u);
+mal_export const uuid *UUIDnull(void);
+mal_export uuid *UUIDread(uuid *u, stream *s, size_t cnt);
+mal_export ssize_t UUIDtoString(str *retval, size_t *len, const uuid *value, 
bool external);
+mal_export gdk_return UUIDwrite(const uuid *u, stream *s, size_t cnt);
+
+mal_export str UUIDgenerateUuid(uuid **retval);
+mal_export str UUIDgenerateUuidInt(uuid **retval, int *d);
+mal_export str UUIDstr2uuid(uuid **retval, str *s);
+mal_export str UUIDuuid2str(str *retval, uuid **u);
+mal_export str UUIDisaUUID(bit *retval, str *u);
+mal_export str UUIDequal(bit *retval, uuid **l, uuid **r);
+
+static uuid uuid_nil;  /* automatically initialized as zeros */
+
+str
+UUIDprelude(void *ret)
+{
+   (void) ret;
+   assert(UUID_SIZE == 16);
+   (void) malAtomSize(sizeof(uuid), "uuid");
+   return MAL_SUCCEED;
+}
+
+#define is_uuid_nil(x) (memcmp((x)->u, uuid_nil.u, UUID_SIZE) == 0)
+
+/**
+ * Returns the string representation of the given uuid value.
+ * Warning: GDK function
+ * Returns the length of the string
+ */
+ssize_t
+UUIDtoString(str *retval, size_t *len, const uuid *value, bool external)
+{
+   if (*len <= UUID_STRLEN || *retval == NULL) {
+   if (*retval)
+   GDKfree(*retval);
+   if ((*retval = GDKmalloc(UUID_STRLEN + 1)) == NULL)
+   return -1;
+   *len = UUID_STRLEN + 1;
+   }
+   if (is_uuid_nil(value)) {
+   if (external) {
+   snprintf(*retval, *len, "nil");
+   return 3;
+   }
+   strcpy(*retval, str_nil);
+   return 1;
+   }
+   snprintf(*retval, *len,
+
"%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",
+value->u[0], value->u[1], value->u[2], value->u[3],
+value->u[4], value->u[5], value->u[6], value->u[7],
+value->u[8], value->u[9], value->u[10], value->u[11],
+value->u[12], value->u[13], value->u[14], 
value->u[15]);
+   assert(strlen(*retval) == UUID_STRLEN);
+   return UUID_STRLEN;
+}
+
+ssize_t
+UUIDfromString(const char *svalue, size_t *len, uuid **retval, bool external)
+{
+   const char *s = svalue;
+   int i, j;
+
+   if (*len < UUID_SIZE || *retval == NULL) {
+   GDKfree(*retval);
+   if ((*retval = GDKmalloc(UUID_SIZE)) == NULL)
+   return -1;
+   *len = UUID_SIZE;
+   }
+   if (external && strcmp(svalue, "nil") ==