MonetDB: default - Look for parameters while adding nulls

2022-03-14 Thread Pedro Ferreira
Changeset: 91b4d5bf6144 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/91b4d5bf6144
Modified Files:
sql/server/rel_unnest.c
sql/test/prepare/Tests/sqlancer_prepare.sql
sql/test/prepare/Tests/sqlancer_prepare.stable.err
sql/test/prepare/Tests/sqlancer_prepare.stable.err.int128
Branch: default
Log Message:

Look for parameters while adding nulls


diffs (103 lines):

diff --git a/sql/server/rel_unnest.c b/sql/server/rel_unnest.c
--- a/sql/server/rel_unnest.c
+++ b/sql/server/rel_unnest.c
@@ -1358,6 +1358,8 @@ push_up_join(mvc *sql, sql_rel *rel, lis
if (is_outerjoin(j->op) && j->exps && 
!list_empty(rel->attr)) {
visitor v = { .sql = sql };
rel->r = j = rewrite_outer2inner_union(&v, j);
+   if (!j)
+   return NULL;
return rel;
}
 
@@ -3843,8 +3845,12 @@ add_null_projects(visitor *v, sql_rel *p
l = sa_list(v->sql->sa);
}
for(; nr; n = n->next, nr--) {
-   sql_exp *e = n->data;
-   sql_exp *ne = exp_atom(v->sql->sa, atom_general(v->sql->sa, 
exp_subtype(e), NULL));
+   sql_exp *e = n->data, *ne;
+   sql_subtype *tp = exp_subtype(e);
+
+   if (!tp)
+   return sql_error(v->sql, 10, SQLSTATE(42000) "Cannot 
rewrite subquery because of parameter with unknown type");
+   ne = exp_atom(v->sql->sa, atom_general(v->sql->sa, tp, NULL));
exp_setname(v->sql->sa, ne, exp_relname(e), exp_name(e));
if (end)
append(nilrel->exps, ne);
@@ -3878,6 +3884,9 @@ rewrite_outer2inner_union(visitor *v, sq
rel_setop_set_exps(v->sql, except, 
rel_projections(v->sql, rel->l, NULL, 1, 1), false);
set_processed(except);
sql_rel *nilrel = add_null_projects(v, prel, except, 
true);
+   if (!nilrel)
+   return NULL;
+
sql_rel *nrel = rel_setop(v->sql->sa, prel, nilrel, 
op_union);
rel_setop_set_exps(v->sql, nrel, 
rel_projections(v->sql, rel, NULL, 1, 1), false);
set_processed(nrel);
@@ -3898,6 +3907,9 @@ rewrite_outer2inner_union(visitor *v, sq
rel_setop_set_exps(v->sql, except, 
rel_projections(v->sql, rel->r, NULL, 1, 1), false);
set_processed(except);
sql_rel *nilrel = add_null_projects(v, prel, except, 
false);
+   if (!nilrel)
+   return NULL;
+
sql_rel *nrel = rel_setop(v->sql->sa, prel, nilrel, 
op_union);
rel_setop_set_exps(v->sql, nrel, 
rel_projections(v->sql, rel, NULL, 1, 1), false);
set_processed(nrel);
@@ -3918,6 +3930,8 @@ rewrite_outer2inner_union(visitor *v, sq
rel_setop_set_exps(v->sql, except, 
rel_projections(v->sql, rel->l, NULL, 1, 1), false);
set_processed(except);
sql_rel *lrel = add_null_projects(v, prel, except, 
true);
+   if (!lrel)
+   return NULL;
 
except = rel_setop(v->sql->sa,
rel_project(v->sql->sa, 
rel_dup(rel->r), rel_projections(v->sql, rel->r, NULL, 1, 1)),
@@ -3925,6 +3939,8 @@ rewrite_outer2inner_union(visitor *v, sq
rel_setop_set_exps(v->sql, except, 
rel_projections(v->sql, rel->r, NULL, 1, 1), false);
set_processed(except);
sql_rel *rrel = add_null_projects(v, prel, except, 
false);
+   if (!rrel)
+   return NULL;
 
lrel = rel_setop(v->sql->sa, lrel, rrel, op_union);
rel_setop_set_exps(v->sql, lrel, 
rel_projections(v->sql, rel, NULL, 1, 1), false);
@@ -4057,7 +4073,7 @@ rewrite_rel(visitor *v, sql_rel *rel)
sql_rel *ir = exp_rel_get_rel(v->sql->sa, e);
 
rel = rewrite_outer2inner_union(v, rel);
-   if (or == rel)
+   if (!rel || or == rel)
return rel;
/* change referenced project into join with outer(ir) */
sql_rel *nr = rel->l;
diff --git a/sql/test/prepare/Tests/sqlancer_prepare.sql 
b/sql/test/prepare/Tests/sqlancer_prepare.sql
--- a/sql/test/prepare/Tests/sqlancer_prepare.sql
+++ b/sql/test/prepare/Tests/sqlancer_prepare.sql
@@ -83,3 +83,5 @@ ROLLBACK;
 PREPARE WITH y(a,b) AS (SELECT 1, ?) SELECT "json"."filter"(JSON '"a"', y.b) 
FROM y CROSS JOIN ((SELECT 1, 4) EXCEPT (SELECT 1,2)) x(x

MonetDB: default - Next subquery crash

2022-03-14 Thread Pedro Ferreira
Changeset: fd8dec3d9d8e for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/fd8dec3d9d8e
Modified Files:
sql/test/SQLancer/Tests/sqlancer23.test
Branch: default
Log Message:

Next subquery crash


diffs (15 lines):

diff --git a/sql/test/SQLancer/Tests/sqlancer23.test 
b/sql/test/SQLancer/Tests/sqlancer23.test
--- a/sql/test/SQLancer/Tests/sqlancer23.test
+++ b/sql/test/SQLancer/Tests/sqlancer23.test
@@ -149,6 +149,11 @@ SELECT 1 FROM t0 LEFT OUTER JOIN LATERAL
 ON (VALUES (t0.c0)) = 1
 
 
+query I nosort
+SELECT 1 FROM t0, (SELECT 1 FROM (SELECT 1) y(y) LEFT JOIN (SELECT 1) x(x) ON 
1 < any(SELECT y.y)) vx(vx)
+WHERE CASE WHEN TRUE THEN 2 = ANY(VALUES (vx.vx)) WHEN FALSE THEN t0.c0 = 
t0.c0 END
+
+
 # Postgres doesn't give an error here, but we are confident it must
 statement error GDK reported error: mergejoin: more than one match
 SELECT 1 FROM t0 CROSS JOIN LATERAL (SELECT (VALUES (y.y), (y.y)) FROM (SELECT 
1) y(y) WHERE t0.c0 = 2) x(x)
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - Another crash. Parser issue?

2022-03-14 Thread Pedro Ferreira
Changeset: 3e39eb73fb09 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/3e39eb73fb09
Modified Files:
sql/test/SQLancer/Tests/sqlancer23.test
Branch: default
Log Message:

Another crash. Parser issue?


diffs (14 lines):

diff --git a/sql/test/SQLancer/Tests/sqlancer23.test 
b/sql/test/SQLancer/Tests/sqlancer23.test
--- a/sql/test/SQLancer/Tests/sqlancer23.test
+++ b/sql/test/SQLancer/Tests/sqlancer23.test
@@ -150,6 +150,10 @@ ON (VALUES (t0.c0)) = 1
 
 
 query I nosort
+SELECT x.c0 FROM t0, t0 x WHERE (1 IN (2)) = FALSE
+
+
+query I nosort
 SELECT 1 FROM t0, (SELECT 1 FROM (SELECT 1) y(y) LEFT JOIN (SELECT 1) x(x) ON 
1 < any(SELECT y.y)) vx(vx)
 WHERE CASE WHEN TRUE THEN 2 = ANY(VALUES (vx.vx)) WHEN FALSE THEN t0.c0 = 
t0.c0 END
 
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - When rewriting anyequal to not_anyequal, pass...

2022-03-14 Thread Pedro Ferreira
Changeset: 65aa0bebd9ec for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/65aa0bebd9ec
Modified Files:
sql/server/rel_rewriter.c
Branch: default
Log Message:

When rewriting anyequal to not_anyequal, pass the arguments, not the function 
itself


diffs (12 lines):

diff --git a/sql/server/rel_rewriter.c b/sql/server/rel_rewriter.c
--- a/sql/server/rel_rewriter.c
+++ b/sql/server/rel_rewriter.c
@@ -188,7 +188,7 @@ rewrite_simplify_exp(visitor *v, sql_rel
if (is_func(l->type) && exp_is_false(r) && 
(is_anyequal_func(((sql_subfunc*)l->f)) || 
is_exists_func(((sql_subfunc*)l->f {
sql_subfunc *sf = l->f;
if (is_anyequal_func(sf))
-   return exp_in_func(v->sql, l, r, !is_anyequal(sf), 
0);
+   return exp_in_func(v->sql, 
((list*)l->l)->h->data, ((list*)l->l)->h->next->data, !is_anyequal(sf), 0);
if (is_exists_func(sf))
return exp_exists(v->sql, 
((list*)l->l)->h->data, !is_exists(sf));
return l;
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - bat.append undefined error

2022-03-14 Thread Pedro Ferreira
Changeset: 42fb1c61b723 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/42fb1c61b723
Modified Files:
sql/test/SQLancer/Tests/sqlancer23.test
Branch: default
Log Message:

bat.append undefined error


diffs (15 lines):

diff --git a/sql/test/SQLancer/Tests/sqlancer23.test 
b/sql/test/SQLancer/Tests/sqlancer23.test
--- a/sql/test/SQLancer/Tests/sqlancer23.test
+++ b/sql/test/SQLancer/Tests/sqlancer23.test
@@ -154,6 +154,11 @@ SELECT x.c0 FROM t0, t0 x WHERE (1 IN (2
 
 
 query I nosort
+SELECT 1 FROM t0 RIGHT JOIN (SELECT 1) y(y) ON EXISTS (SELECT TRUE) AND 1 = 
ALL(SELECT 2)
+JOIN (SELECT CASE WHEN FALSE THEN 3 END) z(z) ON 1 = ALL(SELECT 3)
+
+
+query I nosort
 SELECT 1 FROM t0, (SELECT 1 FROM (SELECT 1) y(y) LEFT JOIN (SELECT 1) x(x) ON 
1 < any(SELECT y.y)) vx(vx)
 WHERE CASE WHEN TRUE THEN 2 = ANY(VALUES (vx.vx)) WHEN FALSE THEN t0.c0 = 
t0.c0 END
 
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - fixed crash, ie correctly mark expressions as...

2022-03-14 Thread Niels Nes
Changeset: b715f321b678 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/b715f321b678
Modified Files:
sql/server/rel_unnest.c
Branch: default
Log Message:

fixed crash, ie correctly mark expressions as free when needed.


diffs (12 lines):

diff --git a/sql/server/rel_unnest.c b/sql/server/rel_unnest.c
--- a/sql/server/rel_unnest.c
+++ b/sql/server/rel_unnest.c
@@ -4086,7 +4086,7 @@ rewrite_rel(visitor *v, sql_rel *rel)
nr->exps = exps;
nr->op = op_semi;
set_dependent(nr);
-   e = exp_rel_update_exp(v->sql, e, true);
+   e = exp_rel_update_exp(v->sql, e, false);
exp_reset_props(nr, e, true);
v->changes++;
break;
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: urlfuncs - remove unnecessary checks to increase speed

2022-03-14 Thread svetlin
Changeset: 9af90cc1a1e5 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/9af90cc1a1e5
Modified Files:
monetdb5/modules/atoms/url.c
Branch: urlfuncs
Log Message:

remove unnecessary checks to increase speed


diffs (44 lines):

diff --git a/monetdb5/modules/atoms/url.c b/monetdb5/modules/atoms/url.c
--- a/monetdb5/modules/atoms/url.c
+++ b/monetdb5/modules/atoms/url.c
@@ -884,6 +884,14 @@ extractURLHost(str *retval, str *url, bo
 }
 
 
+static inline str
+str_buf_copy(str *buf, size_t *buflen, const char *s, size_t l) {
+   CHECK_STR_BUFFER_LENGTH(buf, buflen, l, "url.str_buf_copy");
+   strcpy_len(*buf, s, l);
+   return MAL_SUCCEED;
+}
+
+
 // bulk version
 static str
 BATextractURLHost(bat *res, const bat *bid, bool no_www)
@@ -940,17 +948,17 @@ BATextractURLHost(bat *res, const bat *b
l = s - host;
}
if (domain && l > 3) {
-   if (no_www && strlen(host) > 4 && 
!strncmp(host, "www.", 4))
+   if (no_www && !strncmp(host, "www.", 4))
host += 4;
-   if ((msg = str_Sub_String(&buf, 
&buflen, host, 0, l)) != MAL_SUCCEED)
+   // if ((msg = str_Sub_String(&buf, 
&buflen, host, 0, l)) != MAL_SUCCEED)
+   //  break;
+   if ((msg = str_buf_copy(&buf, &buflen, 
host, (size_t) l)) != MAL_SUCCEED)
break;
-   if (checkUTF8(buf)) {
-   if (bunfastapp_nocheckVAR(bn, 
buf) != GDK_SUCCEED) {
-   msg = 
createException(MAL, "baturl.extractURLHost", SQLSTATE(HY013) MAL_MALLOC_FAIL );
-   break;
-   }
-   continue;
+   if (bunfastapp_nocheckVAR(bn, buf) != 
GDK_SUCCEED) {
+   msg = createException(MAL, 
"baturl.extractURLHost", SQLSTATE(HY013) MAL_MALLOC_FAIL );
+   break;
}
+   continue;
}
}
// fall back insert nil str if no valid host
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: urlfuncs - fix

2022-03-14 Thread svetlin
Changeset: 3513e759d5b2 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/3513e759d5b2
Modified Files:
monetdb5/modules/atoms/url.c
Branch: urlfuncs
Log Message:

fix


diffs (34 lines):

diff --git a/monetdb5/modules/atoms/url.c b/monetdb5/modules/atoms/url.c
--- a/monetdb5/modules/atoms/url.c
+++ b/monetdb5/modules/atoms/url.c
@@ -948,17 +948,21 @@ BATextractURLHost(bat *res, const bat *b
l = s - host;
}
if (domain && l > 3) {
-   if (no_www && !strncmp(host, "www.", 4))
+   if (no_www && !strncmp(host, "www.", 
4)) {
host += 4;
-   // if ((msg = str_Sub_String(&buf, 
&buflen, host, 0, l)) != MAL_SUCCEED)
-   //  break;
-   if ((msg = str_buf_copy(&buf, &buflen, 
host, (size_t) l)) != MAL_SUCCEED)
-   break;
-   if (bunfastapp_nocheckVAR(bn, buf) != 
GDK_SUCCEED) {
-   msg = createException(MAL, 
"baturl.extractURLHost", SQLSTATE(HY013) MAL_MALLOC_FAIL );
-   break;
+   l -= 4;
}
-   continue;
+   if (l > 0) {
+   // if ((msg = 
str_Sub_String(&buf, &buflen, host, 0, l)) != MAL_SUCCEED)
+   //  break;
+   if ((msg = str_buf_copy(&buf, 
&buflen, host, (size_t) l)) != MAL_SUCCEED)
+   break;
+   if (bunfastapp_nocheckVAR(bn, 
buf) != GDK_SUCCEED) {
+   msg = 
createException(MAL, "baturl.extractURLHost", SQLSTATE(HY013) MAL_MALLOC_FAIL );
+   break;
+   }
+   continue;
+   }
}
}
// fall back insert nil str if no valid host
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: Jan2022 - Use 'localhost' for hostname.

2022-03-14 Thread Sjoerd Mullender
Changeset: 4f5b04e469f4 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/4f5b04e469f4
Modified Files:
testing/Mtest.py.in
testing/Mz.py.in
Branch: Jan2022
Log Message:

Use 'localhost' for hostname.
Also see changeset ec44706d360b.


diffs (48 lines):

diff --git a/testing/Mtest.py.in b/testing/Mtest.py.in
--- a/testing/Mtest.py.in
+++ b/testing/Mtest.py.in
@@ -3188,20 +3188,6 @@ else:
 return os.listdir(os.path.abspath(d))
 
 HOST = 'localhost'
-# if 'HOST' in os.environ:
-# HOST = os.environ['HOST']
-# #else:
-# #HOST = ''
-# elif os.name != "nt":
-# HOST = os.uname()[1]
-# elif 'COMPUTERNAME' in os.environ:
-# HOST = os.environ['COMPUTERNAME']
-# ##else:
-# ##HOST = "WIN2000"
-# if 'DOMAIN' in os.environ:
-# HOST = HOST.replace('.'+os.environ('DOMAIN'),'')
-# else:
-# HOST = HOST.split('.', 1)[0]
 os.environ['HOST'] = HOST
 os.environ['MAPIHOST'] = HOST
 
diff --git a/testing/Mz.py.in b/testing/Mz.py.in
--- a/testing/Mz.py.in
+++ b/testing/Mz.py.in
@@ -2027,20 +2027,6 @@ else:
 return os.listdir(os.path.abspath(d))
 
 HOST = 'localhost'
-if 'HOST' in os.environ:
-HOST = os.environ['HOST']
-#else:
-#HOST = ''
-elif os.name != "nt":
-HOST = os.uname()[1]
-elif 'COMPUTERNAME' in os.environ:
-HOST = os.environ['COMPUTERNAME']
-##else:
-##HOST = "WIN2000"
-if 'DOMAIN' in os.environ:
-HOST = HOST.replace('.'+os.environ('DOMAIN'),'')
-else:
-HOST = HOST.split('.', 1)[0]
 os.environ['HOST'] = HOST
 os.environ['MAPIHOST'] = HOST
 
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: Jan2022 - No need to set embedded options.

2022-03-14 Thread Sjoerd Mullender
Changeset: 69e87461c1d7 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/69e87461c1d7
Modified Files:
testing/Mtest.py.in
testing/Mz.py.in
Branch: Jan2022
Log Message:

No need to set embedded options.
They are set in SingleServer files when needed.


diffs (116 lines):

diff --git a/testing/Mtest.py.in b/testing/Mtest.py.in
--- a/testing/Mtest.py.in
+++ b/testing/Mtest.py.in
@@ -2768,37 +2768,6 @@ def DoIt(env, SERVER, CALL, TST, EXT, Te
 if SERVER == "SQL":
 lang="sql"
 
-# enable r integration in server
-if (not all_tests or (COND != None and "HAVE_LIBR" in COND)) and 
CONDITIONALS['HAVE_LIBR'] and CONDITIONALS['NOT_WIN32']:
-Srvr.extend(['--set', 'embedded_r=yes'])
-
-savepath = None
-savepypath = os.environ.get('PYTHONPATH')
-savepyhome = os.environ.get('PYTHONHOME')
-if (COND != None and "HAVE_LIBPY3" in COND) and 
CONDITIONALS['HAVE_LIBPY3']:
-# enable Python 3 integration in server
-if winreg is not None:
-if env['TST_BITS'] == '32bit':
-if sys.maxsize > 2**32:
-regkey = 
r'SOFTWARE\Wow6432Node\Python\PythonCore\3.@PY3VER@-32\InstallPath'
-else:
-regkey = 
r'SOFTWARE\Python\PythonCore\3.@PY3VER@-32\InstallPath'
-else:
-regkey = 
r'SOFTWARE\Python\PythonCore\3.@PY3VER@\InstallPath'
-try:
-with winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, regkey) 
as key:
-instpath = winreg.QueryValue(key, None)
-os.environ['PYTHONHOME'] = instpath
-os.environ['PYTHONPATH'] = instpath + 'Lib'
-savepath = os.environ['PATH']
-os.environ['PATH'] = instpath.rstrip('\\') + 
os.pathsep + savepath
-except WindowsError:
-pass
-Srvr.extend(['--set', 'embedded_py=3'])
-
-# enable C integration in server
-Srvr.extend(['--set', 'embedded_c=true'])
-
 if PSRVR is None:
 if env.get('MULTIFARM'):
 Srvr.append('--dbextra=%s' % 
os.path.join(env['GDK_DBFARM'], TSTPREF + '_transient'))
@@ -2818,16 +2787,6 @@ def DoIt(env, SERVER, CALL, TST, EXT, Te
 else:
 PSRVR.timer.settimeout(TIMEOUT)
 PSRVR.timer.start()
-if savepath is not None:
-os.environ['PATH'] = savepath
-if savepypath:
-os.environ['PYTHONPATH'] = savepypath
-else:
-del os.environ['PYTHONPATH']
-if savepyhome:
-os.environ['PYTHONHOME'] = savepyhome
-else:
-del os.environ['PYTHONHOME']
 else:
 ClntOut = openutf8(TestOutFile, 'a')
 ClntErr = openutf8(TestErrFile, 'a')
diff --git a/testing/Mz.py.in b/testing/Mz.py.in
--- a/testing/Mz.py.in
+++ b/testing/Mz.py.in
@@ -1609,37 +1609,6 @@ def DoIt(env, SERVER, CALL, TST, EXT, Te
 if SERVER == "SQL":
 lang="sql"
 
-# enable r integration in server
-if ((COND != None and "HAVE_LIBR" in COND)) and 
CONDITIONALS['HAVE_LIBR'] and CONDITIONALS['NOT_WIN32']:
-Srvr.extend(['--set', 'embedded_r=yes'])
-
-savepath = None
-savepypath = os.environ.get('PYTHONPATH')
-savepyhome = os.environ.get('PYTHONHOME')
-if (COND != None and "HAVE_LIBPY3" in COND) and 
CONDITIONALS['HAVE_LIBPY3']:
-# enable Python 3 integration in server
-if winreg is not None:
-if env['TST_BITS'] == '32bit':
-if sys.maxsize > 2**32:
-regkey = 
r'SOFTWARE\Wow6432Node\Python\PythonCore\3.@PY3VER@-32\InstallPath'
-else:
-regkey = 
r'SOFTWARE\Python\PythonCore\3.@PY3VER@-32\InstallPath'
-else:
-regkey = 
r'SOFTWARE\Python\PythonCore\3.@PY3VER@\InstallPath'
-try:
-with winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, regkey) 
as key:
-instpath = winreg.QueryValue(key, None)
-os.environ['PYTHONHOME'] = instpath
-os.environ['PYTHONPATH'] = instpath + 'Lib'
-savepath = os.environ['PATH']
-os.environ['PATH'] = instpath.rstrip('\\') + 
os.pathsep + savepath
-except WindowsError:
-pass
-Srvr.extend(['--set', 'embedded_py=3'])
-
-# enable C integr

MonetDB: Jan2022 - Use print() instead of sys.stdout.write (STDO...

2022-03-14 Thread Sjoerd Mullender
Changeset: ac75058bf8d2 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/ac75058bf8d2
Modified Files:
testing/Mtest.py.in
Branch: Jan2022
Log Message:

Use print() instead of sys.stdout.write (STDOUT.write).


diffs (truncated from 473 to 300 lines):

diff --git a/testing/Mtest.py.in b/testing/Mtest.py.in
--- a/testing/Mtest.py.in
+++ b/testing/Mtest.py.in
@@ -62,12 +62,12 @@ mapiportre = re.compile(r'mapi:monetdb:/
 geos_version = '@GEOS_VERSION@'.split('.')
 
 # default is no color (these three functions may get redefined)
-def prred(str, write = sys.stdout.write):
-write(str)
-def prgreen(str, write = sys.stdout.write):
-write(str)
-def prpurple(str, write = sys.stdout.write):
-write(str)
+def prred(str):
+print(str, end='')
+def prgreen(str):
+print(str, end='')
+def prpurple(str):
+print(str, end='')
 if isatty:
 if os.name != 'nt':
 # color output a little
@@ -75,24 +75,24 @@ if isatty:
 GREEN = '\033[0;32m'
 PURPLE = '\033[1;35m'   # actually magenta
 BLACK = '\033[0;0m'
-def prred(str, write = sys.stdout.write):
+def prred(str):
 try:
-write(RED)
-write(str)
+print(RED, end='')
+print(str, end='')
 finally:
-write(BLACK)
-def prgreen(str, write = sys.stdout.write):
+print(BLACK, end='')
+def prgreen(str):
 try:
-write(GREEN)
-write(str)
+print(GREEN, end='')
+print(str, end='')
 finally:
-write(BLACK)
-def prpurple(str, write = sys.stdout.write):
+print(BLACK, end='')
+def prpurple(str):
 try:
-write(PURPLE)
-write(str)
+print(PURPLE, end='')
+print(str, end='')
 finally:
-write(BLACK)
+print(BLACK, end='')
 else:
 try:
 import ctypes
@@ -115,36 +115,27 @@ if isatty:
 return wattr
 reset = get_csbi_attributes(handle)
 def prred(str,
-  write=sys.stdout.write,
-  flush=sys.stdout.flush,
   scta=ctypes.windll.kernel32.SetConsoleTextAttribute):
 try:
-flush()
+print(end='', flush=True)
 scta(handle, 0x4)
-write(str)
-flush()
+print(str, end='', flush=True)
 finally:
 scta(handle, reset)
 def prgreen(str,
-write=sys.stdout.write,
-flush=sys.stdout.flush,
 
scta=ctypes.windll.kernel32.SetConsoleTextAttribute):
 try:
-flush()
+print(end='', flush=True)
 scta(handle, 0x2)
-write(str)
-flush()
+print(str, end='', flush=True)
 finally:
 scta(handle, reset)
 def prpurple(str,
- write=sys.stdout.write,
- flush=sys.stdout.flush,
  
scta=ctypes.windll.kernel32.SetConsoleTextAttribute):
 try:
-flush()
+print(end='', flush=True)
 scta(handle, 0x5)
-write(str)
-flush()
+print(str, end='', flush=True)
 finally:
 scta(handle, reset)
 
@@ -166,7 +157,7 @@ if os.path.exists('/usr/bin/coredumpctl'
 pass
 
 def ErrExit(msg):
-sys.stderr.write(msg + '\n')
+print(msg, file=sys.stderr, flush=True)
 sys.exit(1)
 
 def _configure(str):
@@ -580,8 +571,6 @@ class Timer:
 self.timer.cancel()
 self.timer = None
 
-STDOUT = sys.stdout
-STDERR = sys.stdout # err
 REV = ''# revision (output of hg id), default unknown
 
 black = 'black' # #00
@@ -621,9 +610,8 @@ random.seed(time.time())
  AlarmHandler(signum, frame) #
 
 def ErrMsg(TEXT) :
-STDOUT.flush()
-STDERR.write("\n%s:  ERROR:  %s\n\n" % (THISFILE, TEXT))
-STDERR.flush()
+print(end='', flush=True)
+print("\n%s:  ERROR:  %s\n" % (THISFILE, TEXT), file=sys.stderr, 
flush=True)
 ### ErrMsg(TEXT) #
 
 def ErrXit(TEXT) :
@@ -633,12 +621,11 @@ def ErrXit(TEXT) :
 
 def Warn(TEXT) :
 try:
-STDOUT.flush()
+print(end='', flush=True)
 except IOError:
 pass
 try:
-STDERR.write("\n%s  Warning:  %

MonetDB: Jan2022 - Make quiet output (-q option) look like Mz.py...

2022-03-14 Thread Sjoerd Mullender
Changeset: 868f8401b36a for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/868f8401b36a
Modified Files:
testing/Mtest.py.in
testing/Mz.py.in
Branch: Jan2022
Log Message:

Make quiet output (-q option) look like Mz.py output.


diffs (265 lines):

diff --git a/testing/Mtest.py.in b/testing/Mtest.py.in
--- a/testing/Mtest.py.in
+++ b/testing/Mtest.py.in
@@ -1116,7 +1116,7 @@ def SkipTest(env, TST, EXT, REASON, leng
 TSTDIR = env['TSTDIR']
 TEXT = "Skipping test %s%s %s" % (TST, EXT, REASON)
 if quiet:
-print("-", end='')
+pass
 elif verbose:
 Warn(TEXT)
 else:
@@ -1163,21 +1163,39 @@ def SkipTest(env, TST, EXT, REASON, leng
 return td
 ### SkipTest(env, TST, EXT, REASON) #
 
-def find_test_dirs(thisdir) :
-testdirs = []
+def find_test_dirs(thisdir, recursive=True) :
 thisdir = os.path.realpath(thisdir)
 dirnme = os.path.basename(thisdir)
+if not recursive and dirnme != TSTSUFF and 
os.path.isdir(os.path.join(thisdir, TSTSUFF)):
+return find_test_dirs(os.path.join(thisdir, TSTSUFF), recursive)
+testdirs = []
 dirlst = listdir(thisdir)
+tstcnt = 0
 if dirnme == TSTSUFF  and  "All" in dirlst  and  
os.path.isfile(os.path.join(thisdir,"All")):
-testdirs.append(os.path.dirname(thisdir))
-for d in dirlst:
-d = os.path.join(thisdir,d)
-if os.path.isdir(d):
-testdirs = testdirs + find_test_dirs(d)
-return testdirs
+try:
+allf = openutf8(os.path.join(thisdir,"All"))
+except IOError:
+pass
+else:
+cnt = 0
+for tc in allf:
+tc = tc.strip()
+if tc != '' and not tc.startswith('#'):
+cnt += 1
+if cnt > 0:
+testdirs.append(os.path.dirname(thisdir))
+tstcnt += cnt
+if recursive:
+for d in dirlst:
+d = os.path.join(thisdir,d)
+if os.path.isdir(d):
+tst, cnt = find_test_dirs(d)
+testdirs.extend(tst)
+tstcnt += cnt
+return testdirs, tstcnt
 ### find_test_dirs(thisdir) #
 
-def PerformDir(env, testdir, testlist, all_tests = False) :
+def PerformDir(env, testdir, testlist, all_tests, total_tests, test_progress) :
 interrupted = False
 td = 0
 elem = None
@@ -1247,7 +1265,7 @@ def PerformDir(env, testdir, testlist, a
 testlist = alltests
 if not testlist:
 Warn("No tests found in '%s`; skipping directory!" % TSTSRCDIR)
-return td, elem, max(FdOut, FdErr), interrupted
+return td, elem, max(FdOut, FdErr), interrupted, test_progress
 
 # find length of longest test name
 length = 0
@@ -1287,7 +1305,7 @@ def PerformDir(env, testdir, testlist, a
 Warn("database '%s` exists, but destroying it failed; 
skipping tests in '%s`!" % (TSTDB, TSTSRCDIR))
 #TODO:
 # add "something" to HTML output
-return td, elem, max(FdOut, FdErr), interrupted
+return td, elem, max(FdOut, FdErr), interrupted, 
test_progress
 if os.path.isabs(LogDBdir) and not os.path.exists(LogDBdir):
 try:
 os.makedirs(LogDBdir)
@@ -1295,7 +1313,7 @@ def PerformDir(env, testdir, testlist, a
 Warn("creating database '%s` failed; skipping tests in 
'%s`!" % (TSTDB, TSTSRCDIR))
 #TODO:
 # add "something" to HTML output
-return td, elem, max(FdOut, FdErr), interrupted
+return td, elem, max(FdOut, FdErr), interrupted, 
test_progress
 if initdb:
 import zipfile
 try:
@@ -1304,7 +1322,7 @@ def PerformDir(env, testdir, testlist, a
 Warn("initial database '%s` cannot be opened; skipping 
tests in '%s`!" % (initdb, TSTSRCDIR))
 #TODO:
 # add "something" to HTML output
-return td, elem, max(FdOut, FdErr), interrupted
+return td, elem, max(FdOut, FdErr), interrupted, 
test_progress
 try:
 z.extractall(LogDBdir)
 except KeyboardInterrupt:
@@ -1313,7 +1331,7 @@ def PerformDir(env, testdir, testlist, a
 Warn("initial database '%s` cannot be extracted; skipping 
tests in '%s`!" % (initdb, TSTSRCDIR))
 #TODO:
 # add "something" to HTML output
-return td, elem, max(FdOut, FdErr), interrupted
+return td, elem, max(FdOut, FdErr), interrupted, 
test_progress
 z.close()
 if not oneserver:
 pSrvr = 
ServerClass(splitcommand(env['exe']['mserver5'][1]) + ['--dbpath=%s' % 
LogDBdir] + mserver5_opts, open(os.devnull, 'w'), open(os.de

MonetDB: default - Merge with Jan2022 branch.

2022-03-14 Thread Sjoerd Mullender
Changeset: e389c6048508 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/e389c6048508
Modified Files:
testing/Mtest.py.in
testing/Mz.py.in
Branch: default
Log Message:

Merge with Jan2022 branch.


diffs (truncated from 852 to 300 lines):

diff --git a/testing/Mtest.py.in b/testing/Mtest.py.in
--- a/testing/Mtest.py.in
+++ b/testing/Mtest.py.in
@@ -62,12 +62,12 @@ mapiportre = re.compile(r'mapi:monetdb:/
 geos_version = '@GEOS_VERSION@'.split('.')
 
 # default is no color (these three functions may get redefined)
-def prred(str, write = sys.stdout.write):
-write(str)
-def prgreen(str, write = sys.stdout.write):
-write(str)
-def prpurple(str, write = sys.stdout.write):
-write(str)
+def prred(str):
+print(str, end='')
+def prgreen(str):
+print(str, end='')
+def prpurple(str):
+print(str, end='')
 if isatty:
 if os.name != 'nt':
 # color output a little
@@ -75,24 +75,24 @@ if isatty:
 GREEN = '\033[0;32m'
 PURPLE = '\033[1;35m'   # actually magenta
 BLACK = '\033[0;0m'
-def prred(str, write = sys.stdout.write):
+def prred(str):
 try:
-write(RED)
-write(str)
+print(RED, end='')
+print(str, end='')
 finally:
-write(BLACK)
-def prgreen(str, write = sys.stdout.write):
+print(BLACK, end='')
+def prgreen(str):
 try:
-write(GREEN)
-write(str)
+print(GREEN, end='')
+print(str, end='')
 finally:
-write(BLACK)
-def prpurple(str, write = sys.stdout.write):
+print(BLACK, end='')
+def prpurple(str):
 try:
-write(PURPLE)
-write(str)
+print(PURPLE, end='')
+print(str, end='')
 finally:
-write(BLACK)
+print(BLACK, end='')
 else:
 try:
 import ctypes
@@ -115,36 +115,27 @@ if isatty:
 return wattr
 reset = get_csbi_attributes(handle)
 def prred(str,
-  write=sys.stdout.write,
-  flush=sys.stdout.flush,
   scta=ctypes.windll.kernel32.SetConsoleTextAttribute):
 try:
-flush()
+print(end='', flush=True)
 scta(handle, 0x4)
-write(str)
-flush()
+print(str, end='', flush=True)
 finally:
 scta(handle, reset)
 def prgreen(str,
-write=sys.stdout.write,
-flush=sys.stdout.flush,
 
scta=ctypes.windll.kernel32.SetConsoleTextAttribute):
 try:
-flush()
+print(end='', flush=True)
 scta(handle, 0x2)
-write(str)
-flush()
+print(str, end='', flush=True)
 finally:
 scta(handle, reset)
 def prpurple(str,
- write=sys.stdout.write,
- flush=sys.stdout.flush,
  
scta=ctypes.windll.kernel32.SetConsoleTextAttribute):
 try:
-flush()
+print(end='', flush=True)
 scta(handle, 0x5)
-write(str)
-flush()
+print(str, end='', flush=True)
 finally:
 scta(handle, reset)
 
@@ -166,7 +157,7 @@ if os.path.exists('/usr/bin/coredumpctl'
 pass
 
 def ErrExit(msg):
-sys.stderr.write(msg + '\n')
+print(msg, file=sys.stderr, flush=True)
 sys.exit(1)
 
 def _configure(str):
@@ -581,8 +572,6 @@ class Timer:
 self.timer.cancel()
 self.timer = None
 
-STDOUT = sys.stdout
-STDERR = sys.stdout # err
 REV = ''# revision (output of hg id), default unknown
 
 black = 'black' # #00
@@ -622,9 +611,8 @@ random.seed(time.time())
  AlarmHandler(signum, frame) #
 
 def ErrMsg(TEXT) :
-STDOUT.flush()
-STDERR.write("\n%s:  ERROR:  %s\n\n" % (THISFILE, TEXT))
-STDERR.flush()
+print(end='', flush=True)
+print("\n%s:  ERROR:  %s\n" % (THISFILE, TEXT), file=sys.stderr, 
flush=True)
 ### ErrMsg(TEXT) #
 
 def ErrXit(TEXT) :
@@ -634,12 +622,11 @@ def ErrXit(TEXT) :
 
 def Warn(TEXT) :
 try:
-STDOUT.flush()
+print(end='', flush=True)
 except IOError:
 pass
 try:
-STDERR.write("\n%s  Warning:  %s\n\

MonetDB: default - fix projection around semijoin

2022-03-14 Thread Niels Nes
Changeset: 2bb69b5569ff for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/2bb69b5569ff
Modified Files:
sql/server/rel_unnest.c
sql/test/BugTracker-2021/Tests/batappend-undefined.Bug-7130.test
Branch: default
Log Message:

fix projection around semijoin


diffs (32 lines):

diff --git a/sql/server/rel_unnest.c b/sql/server/rel_unnest.c
--- a/sql/server/rel_unnest.c
+++ b/sql/server/rel_unnest.c
@@ -4080,12 +4080,10 @@ rewrite_rel(visitor *v, sql_rel *rel)
assert(is_project(nr->op));
if (!rel_is_ref(nr))
nr = nr->l;
-   sql_rel *n = rel_project(v->sql->sa, nr->l, nr->exps);
-   nr->l = n;
-   nr->r = ir;
-   nr->exps = exps;
-   nr->op = op_semi;
-   set_dependent(nr);
+   sql_rel *s = rel_crossproduct(v->sql->sa, nr->l, ir, 
op_semi);
+   s->exps = exps;
+   set_dependent(s);
+   nr->l = s;
e = exp_rel_update_exp(v->sql, e, false);
exp_reset_props(nr, e, true);
v->changes++;
diff --git a/sql/test/BugTracker-2021/Tests/batappend-undefined.Bug-7130.test 
b/sql/test/BugTracker-2021/Tests/batappend-undefined.Bug-7130.test
--- a/sql/test/BugTracker-2021/Tests/batappend-undefined.Bug-7130.test
+++ b/sql/test/BugTracker-2021/Tests/batappend-undefined.Bug-7130.test
@@ -60,7 +60,7 @@ select (select (select 1 where subq_0.c0
 statement error GDK reported error: BATsubcross: more than one match
 select 1 from t_qh left outer join (select 2) as subq_0(c1) on EXISTS(select 1 
from t_qh as ref_6 where 2 = (select 1 from t_qh where ref_6.c_f = 1 or 
subq_0.c1 is NULL))
 
-statement error GDK reported error: mergejoin: more than one match
+statement error GDK reported error: BATsubcross: more than one match
 select EXISTS(select 1 from t_qh left outer join (select cast(2 as INTEGER) 
from t_qh) as subq_0(c1) on true <> EXISTS(select 1 from t_qh as ref_6 where 2 <
 (select subq_0.c1 as c0 from t_qh where (1 <> ref_6.c_f) or (subq_0.c1 is 
NULL from (select 30 from t_qh) as subq_0(c1)
 
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - merged

2022-03-14 Thread Niels Nes
Changeset: 2d4810d81cc6 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/2d4810d81cc6
Branch: default
Log Message:

merged


diffs (truncated from 852 to 300 lines):

diff --git a/testing/Mtest.py.in b/testing/Mtest.py.in
--- a/testing/Mtest.py.in
+++ b/testing/Mtest.py.in
@@ -62,12 +62,12 @@ mapiportre = re.compile(r'mapi:monetdb:/
 geos_version = '@GEOS_VERSION@'.split('.')
 
 # default is no color (these three functions may get redefined)
-def prred(str, write = sys.stdout.write):
-write(str)
-def prgreen(str, write = sys.stdout.write):
-write(str)
-def prpurple(str, write = sys.stdout.write):
-write(str)
+def prred(str):
+print(str, end='')
+def prgreen(str):
+print(str, end='')
+def prpurple(str):
+print(str, end='')
 if isatty:
 if os.name != 'nt':
 # color output a little
@@ -75,24 +75,24 @@ if isatty:
 GREEN = '\033[0;32m'
 PURPLE = '\033[1;35m'   # actually magenta
 BLACK = '\033[0;0m'
-def prred(str, write = sys.stdout.write):
+def prred(str):
 try:
-write(RED)
-write(str)
+print(RED, end='')
+print(str, end='')
 finally:
-write(BLACK)
-def prgreen(str, write = sys.stdout.write):
+print(BLACK, end='')
+def prgreen(str):
 try:
-write(GREEN)
-write(str)
+print(GREEN, end='')
+print(str, end='')
 finally:
-write(BLACK)
-def prpurple(str, write = sys.stdout.write):
+print(BLACK, end='')
+def prpurple(str):
 try:
-write(PURPLE)
-write(str)
+print(PURPLE, end='')
+print(str, end='')
 finally:
-write(BLACK)
+print(BLACK, end='')
 else:
 try:
 import ctypes
@@ -115,36 +115,27 @@ if isatty:
 return wattr
 reset = get_csbi_attributes(handle)
 def prred(str,
-  write=sys.stdout.write,
-  flush=sys.stdout.flush,
   scta=ctypes.windll.kernel32.SetConsoleTextAttribute):
 try:
-flush()
+print(end='', flush=True)
 scta(handle, 0x4)
-write(str)
-flush()
+print(str, end='', flush=True)
 finally:
 scta(handle, reset)
 def prgreen(str,
-write=sys.stdout.write,
-flush=sys.stdout.flush,
 
scta=ctypes.windll.kernel32.SetConsoleTextAttribute):
 try:
-flush()
+print(end='', flush=True)
 scta(handle, 0x2)
-write(str)
-flush()
+print(str, end='', flush=True)
 finally:
 scta(handle, reset)
 def prpurple(str,
- write=sys.stdout.write,
- flush=sys.stdout.flush,
  
scta=ctypes.windll.kernel32.SetConsoleTextAttribute):
 try:
-flush()
+print(end='', flush=True)
 scta(handle, 0x5)
-write(str)
-flush()
+print(str, end='', flush=True)
 finally:
 scta(handle, reset)
 
@@ -166,7 +157,7 @@ if os.path.exists('/usr/bin/coredumpctl'
 pass
 
 def ErrExit(msg):
-sys.stderr.write(msg + '\n')
+print(msg, file=sys.stderr, flush=True)
 sys.exit(1)
 
 def _configure(str):
@@ -581,8 +572,6 @@ class Timer:
 self.timer.cancel()
 self.timer = None
 
-STDOUT = sys.stdout
-STDERR = sys.stdout # err
 REV = ''# revision (output of hg id), default unknown
 
 black = 'black' # #00
@@ -622,9 +611,8 @@ random.seed(time.time())
  AlarmHandler(signum, frame) #
 
 def ErrMsg(TEXT) :
-STDOUT.flush()
-STDERR.write("\n%s:  ERROR:  %s\n\n" % (THISFILE, TEXT))
-STDERR.flush()
+print(end='', flush=True)
+print("\n%s:  ERROR:  %s\n" % (THISFILE, TEXT), file=sys.stderr, 
flush=True)
 ### ErrMsg(TEXT) #
 
 def ErrXit(TEXT) :
@@ -634,12 +622,11 @@ def ErrXit(TEXT) :
 
 def Warn(TEXT) :
 try:
-STDOUT.flush()
+print(end='', flush=True)
 except IOError:
 pass
 try:
-STDERR.write("\n%s  Warning:  %s\n\n" % (THISFILE, TEXT))
-STDERR.flush()
+print("\n%s  Warning:  %s\n" % (T

MonetDB: Jan2022 - Make production of HTML files an option.

2022-03-14 Thread Sjoerd Mullender
Changeset: 4c6d497a64b2 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/4c6d497a64b2
Modified Files:
testing/Mtest.py.in
Branch: Jan2022
Log Message:

Make production of HTML files an option.
Option is ON by default if program is called Mtest.py and can be turned
off with the --no-html flag.  It is OFF if program is called Mz.py and
can be turned on with the --produce-html flag.


diffs (260 lines):

diff --git a/testing/Mtest.py.in b/testing/Mtest.py.in
--- a/testing/Mtest.py.in
+++ b/testing/Mtest.py.in
@@ -47,6 +47,7 @@ approve = False
 initdb = None
 single_in_memory = False
 restart = False
+produce_html = True
 
 # extra mserver5 options
 mserver5_opts = []
@@ -301,8 +302,10 @@ def splitcommand(cmd):
 def remove(file):
 try:
 os.remove(file)
+except FileNotFound:
+pass
 except:
-pass
+Warn('could not remove {}'.format(file))
 
 def isexecutable(TST, ext = '.sh') :
 if   os.name == "nt":
@@ -1136,7 +1139,7 @@ def SkipTest(env, TST, EXT, REASON, leng
 s = '%-*s' % (length, TST)
 print('%s%s skipped (%s)' % (prompt(), s, REASON))
 
-if testweb:
+if testweb or not produce_html:
 return None
 
 f = openutf8(".%s.SKIPPED.html" % TST, "w")
@@ -1445,11 +1448,10 @@ def PerformDir(env, testdir, testlist, a
 for f in alllinks:
 remove(f)
 
-if THISFILE == "Mtest.py":
-if not testweb:
-body = body_bad + body_good
-CreateHtmlIndex(env, ssout, sserr, *body)
-elem = AddSubToHtmlIndex(env, TSTDIR, max(FdOut, FdErr, ssout, 
sserr))
+if not testweb and produce_html:
+body = body_bad + body_good
+CreateHtmlIndex(env, ssout, sserr, *body)
+elem = AddSubToHtmlIndex(env, TSTDIR, max(FdOut, FdErr, ssout, 
sserr))
 
 # remove extra files created by tests
 for f in listdir(TSTTRGDIR):
@@ -1814,41 +1816,6 @@ def StableOutErr(env,par,TST,SYST,RELEAS
 return STABLEout, STABLEerr
 ### StableOutErr(env,par,TST,SYST,RELEASE,DIST,VERSION) #
 
-def CategorizeResult(TST, SockTime):
-l = ''   # assign something in case file is empty
-for l in openutf8("%s.out.diff.html" % TST):
-pass
-if   l.startswith(''):
-o = F_OK
-elif l.startswith(''):
-o = F_WARN
-elif l.startswith(''):
-o = F_ERROR
-else:
-Warn("Unexpected last line in %s.out.diff.html:\n%s" % (TST, l))
-ff = openutf8("%s.out.diff.html" % TST, "a")
-ff.write("\n\n")
-ff.close()
-o = F_ERROR
-l = ''   # assign something in case file is empty
-for l in openutf8("%s.err.diff.html" % TST):
-pass
-if   l.startswith(''):
-e = F_OK
-elif l.startswith(''):
-e = F_WARN
-elif l.startswith(''):
-e = F_ERROR
-else:
-Warn("Unexpected last line in %s.err.diff.html:\n%s" % (TST, l))
-ff = openutf8("%s.err.diff.html" % TST, "a")
-ff.write("\n\n")
-ff.close()
-e = F_ERROR
-if e == F_ERROR and SockTime in (F_SOCK, F_TIME, F_RECU, F_ABRT, F_SEGV):
-e = SockTime
-return o, e
-
 relcond = {
 # upgrade testing conditionals:
 # key is condition, value is tuple with file name and part of message
@@ -2283,52 +2250,54 @@ def RunTest(env, TST, COND, oktests, len
 tst = '%shttp://bugs.monetdb.org/%s";>%s%s' % (TST[:res.start(0)+1], bugno, 
res.group(0)[1:], TST[res.end(0):])
 else:
 tst = TST
-titlefmt = '-tTest %s%s (id %s) (%%s)' % (tst, EXT, f, REV, TST)
-else:
-# no need (and no space) to add link to bug report:
-# it's done already elsewhere
-titlefmt = '-tTest %s%s (id %s) (%%s)' % (TST, EXT, TST, EXT, 
f, REV, TST)
-elif testweb:
-titlefmt = '-tTest %s%s (%%s)' % 
(TST, EXT, TST)
+out = openutf8('%s.test.out' % TST).read()
+if out and [x for x in out.splitlines() if not x.startswith('#')]:
+FailedOut = F_ERROR
 else:
-titlefmt = '-tTest %s%s (%%s)' % (TST, EXT, TST, EXT, TST)
-diff_html = openutf8('%s.out.diff.html' % TST,"w")
-out = openutf8('%s.test.out' % TST).read()
-Element('html', None,
-# Element('head', None,
-# Element('style', None,
-# Text('''
+FailedOut = F_OK
+err = openutf8('%s.test.err' % TST).read()
+if err and [x for x in err.splitlines() if not x.startswith('#')]:
+if max(sockerr, errcode) in (F_SOCK, F_TIME, F_RECU, F_ABRT, 
F_SEGV):
+FailedErr = max(sockerr, errcode)
+else:
+FailedErr = F_ERROR
+else:
+FailedErr = F_OK
+if produce_html:
+diff_html = openutf8('%s.out.diff.html' % TST,"w")
+   

MonetDB: Jan2022 - Remove --quiet option, allow --verbose to be ...

2022-03-14 Thread Sjoerd Mullender
Changeset: 487c590f17eb for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/487c590f17eb
Modified Files:
testing/Mtest.py.in
Branch: Jan2022
Log Message:

Remove --quiet option, allow --verbose to be used twice.
The default is now Mz-like output, using --verbose once is what Mtest
used to do, using --verbose twice is what a single --verbose used to do.


diffs (287 lines):

diff --git a/testing/Mtest.py.in b/testing/Mtest.py.in
--- a/testing/Mtest.py.in
+++ b/testing/Mtest.py.in
@@ -40,8 +40,7 @@ except ImportError:
 MonetDB_VERSION = '@MONETDB_VERSION@'.split('.')
 
 procdebug = False
-verbose = False
-quiet = False
+verbosity = 0
 approve = False
 
 initdb = None
@@ -1118,11 +1117,9 @@ def AddSubToHtmlIndex (env, TSTDIR, diff
 def SkipTest(env, TST, EXT, REASON, length) :
 TSTDIR = env['TSTDIR']
 TEXT = "Skipping test %s%s %s" % (TST, EXT, REASON)
-if quiet:
-pass
-elif verbose:
+if verbosity > 1:
 Warn(TEXT)
-else:
+elif verbosity == 1:
 if REASON.startswith('as '):
 REASON = REASON[3:]
 if REASON.endswith('.'):
@@ -1347,7 +1344,7 @@ def PerformDir(env, testdir, testlist, a
 body_good = []
 body_bad = []
 oktests = []
-if not verbose and not quiet:
+if verbosity == 1:
 print('\nRunning in %s' % TSTDIR)
 alllinks = []
 pSrvr = None
@@ -1388,7 +1385,7 @@ def PerformDir(env, testdir, testlist, a
 print('\nFailed to start server.\n')
 break
 os.environ['MAPIPORT'] = env['MAPIPORT'] = pSrvr.port
-SetExecEnv(env['exe'],pSrvr.port,verbose)
+SetExecEnv(env['exe'], pSrvr.port, verbosity > 1)
 if global_timeout and start_time + global_timeout < 
time.time():
 if not testweb:
 print('\nGlobal testing timeout reached\n')
@@ -1910,14 +1907,12 @@ def RunTest(env, TST, COND, oktests, len
 #elif os.name == "posix":
 else:
 reason = "test missing: 
'"+os.path.join(TSTSRCDIR,TST)+"[.py|.malC|.sql|.R|.rb]`"
-if quiet:
-pass
-elif verbose:
+if verbosity > 1:
 print('%s%s  ' %
   (prompt(), os.path.join(env['TSTDIR'], TST + EXT)), 
end='')
 prred('TEST MISSING')
 print()
-else:
+elif verbosity == 1:
 if ttywidth > 0 and length + 10 + 21 >= ttywidth:
 # 10 - length of prompt()
 # 21 - length of time plus result
@@ -2140,7 +2135,7 @@ def RunTest(env, TST, COND, oktests, len
 tres = DoIt(env, SERVER, CALL, TST, EXT, TestOutFile, TestErrFile, 
TIMEOUT, ME, length, nomito, threads, user, passwd, COND, all_tests, pSrvr, 
total_tests, test_progress)
 t1 = time.time()
 TX = t1 - t0
-if not quiet:
+if verbosity > 0:
 print(" %7.3fs " % TX, end='')
 
 if tres == 'timeout':
@@ -2190,36 +2185,36 @@ def RunTest(env, TST, COND, oktests, len
 ##if [ -f .all.left-over.tmp.bats. ] ; then  mv -f 
.all.left-over.tmp.bats. $TSTTRGBASE/Tests/.old.left-over.tmp.bats. ; fi
 
 if tres == 'socket':
-if quiet:
+if verbosity == 0:
 print("\n%s : Socket!" % TST)
-elif verbose:
+elif verbosity > 1:
 print("(Socket!) ", end='')
 
 if tres == 'timeout':
-if quiet:
+if verbosity == 0:
 print("\n%s : Timeout!" % TST)
-elif verbose:
+elif verbosity > 1:
 print("(Timeout!) ", end='')
 
 if tres == 'recursion':
-if quiet:
+if verbosity == 0:
 print("\n%s : Recursion!" % TST)
-elif verbose:
+elif verbosity > 1:
 print("(Recursion!) ", end='')
 
 if tres == 'segfault':
-if quiet:
+if verbosity == 0:
 print("\n%s : Crashed!" % TST)
-elif verbose:
+elif verbosity > 1:
 print("(Crashed!) ", end='')
 
 if tres == 'signal':
-if quiet:
+if verbosity == 0:
 print("\n%s : Signaled!" % TST)
-elif verbose:
+elif verbosity > 1:
 print("(Signaled!) ", end='')
 
-if verbose:
+if verbosity > 1:
 print()
 
 try:
@@ -2313,7 +2308,7 @@ def RunTest(env, TST, COND, oktests, len
 elem = AddTstToHtmlIndex(env, TST, STABLEout, STABLEerr, EXT,
  FailedOut, FailedErr)
 
-if not verbose and not quiet:
+if verbosity == 1:
 if tres == 'socket':
 prpurple('SOCKET')
 elif tres == 'timeout':
@@ -2670,9 +26

MonetDB: Jan2022 - Change default verbosity in testweb.

2022-03-14 Thread Sjoerd Mullender
Changeset: e709c99f52de for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/e709c99f52de
Modified Files:
testing/Mtest.py.in
Branch: Jan2022
Log Message:

Change default verbosity in testweb.


diffs (12 lines):

diff --git a/testing/Mtest.py.in b/testing/Mtest.py.in
--- a/testing/Mtest.py.in
+++ b/testing/Mtest.py.in
@@ -3382,6 +3382,8 @@ def main(argv) :
 addreqs = False
 all_tests = False
 testweb = opts.testweb
+if testweb and verbosity == 0:
+verbosity = 1
 CONDITIONALS['RELEASERUN'] = opts.releaserun
 nomito = opts.nomito
 global restart
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - Merge with Jan2022 branch.

2022-03-14 Thread Sjoerd Mullender
Changeset: c84795f72cea for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/c84795f72cea
Modified Files:
testing/Mtest.py.in
Branch: default
Log Message:

Merge with Jan2022 branch.


diffs (truncated from 526 to 300 lines):

diff --git a/testing/Mtest.py.in b/testing/Mtest.py.in
--- a/testing/Mtest.py.in
+++ b/testing/Mtest.py.in
@@ -40,13 +40,13 @@ except ImportError:
 MonetDB_VERSION = '@MONETDB_VERSION@'.split('.')
 
 procdebug = False
-verbose = False
-quiet = False
+verbosity = 0
 approve = False
 
 initdb = None
 single_in_memory = False
 restart = False
+produce_html = True
 
 # extra mserver5 options
 mserver5_opts = []
@@ -301,8 +301,10 @@ def splitcommand(cmd):
 def remove(file):
 try:
 os.remove(file)
+except FileNotFound:
+pass
 except:
-pass
+Warn('could not remove {}'.format(file))
 
 def isexecutable(TST, ext = '.sh') :
 if   os.name == "nt":
@@ -1116,11 +1118,9 @@ def AddSubToHtmlIndex (env, TSTDIR, diff
 def SkipTest(env, TST, EXT, REASON, length) :
 TSTDIR = env['TSTDIR']
 TEXT = "Skipping test %s%s %s" % (TST, EXT, REASON)
-if quiet:
-pass
-elif verbose:
+if verbosity > 1:
 Warn(TEXT)
-else:
+elif verbosity == 1:
 if REASON.startswith('as '):
 REASON = REASON[3:]
 if REASON.endswith('.'):
@@ -1137,7 +1137,7 @@ def SkipTest(env, TST, EXT, REASON, leng
 s = '%-*s' % (length, TST)
 print('%s%s skipped (%s)' % (prompt(), s, REASON))
 
-if testweb:
+if testweb or not produce_html:
 return None
 
 f = openutf8(".%s.SKIPPED.html" % TST, "w")
@@ -1345,7 +1345,7 @@ def PerformDir(env, testdir, testlist, a
 body_good = []
 body_bad = []
 oktests = []
-if not verbose and not quiet:
+if verbosity == 1:
 print('\nRunning in %s' % TSTDIR)
 alllinks = []
 pSrvr = None
@@ -1386,7 +1386,7 @@ def PerformDir(env, testdir, testlist, a
 print('\nFailed to start server.\n')
 break
 os.environ['MAPIPORT'] = env['MAPIPORT'] = pSrvr.port
-SetExecEnv(env['exe'],pSrvr.port,verbose)
+SetExecEnv(env['exe'], pSrvr.port, verbosity > 1)
 if global_timeout and start_time + global_timeout < 
time.time():
 if not testweb:
 print('\nGlobal testing timeout reached\n')
@@ -1446,11 +1446,10 @@ def PerformDir(env, testdir, testlist, a
 for f in alllinks:
 remove(f)
 
-if THISFILE == "Mtest.py":
-if not testweb:
-body = body_bad + body_good
-CreateHtmlIndex(env, ssout, sserr, *body)
-elem = AddSubToHtmlIndex(env, TSTDIR, max(FdOut, FdErr, ssout, 
sserr))
+if not testweb and produce_html:
+body = body_bad + body_good
+CreateHtmlIndex(env, ssout, sserr, *body)
+elem = AddSubToHtmlIndex(env, TSTDIR, max(FdOut, FdErr, ssout, 
sserr))
 
 # remove extra files created by tests
 for f in listdir(TSTTRGDIR):
@@ -1815,41 +1814,6 @@ def StableOutErr(env,par,TST,SYST,RELEAS
 return STABLEout, STABLEerr
 ### StableOutErr(env,par,TST,SYST,RELEASE,DIST,VERSION) #
 
-def CategorizeResult(TST, SockTime):
-l = ''   # assign something in case file is empty
-for l in openutf8("%s.out.diff.html" % TST):
-pass
-if   l.startswith(''):
-o = F_OK
-elif l.startswith(''):
-o = F_WARN
-elif l.startswith(''):
-o = F_ERROR
-else:
-Warn("Unexpected last line in %s.out.diff.html:\n%s" % (TST, l))
-ff = openutf8("%s.out.diff.html" % TST, "a")
-ff.write("\n\n")
-ff.close()
-o = F_ERROR
-l = ''   # assign something in case file is empty
-for l in openutf8("%s.err.diff.html" % TST):
-pass
-if   l.startswith(''):
-e = F_OK
-elif l.startswith(''):
-e = F_WARN
-elif l.startswith(''):
-e = F_ERROR
-else:
-Warn("Unexpected last line in %s.err.diff.html:\n%s" % (TST, l))
-ff = openutf8("%s.err.diff.html" % TST, "a")
-ff.write("\n\n")
-ff.close()
-e = F_ERROR
-if e == F_ERROR and SockTime in (F_SOCK, F_TIME, F_RECU, F_ABRT, F_SEGV):
-e = SockTime
-return o, e
-
 relcond = {
 # upgrade testing conditionals:
 # key is condition, value is tuple with file name and part of message
@@ -1944,14 +1908,12 @@ def RunTest(env, TST, COND, oktests, len
 #elif os.name == "posix":
 else:
 reason = "test missing: 
'"+os.path.join(TSTSRCDIR,TST)+"[.py|.malC|.sql|.R|.rb]`"
-if quiet:
-pass
-elif verbose:
+if verbosity > 1:
 print('%s%s  ' %
   (prompt(), os.path.join(env['TSTDIR'], TST + EXT)

MonetDB: Jan2022 - Add a space after the shell prompt in examples.

2022-03-14 Thread Sjoerd Mullender
Changeset: d18c34787d97 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/d18c34787d97
Modified Files:
documentation/source/developers_handbook.rst
testing/SQLogicConvertNotes
Branch: Jan2022
Log Message:

Add a space after the shell prompt in examples.


diffs (24 lines):

diff --git a/documentation/source/developers_handbook.rst 
b/documentation/source/developers_handbook.rst
--- a/documentation/source/developers_handbook.rst
+++ b/documentation/source/developers_handbook.rst
@@ -120,7 +120,7 @@ Consider the following single client con
 Alternatively existing ``.sql`` scripts can be converted to sqllogic tests 
(.test) with ``Mconvert.py``.
 For example::
 
-$Mconvert.py  --auto /Tests .sql
+$ Mconvert.py  --auto /Tests .sql
 
 All new tests need to be placed in the appropriate test folder and their name 
respectively in the
 index ``All`` file.
diff --git a/testing/SQLogicConvertNotes b/testing/SQLogicConvertNotes
--- a/testing/SQLogicConvertNotes
+++ b/testing/SQLogicConvertNotes
@@ -2,7 +2,7 @@ Mconvert.py
 ---
 Converts one test folder at the time. Only relevant option is `--auto`. When 
present a sqlogic test will be created for each matching .sql test. By default 
prints all to stdout. As initial dry run probably is a good idea to run without 
`--auto` option to see whether something goes wrong. 
 
-$Mconvert.py --auto sql/test/BugTracker-2008 
+$ Mconvert.py --auto sql/test/BugTracker-2008
 
 (deprecated) testing/convert_to_sqllogic.sh 
 --
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: Jan2022 - Pointer can be NULL in case of error, so chec...

2022-03-14 Thread Sjoerd Mullender
Changeset: 2115e51cbd98 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/2115e51cbd98
Modified Files:
clients/mapilib/mapi.c
Branch: Jan2022
Log Message:

Pointer can be NULL in case of error, so check for it.


diffs (12 lines):

diff --git a/clients/mapilib/mapi.c b/clients/mapilib/mapi.c
--- a/clients/mapilib/mapi.c
+++ b/clients/mapilib/mapi.c
@@ -4358,7 +4358,7 @@ read_into_cache(MapiHdl hdl, int lookahe
for (;;) {
line = read_line(mid);
if (line == NULL) {
-   if (mnstr_eof(mid->from)) {
+   if (mid->from && mnstr_eof(mid->from)) {
mapi_log_record(mid, "unexpected end of file");
mapi_log_record(mid, __func__);
close_connection(mid);
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: sqloptimizer - Adding optimizer benchmark information. ...

2022-03-14 Thread Pedro Ferreira
Changeset: b6eff70df7f0 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/b6eff70df7f0
Modified Files:
sql/backends/monet5/rel_bin.c
sql/backends/monet5/sql.c
sql/backends/monet5/sql_cat.c
sql/backends/monet5/sql_execute.c
sql/backends/monet5/sql_gencode.c
sql/backends/monet5/sql_statement.c
sql/backends/monet5/sql_upgrades.c
sql/server/rel_optimizer.c
sql/server/rel_optimizer.h
sql/server/sql_mvc.c
sql/server/sql_mvc.h
sql/server/sql_partition.c
Branch: sqloptimizer
Log Message:

Adding optimizer benchmark information. Cleanup


diffs (truncated from 364 to 300 lines):

diff --git a/sql/backends/monet5/rel_bin.c b/sql/backends/monet5/rel_bin.c
--- a/sql/backends/monet5/rel_bin.c
+++ b/sql/backends/monet5/rel_bin.c
@@ -3904,7 +3904,7 @@ sql_parse(backend *be, sql_schema *s, co
sql_rel *rel = rel_parse(be->mvc, s, query, mode);
stmt *sq = NULL;
 
-   if (rel && (rel = sql_processrelation(be->mvc, rel, 1, 1, 1)))
+   if (rel && (rel = sql_processrelation(be->mvc, rel, 0, 1, 1, 1)))
sq = rel_bin(be, rel);
return sq;
 }
diff --git a/sql/backends/monet5/sql.c b/sql/backends/monet5/sql.c
--- a/sql/backends/monet5/sql.c
+++ b/sql/backends/monet5/sql.c
@@ -123,11 +123,12 @@ sql_symbol2relation(backend *be, symbol 
sql_query *query = query_create(be->mvc);
lng Tbegin;
int extra_opts = be->mvc->emode != m_prepare;
+   int profile = be->mvc->emode == m_plan;
 
rel = rel_semantic(query, sym);
Tbegin = GDKusec();
if (rel)
-   rel = sql_processrelation(be->mvc, rel, 1, extra_opts, 
extra_opts);
+   rel = sql_processrelation(be->mvc, rel, profile, 1, extra_opts, 
extra_opts);
if (rel)
rel = rel_partition(be->mvc, rel);
if (rel && (rel_no_mitosis(be->mvc, rel) || 
rel_need_distinct_query(rel)))
@@ -450,7 +451,7 @@ create_table_or_view(mvc *sql, char *sna
 
r = rel_parse(sql, s, nt->query, m_deps);
if (r)
-   r = sql_processrelation(sql, r, 0, 0, 0);
+   r = sql_processrelation(sql, r, 0, 0, 0, 0);
if (r) {
list *blist = rel_dependencies(sql, r);
if (mvc_create_dependencies(sql, blist, nt->base.id, 
VIEW_DEPENDENCY)) {
diff --git a/sql/backends/monet5/sql_cat.c b/sql/backends/monet5/sql_cat.c
--- a/sql/backends/monet5/sql_cat.c
+++ b/sql/backends/monet5/sql_cat.c
@@ -571,7 +571,7 @@ create_trigger(mvc *sql, char *sname, ch
}
r = rel_parse(sql, s, buf, m_deps);
if (r)
-   r = sql_processrelation(sql, r, 0, 0, 0);
+   r = sql_processrelation(sql, r, 0, 0, 0, 0);
if (r) {
list *blist = rel_dependencies(sql, r);
if (mvc_create_dependencies(sql, blist, 
tri->base.id, TRIGGER_DEPENDENCY)) {
@@ -1060,7 +1060,7 @@ create_func(mvc *sql, char *sname, char 
}
r = rel_parse(sql, s, buf, m_deps);
if (r)
-   r = sql_processrelation(sql, r, 0, 0, 0);
+   r = sql_processrelation(sql, r, 0, 0, 0, 0);
if (r) {
node *n;
list *blist = rel_dependencies(sql, r);
diff --git a/sql/backends/monet5/sql_execute.c 
b/sql/backends/monet5/sql_execute.c
--- a/sql/backends/monet5/sql_execute.c
+++ b/sql/backends/monet5/sql_execute.c
@@ -775,7 +775,7 @@ RAstatement(Client c, MalBlkPtr mb, MalS
refs = sa_list(m->sa);
rel = rel_read(m, *expr, &pos, refs);
if (*opt && rel)
-   rel = sql_processrelation(m, rel, 0, 0, 0);
+   rel = sql_processrelation(m, rel, 0, 0, 0, 0);
if (!rel) {
if (strlen(m->errstr) > 6 && m->errstr[5] == '!')
msg = createException(SQL, "RAstatement", "%s", 
m->errstr);
@@ -972,7 +972,7 @@ RAstatement2(Client cntxt, MalBlkPtr mb,
refs = sa_list(m->sa);
rel = rel_read(m, expr, &pos, refs);
if (rel)
-   rel = sql_processrelation(m, rel, 0, 0, 0);
+   rel = sql_processrelation(m, rel, 0, 0, 0, 0);
if (!rel) {
if (strlen(m->errstr) > 6 && m->errstr[5] == '!')
msg = createException(SQL, "RAstatement2", "%s", 
m->errstr);
diff --git a/sql/backends/monet5/sql_gencode.c 
b/sql/backends/monet5/sql_gencode.c
--- a/sql/backends/monet5/sql_gencode.c
+++ b/sql/backends/monet5/sql_gencode.c
@@ -1206,7 +1206,7 @@ backend_create_sql_func(backend *be, sql
 
r = rel_parse(m, f->s, f->query, m_instantiate);
if (r)
-   r = sql_processrelation(m, r, 1, 1, 0);
+   r = sql_processrelat

MonetDB: sqloptimizer - Merged with default

2022-03-14 Thread Pedro Ferreira
Changeset: 5a5aa119e2f9 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/5a5aa119e2f9
Modified Files:
sql/server/rel_rewriter.c
sql/server/rel_unnest.c
Branch: sqloptimizer
Log Message:

Merged with default


diffs (truncated from 1625 to 300 lines):

diff --git a/cmake/monetdb-packages.cmake b/cmake/monetdb-packages.cmake
--- a/cmake/monetdb-packages.cmake
+++ b/cmake/monetdb-packages.cmake
@@ -23,7 +23,7 @@ include(monetdb-wix-packages)
 if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
   get_os_release_info(LINUX_DISTRO LINUX_DISTRO_VERSION)
 
-  if (${LINUX_DISTRO} STREQUAL "debian")
+  if ("${LINUX_DISTRO}" STREQUAL "debian")
 monetdb_debian_extra_files()
   endif()
 endif()
diff --git a/sql/server/rel_rewriter.c b/sql/server/rel_rewriter.c
--- a/sql/server/rel_rewriter.c
+++ b/sql/server/rel_rewriter.c
@@ -188,7 +188,7 @@ rewrite_simplify_exp(visitor *v, sql_rel
if (is_func(l->type) && exp_is_false(r) && 
(is_anyequal_func(((sql_subfunc*)l->f)) || 
is_exists_func(((sql_subfunc*)l->f {
sql_subfunc *sf = l->f;
if (is_anyequal_func(sf))
-   return exp_in_func(v->sql, l, r, !is_anyequal(sf), 
0);
+   return exp_in_func(v->sql, 
((list*)l->l)->h->data, ((list*)l->l)->h->next->data, !is_anyequal(sf), 0);
if (is_exists_func(sf))
return exp_exists(v->sql, 
((list*)l->l)->h->data, !is_exists(sf));
return l;
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
@@ -3500,6 +3500,9 @@ static sql_exp *
if (is_sql_groupby(f)) {
char *uaname = SA_NEW_ARRAY(sql->ta, char, 
strlen(aname) + 1);
return sql_error(sql, 02, SQLSTATE(42000) "%s: 
aggregate function '%s' not allowed in GROUP BY clause", toUpperCopy(uaname, 
aname), aname);
+   } else if (is_sql_aggr(f) && groupby->grouped) {
+   char *uaname = SA_NEW_ARRAY(sql->ta, char, 
strlen(aname) + 1);
+   return sql_error(sql, 02, SQLSTATE(42000) "%s: 
aggregate functions cannot be nested", toUpperCopy(uaname, aname));
} else if (is_sql_values(f)) {
char *uaname = SA_NEW_ARRAY(sql->ta, char, 
strlen(aname) + 1);
return sql_error(sql, 02, SQLSTATE(42000) "%s: 
aggregate functions not allowed on an unique value", toUpperCopy(uaname, 
aname));
@@ -3583,8 +3586,10 @@ static sql_exp *
if (exp && !is_groupby_col(res, exp)) {
if (is_sql_groupby(sql_state))
return sql_error(sql, 05, 
SQLSTATE(42000) "SELECT: aggregate function '%s' not allowed in GROUP BY 
clause", aname);
-   if (0 && is_sql_aggr(sql_state))
-   return sql_error(sql, 05, 
SQLSTATE(42000) "SELECT: aggregate function calls cannot be nested");
+   if (is_sql_aggr(sql_state) && groupby->grouped) 
{
+   char *uaname = SA_NEW_ARRAY(sql->ta, 
char, strlen(aname) + 1);
+   return sql_error(sql, 02, 
SQLSTATE(42000) "%s: aggregate functions cannot be nested", toUpperCopy(uaname, 
aname));
+   }
if (is_sql_values(sql_state))
return sql_error(sql, 05, 
SQLSTATE(42000) "SELECT: aggregate functions not allowed on an unique value");
if (is_sql_update_set(sql_state) || 
is_sql_psm(f))
diff --git a/sql/server/rel_unnest.c b/sql/server/rel_unnest.c
--- a/sql/server/rel_unnest.c
+++ b/sql/server/rel_unnest.c
@@ -1358,6 +1358,8 @@ push_up_join(mvc *sql, sql_rel *rel, lis
if (is_outerjoin(j->op) && j->exps && 
!list_empty(rel->attr)) {
visitor v = { .sql = sql };
rel->r = j = rewrite_outer2inner_union(&v, j);
+   if (!j)
+   return NULL;
return rel;
}
 
@@ -3368,19 +3370,7 @@ rewrite_exists(visitor *v, sql_rel *rel,
if (!is_project(sq->op) || (is_set(sq->op) && 
list_length(sq->exps) > 1) || (is_simple_project(sq->op) && !list_empty(sq->r)))
sq = rel_project(v->sql->sa, sq, 
rel_projections(v->sql, sq, NULL, 1, 1));
le = rel_reduce2one_exp(v->sql, sq);
-   if (is_project(sq->op) && is_freevar(le)) {
-   sql_exp *re, *jc, *null;
-
-   re = rel_bound_exp(v-

MonetDB: Jan2022 - Print some information when there were errors.

2022-03-14 Thread Sjoerd Mullender
Changeset: 6d35760f6a37 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/6d35760f6a37
Modified Files:
testing/Mtest.py.in
Branch: Jan2022
Log Message:

Print some information when there were errors.
When producing HTML, print a URL for the index page, when not producing
HTML, print the error output.


diffs (38 lines):

diff --git a/testing/Mtest.py.in b/testing/Mtest.py.in
--- a/testing/Mtest.py.in
+++ b/testing/Mtest.py.in
@@ -642,7 +642,7 @@ def startswithpath(str,pre) :
 ##def url(str) :
 ##return str.replace(os.sep, '/')
 ### url(str) #
-import urllib.request
+import urllib.request, urllib.parse
 path = urllib.request.url2pathname
 def url(str) :
 url = urllib.request.pathname2url(str)
@@ -2293,6 +2293,16 @@ def RunTest(env, TST, COND, oktests, len
 else:
 diff_html.write('\n')
 diff_html.close()
+elif FailedOut > F_WARN or FailedErr > F_WARN:
+print()
+print('')
+prred('ERROR: ')
+print(os.path.join(TSTDIR, TST + EXT))
+print('')
+with openutf8(TestErrFile, 'r') as f:
+print(f.read())
+print()
+
 if FailedOut == F_OK and FailedErr == F_OK and testweb:
 for f in ['%s.out.diff.html' % TST, '%s.test.out' % TST,
   '%s.server.out' % TST, '%s.client.out' % TST,
@@ -4125,6 +4135,8 @@ VALUES (%s, '%s', '%s', '%s',
 prgreen('OK')
 print()
 print('failed={}, skipped={}'.format(Failed, len(Failure[F_SKIP])))
+if produce_html and Failed:
+print('see 
{}'.format(urllib.parse.urlunsplit(('file','',urllib.request.pathname2url(os.path.join(TSTTRGBASE,
 TSTPREF, "index.html")),'',''
 print('Ran {} tests in {:7.3f}s'.format(num_tests - 
len(Failure[F_SKIP]), t_))
 elif Failed:
 print("""\
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: sqloptimizer - Cleanup, use an optimizer binder because...

2022-03-14 Thread Pedro Ferreira
Changeset: b81313d6a11d for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/b81313d6a11d
Modified Files:
sql/server/rel_optimize_exps.c
sql/server/rel_optimize_others.c
sql/server/rel_optimize_proj.c
sql/server/rel_optimize_sel.c
sql/server/rel_optimizer.c
sql/server/rel_optimizer_private.h
sql/server/sql_mvc.c
Branch: sqloptimizer
Log Message:

Cleanup, use an optimizer binder because later depending on how optimizers are 
set by the users, different iterations could be returned


diffs (truncated from 900 to 300 lines):

diff --git a/sql/server/rel_optimize_exps.c b/sql/server/rel_optimize_exps.c
--- a/sql/server/rel_optimize_exps.c
+++ b/sql/server/rel_optimize_exps.c
@@ -361,19 +361,19 @@ rel_simplify_math_(visitor *v, sql_rel *
return rel;
 }
 
-bool
-can_simplify_math(visitor *v, global_props *gp)
-{
-   return gp->opt_cycle == 0 && gp->opt_level == 1 && v->value_based_opt 
&& (gp->cnt[op_project] || gp->cnt[op_ddl] || gp->cnt[ddl_psm]);
-}
-
-sql_rel *
+static sql_rel *
 rel_simplify_math(visitor *v, global_props *gp, sql_rel *rel)
 {
(void) gp;
return rel_visitor_bottomup(v, rel, &rel_simplify_math_);
 }
 
+run_optimizer
+bind_simplify_math(visitor *v, global_props *gp)
+{
+   return gp->opt_cycle == 0 && gp->opt_level == 1 && v->value_based_opt 
&& (gp->cnt[op_project] || gp->cnt[op_ddl] || gp->cnt[ddl_psm]) ? 
rel_simplify_math : NULL;
+}
+
 
 /*
  * Casting decimal values on both sides of a compare expression is expensive,
@@ -778,16 +778,16 @@ rel_optimize_exps_(visitor *v, sql_rel *
return e;
 }
 
-bool
-can_optimize_exps(visitor *v, global_props *gp)
-{
-   (void) v;
-   return gp->opt_cycle < 2 && gp->opt_level == 1 && (gp->cnt[op_project] 
|| gp->cnt[op_join] || gp->cnt[op_left] || gp->cnt[op_right] || 
gp->cnt[op_full] || gp->cnt[op_semi] || gp->cnt[op_anti] || gp->cnt[op_select]);
-}
-
-sql_rel *
+static sql_rel *
 rel_optimize_exps(visitor *v, global_props *gp, sql_rel *rel)
 {
(void) gp;
return rel_exp_visitor_bottomup(v, rel, &rel_optimize_exps_, false);
 }
+
+run_optimizer
+bind_optimize_exps(visitor *v, global_props *gp)
+{
+   (void) v;
+   return gp->opt_cycle < 2 && gp->opt_level == 1 && (gp->cnt[op_project] 
|| gp->cnt[op_join] || gp->cnt[op_left] || gp->cnt[op_right] || 
gp->cnt[op_full] || gp->cnt[op_semi] || gp->cnt[op_anti] || gp->cnt[op_select]) 
? rel_optimize_exps : NULL;
+}
diff --git a/sql/server/rel_optimize_others.c b/sql/server/rel_optimize_others.c
--- a/sql/server/rel_optimize_others.c
+++ b/sql/server/rel_optimize_others.c
@@ -994,20 +994,21 @@ rel_dce_(mvc *sql, sql_rel *rel)
 }
 
 /* Remove unused expressions */
-bool
-can_dce(visitor *v, global_props *gp)
-{
-   (void) v;
-   return gp->opt_cycle == 0 && gp->opt_level == 1;
-}
-
-sql_rel *
+static sql_rel *
 rel_dce(visitor *v, global_props *gp, sql_rel *rel)
 {
(void) gp;
return rel_dce_(v->sql, rel);
 }
 
+run_optimizer
+bind_dce(visitor *v, global_props *gp)
+{
+   (void) v;
+   return gp->opt_cycle == 0 && gp->opt_level == 1 ? rel_dce : NULL;
+}
+
+
 static int
 topn_sample_save_exps( list *exps )
 {
@@ -1248,16 +1249,16 @@ rel_push_topn_and_sample_down_(visitor *
return rel;
 }
 
-bool
-can_push_topn_and_sample_down(visitor *v, global_props *gp)
-{
-   (void) v;
-   return gp->opt_level == 1 && (gp->cnt[op_topn] || gp->cnt[op_sample]);
-}
-
-sql_rel *
+static sql_rel *
 rel_push_topn_and_sample_down(visitor *v, global_props *gp, sql_rel *rel)
 {
(void) gp;
return rel_visitor_topdown(v, rel, &rel_push_topn_and_sample_down_);
 }
+
+run_optimizer
+bind_push_topn_and_sample_down(visitor *v, global_props *gp)
+{
+   (void) v;
+   return gp->opt_level == 1 && (gp->cnt[op_topn] || gp->cnt[op_sample]) ? 
rel_push_topn_and_sample_down : NULL;
+}
diff --git a/sql/server/rel_optimize_proj.c b/sql/server/rel_optimize_proj.c
--- a/sql/server/rel_optimize_proj.c
+++ b/sql/server/rel_optimize_proj.c
@@ -93,20 +93,20 @@ rel_push_project_down_(visitor *v, sql_r
return rel;
 }
 
-bool
-can_push_project_down(visitor *v, global_props *gp)
-{
-   (void) v;
-   return gp->opt_level == 1 && (gp->cnt[op_project] || 
gp->cnt[op_groupby]);
-}
-
-sql_rel *
+static sql_rel *
 rel_push_project_down(visitor *v, global_props *gp, sql_rel *rel)
 {
(void) gp;
return rel_visitor_bottomup(v, rel, &rel_push_project_down_);
 }
 
+run_optimizer
+bind_push_project_down(visitor *v, global_props *gp)
+{
+   (void) v;
+   return gp->opt_level == 1 && (gp->cnt[op_project] || 
gp->cnt[op_groupby]) ? rel_push_project_down : NULL;
+}
+
 
 static bool exp_shares_exps(sql_exp *e, list *shared, uint64_t *uses);
 
@@ -303,20 +303,20 @@ rel_merge_projects_(visitor *v, sql_rel 
return rel;
 }
 
-bool
-can_merge_projects(visitor *v, global_props *gp)
-{
-   (void) v;
-   return gp->opt_level == 1 && (gp-

MonetDB: sqloptimizer - Give possibility to disable individual o...

2022-03-14 Thread Pedro Ferreira
Changeset: 1549627ec354 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/1549627ec354
Modified Files:
sql/server/rel_optimize_exps.c
sql/server/rel_optimize_others.c
sql/server/rel_optimize_proj.c
sql/server/rel_optimize_sel.c
sql/server/rel_optimizer_private.h
Branch: sqloptimizer
Log Message:

Give possibility to disable individual optimizers


diffs (293 lines):

diff --git a/sql/server/rel_optimize_exps.c b/sql/server/rel_optimize_exps.c
--- a/sql/server/rel_optimize_exps.c
+++ b/sql/server/rel_optimize_exps.c
@@ -371,7 +371,9 @@ rel_simplify_math(visitor *v, global_pro
 run_optimizer
 bind_simplify_math(visitor *v, global_props *gp)
 {
-   return gp->opt_cycle == 0 && gp->opt_level == 1 && v->value_based_opt 
&& (gp->cnt[op_project] || gp->cnt[op_ddl] || gp->cnt[ddl_psm]) ? 
rel_simplify_math : NULL;
+   int flag = v->sql->sql_optimizer;
+   return gp->opt_cycle == 0 && gp->opt_level == 1 && v->value_based_opt 
&& (gp->cnt[op_project]
+  || gp->cnt[op_ddl] || gp->cnt[ddl_psm]) && (flag & 
simplify_math) ? rel_simplify_math : NULL;
 }
 
 
@@ -788,6 +790,8 @@ rel_optimize_exps(visitor *v, global_pro
 run_optimizer
 bind_optimize_exps(visitor *v, global_props *gp)
 {
-   (void) v;
-   return gp->opt_cycle < 2 && gp->opt_level == 1 && (gp->cnt[op_project] 
|| gp->cnt[op_join] || gp->cnt[op_left] || gp->cnt[op_right] || 
gp->cnt[op_full] || gp->cnt[op_semi] || gp->cnt[op_anti] || gp->cnt[op_select]) 
? rel_optimize_exps : NULL;
+   int flag = v->sql->sql_optimizer;
+   return gp->opt_cycle < 2 && gp->opt_level == 1 && (gp->cnt[op_project] 
|| gp->cnt[op_join]
+  || gp->cnt[op_left] || gp->cnt[op_right] || gp->cnt[op_full] 
|| gp->cnt[op_semi]
+  || gp->cnt[op_anti] || gp->cnt[op_select]) && (flag & 
optimize_exps) ? rel_optimize_exps : NULL;
 }
diff --git a/sql/server/rel_optimize_others.c b/sql/server/rel_optimize_others.c
--- a/sql/server/rel_optimize_others.c
+++ b/sql/server/rel_optimize_others.c
@@ -1004,8 +1004,8 @@ rel_dce(visitor *v, global_props *gp, sq
 run_optimizer
 bind_dce(visitor *v, global_props *gp)
 {
-   (void) v;
-   return gp->opt_cycle == 0 && gp->opt_level == 1 ? rel_dce : NULL;
+   int flag = v->sql->sql_optimizer;
+   return gp->opt_cycle == 0 && gp->opt_level == 1 && (flag & dce) ? 
rel_dce : NULL;
 }
 
 
@@ -1259,6 +1259,7 @@ rel_push_topn_and_sample_down(visitor *v
 run_optimizer
 bind_push_topn_and_sample_down(visitor *v, global_props *gp)
 {
-   (void) v;
-   return gp->opt_level == 1 && (gp->cnt[op_topn] || gp->cnt[op_sample]) ? 
rel_push_topn_and_sample_down : NULL;
+   int flag = v->sql->sql_optimizer;
+   return gp->opt_level == 1 && (gp->cnt[op_topn] || gp->cnt[op_sample]) &&
+  (flag & push_topn_and_sample_down) ? 
rel_push_topn_and_sample_down : NULL;
 }
diff --git a/sql/server/rel_optimize_proj.c b/sql/server/rel_optimize_proj.c
--- a/sql/server/rel_optimize_proj.c
+++ b/sql/server/rel_optimize_proj.c
@@ -103,8 +103,9 @@ rel_push_project_down(visitor *v, global
 run_optimizer
 bind_push_project_down(visitor *v, global_props *gp)
 {
-   (void) v;
-   return gp->opt_level == 1 && (gp->cnt[op_project] || 
gp->cnt[op_groupby]) ? rel_push_project_down : NULL;
+   int flag = v->sql->sql_optimizer;
+   return gp->opt_level == 1 && (flag & push_project_down) &&
+  (gp->cnt[op_project] || gp->cnt[op_groupby]) ? 
rel_push_project_down : NULL;
 }
 
 
@@ -313,8 +314,9 @@ rel_merge_projects(visitor *v, global_pr
 run_optimizer
 bind_merge_projects(visitor *v, global_props *gp)
 {
-   (void) v;
-   return gp->opt_level == 1 && (gp->cnt[op_project] || 
gp->cnt[op_groupby]) ? rel_merge_projects : NULL;
+   int flag = v->sql->sql_optimizer;
+   return gp->opt_level == 1 && (flag & merge_projects) &&
+  (gp->cnt[op_project] || gp->cnt[op_groupby]) ? 
rel_merge_projects : NULL;
 }
 
 
@@ -684,8 +686,9 @@ rel_push_project_up(visitor *v, global_p
 run_optimizer
 bind_push_project_up(visitor *v, global_props *gp)
 {
-   (void) v;
-   return gp->opt_level == 1 && gp->cnt[op_project] ? rel_push_project_up 
: NULL;
+   int flag = v->sql->sql_optimizer;
+   return gp->opt_level == 1 && (flag & push_project_up) &&
+  gp->cnt[op_project] ? rel_push_project_up : NULL;
 }
 
 
@@ -881,8 +884,9 @@ rel_split_project(visitor *v, global_pro
 run_optimizer
 bind_split_project(visitor *v, global_props *gp)
 {
-   (void) v;
-   return gp->opt_cycle == 0 && gp->opt_level == 1 && (gp->cnt[op_project] 
|| gp->cnt[op_groupby]) ? rel_split_project : NULL;
+   int flag = v->sql->sql_optimizer;
+   return gp->opt_cycle == 0 && gp->opt_level == 1 && (flag & 
split_project) &&
+  (gp->cnt[op_project] || gp->cnt[op_groupby]) ? 
rel_split_project : NULL;
 }
 
 
@@ -936,8 +940,8 @@ rel_project_reduce_casts(visitor *v, glo
 r