Changeset: 30b9d22f6f1d for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=30b9d22f6f1d
Branch: unlock
Log Message:
merged
diffs (161 lines):
diff --git a/documentation/index.rst b/documentation/index.rst
--- a/documentation/index.rst
+++ b/documentation/index.rst
@@ -28,6 +28,7 @@ Welcome to MonetDB's documentation!
source/manual_pages
source/cmake
source/release
+ source/developers_handbook
Indices and tables
==================
diff --git a/documentation/source/developers_handbook.rst
b/documentation/source/developers_handbook.rst
new file mode 100644
--- /dev/null
+++ b/documentation/source/developers_handbook.rst
@@ -0,0 +1,39 @@
+.. 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 - 2020 MonetDB B.V.
+
+********************
+Developer's Handbook
+********************
+
+Testing
+=======
+
+MonetDB uses a custom program ``Mtest.py`` to run tests. Each test is an SQL,
+Python or MAL program along with its standard output and standard error
streams.
+``Mtest.py`` runs each of these programs, captures the standard output and the
+standard error, and compares them to the *stable* streams. If any differences
are
+encountered then the test has failed.
+
+Tests in the codebase
+---------------------
+
+Tests are usually ``.sql``, ``.py`` or ``.malC`` files and the stable streams
+are stored in ``.stable.out`` and ``.stable.err`` files with the same name in
+the same directory. For example in the directory ``sql/test/json/Tests`` we
find
+the files:
+
+* ``jsonkeyarray.sql``
+* ``jsonkeyarray.stable.out``
+* ``jsonkeyarray.stable.err``
+
+Running tests
+-------------
+
+Adding a new test
+-----------------
+
+Python tests API
+----------------
diff --git a/sql/server/rel_exp.c b/sql/server/rel_exp.c
--- a/sql/server/rel_exp.c
+++ b/sql/server/rel_exp.c
@@ -322,7 +322,6 @@ exp_convert(sql_allocator *sa, sql_exp *
sql_exp *
exp_op( sql_allocator *sa, list *l, sql_subfunc *f )
{
- sql_subtype *fres;
sql_exp *e = exp_create(sa, e_func);
if (e == NULL)
return NULL;
@@ -330,13 +329,6 @@ exp_op( sql_allocator *sa, list *l, sql_
e->l = l;
e->f = f;
e->semantics = f->func->semantics;
-
- fres = exp_subtype(e);
- /* corner case if the output of the function is void, set the type to
one of the inputs */
- if (!f->func->varres && list_length(l) > 0 && list_length(f->func->res)
== 1 && fres && !subtype_cmp(fres, sql_bind_localtype("void"))) {
- sql_subtype *t = exp_subtype(l->t->data);
- f->res->h->data = sql_create_subtype(sa, t->type, t->digits,
t->scale);
- }
return e;
}
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
@@ -2931,18 +2931,24 @@ rel_binop_(mvc *sql, sql_rel *rel, sql_e
if (t1->type->eclass == EC_ANY || t2->type->eclass == EC_ANY) {
sql_exp *ol = l;
sql_exp *or = r;
+ sql_subtype *s = sql_bind_localtype("str");
if (t1->type->eclass == EC_ANY && t2->type->eclass ==
EC_ANY) {
- sql_subtype *s = sql_bind_localtype("str");
l = exp_check_type(sql, s, rel, l, type_equal);
r = exp_check_type(sql, s, rel, r, type_equal);
} else if (t1->type->eclass == EC_ANY) {
- l = exp_check_type(sql, t2, rel, l, type_equal);
+ s = t2;
+ l = exp_check_type(sql, s, rel, l, type_equal);
} else {
- r = exp_check_type(sql, t1, rel, r, type_equal);
+ s = t1;
+ r = exp_check_type(sql, s, rel, r, type_equal);
}
- if (l && r)
- return exp_binop(sql->sa, l, r, f);
+ if (l && r) {
+ res = exp_binop(sql->sa, l, r, f);
+ /* needs the hack */
+ ((sql_subfunc*)res->f)->res->h->data =
sql_create_subtype(sql->sa, s->type, s->digits, s->scale);
+ return res;
+ }
/* reset error */
sql->session->status = 0;
@@ -3749,6 +3755,7 @@ rel_complex_case(sql_query *query, sql_r
exp_kind ek = {type_value, card_column, FALSE};
list *args = sa_list(query->sql->sa);
sql_subtype *restype = NULL, rtype;
+ sql_exp *res;
/* generate nested func calls */
for(dnode *dn = case_args->h; dn; dn = dn->next) {
@@ -3779,7 +3786,9 @@ rel_complex_case(sql_query *query, sql_r
}
list *types = append(append(sa_list(query->sql->sa), restype), restype);
sql_subfunc *fnc = find_func(query->sql, NULL, func,
list_length(types), F_FUNC, NULL);
- return exp_op(query->sql->sa, nargs, fnc);
+ res = exp_op(query->sql->sa, nargs, fnc);
+ ((sql_subfunc*)res->f)->res->h->data =
sql_create_subtype(query->sql->sa, restype->type, restype->digits,
restype->scale);
+ return res;
}
static sql_exp *
diff --git a/sql/test/SQLancer/Tests/sqlancer04.sql
b/sql/test/SQLancer/Tests/sqlancer04.sql
--- a/sql/test/SQLancer/Tests/sqlancer04.sql
+++ b/sql/test/SQLancer/Tests/sqlancer04.sql
@@ -174,3 +174,25 @@ SELECT 1 FROM t0 WHERE 'b' = COALESCE('1
SELECT MAX(ALL 0.47279814) FROM t0 WHERE ((r'Vቕ*2DGj!K-?')NOT
ILIKE(COALESCE(r'뷿', upper(r'1285890467'), r'R B+ ]%''?E}%<[cöjö媘թ丅MJV%r&伉',
CASE WHEN -681304440 THEN r'+s' WHEN -2104930505 THEN r'M[' END))) GROUP BY
t0.c0, t0.c1;
ROLLBACK;
+
+START TRANSACTION;
+CREATE TABLE "sys"."t1" ("c0" CHAR(240));
+COPY 5 RECORDS INTO "sys"."t1" FROM stdin USING DELIMITERS E'\t',E'\n','"';
+"2m^OqPm/3DḞZ02"
+"2m^OqPm/3DḞZ02"
+"2m^OqPm/3DḞZ02"
+"2m^OqPm/3DḞZ02"
+"2m^OqPm/3DḞZ02"
+
+SELECT 1 FROM t1 WHERE COALESCE(FALSE, t1.c0 = '0' AND t1.c0 LIKE t1.c0);
+SELECT SUM(agg0) FROM (
+SELECT ALL sum(ALL abs(INTERVAL '1507781126' SECOND)) as agg0 FROM t1
+WHERE COALESCE(FALSE, (((((((((((t1.c0) NOT BETWEEN ASYMMETRIC (t1.c0) AND
(t1.c0))AND(((t1.c0)>=(t1.c0)))))AND(NOT
(TRUE))))AND(((t1.c0)LIKE(t1.c0)))))AND(((t1.c0)NOT
ILIKE(t1.c0)))))OR(COALESCE(FALSE, FALSE))))
+UNION ALL
+SELECT sum(ALL abs(INTERVAL '1507781126' SECOND)) as agg0 FROM t1
+WHERE NOT (COALESCE(FALSE, (((((((((((t1.c0) NOT BETWEEN ASYMMETRIC (t1.c0)
AND (t1.c0))AND(((t1.c0)>=(t1.c0)))))AND(NOT
(TRUE))))AND(((t1.c0)LIKE(t1.c0)))))AND(((t1.c0)NOT
ILIKE(t1.c0)))))OR(COALESCE(FALSE, FALSE)))))
+UNION ALL
+SELECT sum(ALL abs(INTERVAL '1507781126' SECOND)) as agg0 FROM t1
+WHERE (COALESCE(FALSE, (((((((((((t1.c0) NOT BETWEEN ASYMMETRIC (t1.c0) AND
(t1.c0))AND(((t1.c0)>=(t1.c0)))))AND(NOT
(TRUE))))AND(((t1.c0)LIKE(t1.c0)))))AND(((t1.c0)NOT
ILIKE(t1.c0)))))OR(COALESCE(FALSE, FALSE))))) IS NULL)
+as asdf;
+ROLLBACK;
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list