Changeset: 3dc889039c05 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=3dc889039c05 Added Files: sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.32bit sql/test/emptydb-upgrade/Tests/upgrade.stable.out.32bit sql/test/pg_regress/Tests/numeric.stable.out.FreeBSD.int128 sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out.32bit sql/test/testdb-upgrade/Tests/upgrade.stable.out.32bit Removed Files: sql/test/pg_regress/Tests/float8.stable.err.Windows Modified Files: clients/mapilib/mapi.c gdk/gdk_firstn.c monetdb5/mal/mal_linker.c sql/backends/monet5/sql_result.c sql/common/sql_types.c sql/test/BugTracker-2014/Tests/round-properties.Bug-3515.stable.out sql/test/BugTracker-2014/Tests/round.Bug-3542.stable.out.int128 sql/test/BugTracker-2017/Tests/All sql/test/Tests/round.stable.out sql/test/pg_regress/Tests/float8.stable.err sql/test/pg_regress/Tests/float8.stable.err.int128 sql/test/pg_regress/Tests/numeric.stable.err sql/test/pg_regress/Tests/numeric.stable.out.int128 Branch: trails Log Message:
Merge with default diffs (truncated from 20370 to 300 lines): diff --git a/clients/mapilib/mapi.c b/clients/mapilib/mapi.c --- a/clients/mapilib/mapi.c +++ b/clients/mapilib/mapi.c @@ -3767,6 +3767,7 @@ parse_header_line(MapiHdl hdl, char *lin switch (qt) { case Q_SCHEMA: result->querytime = strtoll(nline, &nline, 10); + result->maloptimizertime = strtoll(nline, &nline, 10); break; case Q_TRANS: if (*nline == 'f') diff --git a/gdk/gdk_firstn.c b/gdk/gdk_firstn.c --- a/gdk/gdk_firstn.c +++ b/gdk/gdk_firstn.c @@ -422,25 +422,48 @@ BATfirstn_unique_with_groups(BAT *b, BAT oid item; BUN pos, childpos; - if (BATtdense(g)) { - /* trivial: g determines ordering, return initial - * slice of s */ - return BATslice(s, 0, n); - } - CANDINIT(b, s, start, end, cnt, cand, candend); + cnt = cand ? (BUN) (candend - cand) : end - start; if (n > cnt) n = cnt; - if (cand && n > (BUN) (candend - cand)) - n = (BUN) (candend - cand); if (n == 0) { /* candidate list might refer only to values outside * of the bat and hence be effectively empty */ + if (lastp) + *lastp = 0; + if (lastgp) + *lastgp = 0; return BATdense(0, 0, 0); } + if (BATtdense(g)) { + /* trivial: g determines ordering, return reference to + * initial part of b (or slice of s) */ + if (lastgp) + *lastgp = g->tseqbase + n - 1; + if (cand) { + if (lastp) + *lastp = cand[n - 1]; + bn = COLnew(0, TYPE_oid, n, TRANSIENT); + if (bn == NULL) + return NULL; + memcpy(Tloc(bn, 0), cand, n * sizeof(oid)); + BATsetcount(bn, n); + bn->tsorted = 1; + bn->trevsorted = n <= 1; + bn->tkey = 1; + bn->tseqbase = (bn->tdense = n <= 1) != 0 ? cand[0] : oid_nil; + bn->tnil = 0; + bn->tnonil = 1; + return bn; + } + if (lastp) + *lastp = b->hseqbase + start + n - 1; + return BATdense(0, b->hseqbase + start, n); + } + bn = COLnew(0, TYPE_oid, n, TRANSIENT); if (bn == NULL) return NULL; @@ -763,7 +786,7 @@ BATfirstn_grouped_with_groups(BAT **topn BBPunfix(bn1->batCacheid); return GDK_FAIL; } - bn4 = BATselect(b, bn3, BUNtail(bi, BUNlast(b) - b->hseqbase), NULL, 1, 0, 0); + bn4 = BATselect(b, bn3, BUNtail(bi, last - b->hseqbase), NULL, 1, 0, 0); BBPunfix(bn3->batCacheid); if (bn4 == NULL) { BBPunfix(bn1->batCacheid); diff --git a/sql/backends/monet5/sql_result.c b/sql/backends/monet5/sql_result.c --- a/sql/backends/monet5/sql_result.c +++ b/sql/backends/monet5/sql_result.c @@ -2087,9 +2087,7 @@ mvc_export_operation(backend *b, stream assert(m->type == Q_SCHEMA || m->type == Q_TRANS); if (m->type == Q_SCHEMA) { - if (!s || mnstr_printf(s, "&3 " LLFMT "\n", starttime > 0 ? GDKusec() - starttime : 0) < 0) - return -1; - if (!s || mnstr_printf(s, "&3 " LLFMT "\n", mal_optimizer) < 0) + if (!s || mnstr_printf(s, "&3 " LLFMT " " LLFMT "\n", starttime > 0 ? GDKusec() - starttime : 0, mal_optimizer) < 0) return -1; } else { if (m->session->auto_commit) { diff --git a/sql/common/sql_types.c b/sql/common/sql_types.c --- a/sql/common/sql_types.c +++ b/sql/common/sql_types.c @@ -643,14 +643,25 @@ sql_dup_subfunc(sql_allocator *sa, sql_f } else if (IS_FUNC(f) || IS_UNION(f) || IS_ANALYTIC(f)) { /* not needed for PROC */ unsigned int mscale = 0, mdigits = 0; - if (ops) for (tn = ops->h; tn; tn = tn->next) { - sql_subtype *a = tn->data; + if (ops) { + if (ops->h && ops->h->data && f->imp && + strcmp(f->imp, "round") == 0) { + /* special case for round(): result is + * same type as first argument */ + sql_subtype *a = ops->h->data; + mscale = a->scale; + mdigits = a->digits; + } else { + for (tn = ops->h; tn; tn = tn->next) { + sql_subtype *a = tn->data; - /* same scale as the input */ - if (a && a->scale > mscale) - mscale = a->scale; - if (a && f->fix_scale == INOUT) - mdigits = a->digits; + /* same scale as the input */ + if (a && a->scale > mscale) + mscale = a->scale; + if (a && f->fix_scale == INOUT) + mdigits = a->digits; + } + } } if (!member) { diff --git a/sql/test/BugTracker-2014/Tests/round-properties.Bug-3515.stable.out b/sql/test/BugTracker-2014/Tests/round-properties.Bug-3515.stable.out --- a/sql/test/BugTracker-2014/Tests/round-properties.Bug-3515.stable.out +++ b/sql/test/BugTracker-2014/Tests/round-properties.Bug-3515.stable.out @@ -63,7 +63,7 @@ Ready. % sys.ceil_floor_round, sys.L3 # table_name % a, L3 # name % decimal, decimal # type -% 20, 10 # length +% 20, 20 # length [ -5.500, -6.000 ] [ -5.499, -5.000 ] [ 0.000, 0.000 ] diff --git a/sql/test/BugTracker-2014/Tests/round.Bug-3542.stable.out.int128 b/sql/test/BugTracker-2014/Tests/round.Bug-3542.stable.out.int128 --- a/sql/test/BugTracker-2014/Tests/round.Bug-3542.stable.out.int128 +++ b/sql/test/BugTracker-2014/Tests/round.Bug-3542.stable.out.int128 @@ -50,7 +50,7 @@ Ready. % sys.t1, sys.t2, sys.L4 # table_name % id, id, L4 # name % int, int, decimal # type -% 1, 1, 7 # length +% 1, 1, 38 # length [ 1, 1, 0.00000000000000000000 ] [ 1, 2, 0.00000000000000000000 ] [ 2, 1, 0.00000000000000000000 ] diff --git a/sql/test/BugTracker-2017/Tests/All b/sql/test/BugTracker-2017/Tests/All --- a/sql/test/BugTracker-2017/Tests/All +++ b/sql/test/BugTracker-2017/Tests/All @@ -110,5 +110,5 @@ skip_problem_best_effort.Bug-6442 date_to_str.Bug-6467 cleanup_statistics.Bug-6439 update_on_procedure.Bug-6479 -sqlsmith.Bug-6477 +HAVE_GEOM?sqlsmith.Bug-6477 crash-in-topn.Bug-6478 diff --git a/sql/test/Tests/round.stable.out b/sql/test/Tests/round.stable.out --- a/sql/test/Tests/round.stable.out +++ b/sql/test/Tests/round.stable.out @@ -28,31 +28,31 @@ Ready. % .L2, .L4, .L6, .L10 # table_name % L2, L4, L6, L10 # name % decimal, decimal, decimal, decimal # type -% 3, 4, 4, 5 # length +% 7, 7, 7, 7 # length [ 750.00, 700.00, 1000.00, 0.00 ] #SELECT ROUND(123.9994, 3),ROUND(123.9995, 3); % .L2, .L4 # table_name % L2, L4 # name % decimal, decimal # type -% 4, 4 # length +% 9, 9 # length [ 123.9990, 124.0000 ] #SELECT ROUND(123.4545, 2); % .L2 # table_name % L2 # name % decimal # type -% 4 # length +% 9 # length [ 123.4500 ] #SELECT ROUND(123.45, -2); % .L2 # table_name % L2 # name % decimal # type -% 4 # length +% 7 # length [ 100.00 ] #SELECT ROUND(150.75, 0); % .L2 # table_name % L2 # name % decimal # type -% 10 # length +% 7 # length [ 151.00 ] # 15:17:10 > diff --git a/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.32bit b/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.32bit new file mode 100644 --- /dev/null +++ b/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.32bit @@ -0,0 +1,4608 @@ +stdout of test 'upgrade` in directory 'sql/test/emptydb-upgrade-chain` itself: + + +# 16:53:35 > +# 16:53:35 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" "mapi_open=true" "--set" "mapi_port=39660" "--set" "mapi_usock=/var/tmp/mtest-30908/.s.monetdb.39660" "--set" "monet_prompt=" "--forcemito" "--set" "mal_listing=2" "--dbpath=/ufs/sjoerd/Monet-stable/var/MonetDB/mTests_sql_test_emptydb-upgrade-chain" "--set" "mal_listing=0" "--set" "embedded_r=yes" +# 16:53:35 > + +# MonetDB 5 server v11.21.16 (hg id: c20b591c1c70+) +# This is an unreleased version +# Serving database 'mTests_sql_test_emptydb-upgrade-chain', using 8 threads +# Compiled for x86_64-unknown-linux-gnu/64bit with 64bit OIDs and 128bit integers dynamically linked +# Found 15.589 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://madrid.da.cwi.nl:39660/ +# Listening for UNIX domain connection requests on mapi:monetdb:///var/tmp/mtest-30908/.s.monetdb.39660 +# MonetDB/GIS module loaded +# Start processing logs sql/sql_logs version 52200 +# Start reading the write-ahead log 'sql_logs/sql/log.31' +# Finished reading the write-ahead log 'sql_logs/sql/log.31' +# Finished processing logs sql/sql_logs +# MonetDB/SQL module loaded +# MonetDB/R module loaded + +Ready. +Running database upgrade commands: +set schema "sys"; +delete from sys.dependencies where id < 2000; +delete from sys.types where id < 2000; +insert into sys.types values (0, 'void', 'any', 0, 0, 0, 0, 2000); +insert into sys.types values (1, 'bat', 'table', 0, 0, 0, 1, 2000); +insert into sys.types values (2, 'ptr', 'ptr', 0, 0, 0, 1, 2000); +insert into sys.types values (3, 'bit', 'boolean', 1, 0, 2, 2, 2000); +insert into sys.types values (4, 'str', 'char', 0, 0, 0, 3, 2000); +insert into sys.types values (5, 'str', 'varchar', 0, 0, 0, 4, 2000); +insert into sys.types values (6, 'str', 'clob', 0, 0, 0, 4, 2000); +insert into sys.types values (7, 'oid', 'oid', 31, 0, 2, 6, 2000); +insert into sys.types values (8, 'bte', 'tinyint', 8, 1, 2, 7, 2000); +insert into sys.types values (9, 'sht', 'smallint', 16, 1, 2, 7, 2000); +insert into sys.types values (10, 'int', 'int', 32, 1, 2, 7, 2000); +insert into sys.types values (11, 'int', 'wrd', 32, 1, 2, 7, 2000); +insert into sys.types values (12, 'lng', 'bigint', 64, 1, 2, 7, 2000); +insert into sys.types values (13, 'bte', 'decimal', 2, 1, 10, 10, 2000); +insert into sys.types values (14, 'sht', 'decimal', 4, 1, 10, 10, 2000); +insert into sys.types values (15, 'int', 'decimal', 9, 1, 10, 10, 2000); +insert into sys.types values (16, 'lng', 'decimal', 18, 1, 10, 10, 2000); +insert into sys.types values (17, 'flt', 'real', 24, 2, 2, 11, 2000); +insert into sys.types values (18, 'dbl', 'double', 53, 2, 2, 11, 2000); +insert into sys.types values (19, 'int', 'month_interval', 32, 0, 2, 8, 2000); +insert into sys.types values (20, 'lng', 'sec_interval', 13, 1, 10, 9, 2000); +insert into sys.types values (21, 'daytime', 'time', 7, 0, 0, 12, 2000); +insert into sys.types values (22, 'daytime', 'timetz', 7, 1, 0, 12, 2000); +insert into sys.types values (23, 'date', 'date', 0, 0, 0, 13, 2000); +insert into sys.types values (24, 'timestamp', 'timestamp', 7, 0, 0, 14, 2000); +insert into sys.types values (25, 'timestamp', 'timestamptz', 7, 1, 0, 14, 2000); +insert into sys.types values (26, 'sqlblob', 'blob', 0, 0, 0, 5, 2000); +insert into sys.types values (27, 'wkb', 'geometry', 0, 0, 0, 15, 2000); +insert into sys.types values (28, 'wkba', 'geometrya', 0, 0, 0, 16, 2000); +insert into sys.types values (29, 'mbr', 'mbr', 0, 0, 0, 16, 2000); +delete from sys.functions where id < 2000; +delete from sys.args where func_id not in (select id from sys.functions); +insert into sys.functions values (30, 'mbr_overlap', 'mbrOverlaps', 'geom', 0, 1, false, false, false, 2000); +insert into sys.args values (11414, 30, 'res_0', 'boolean', 1, 0, 0, 0); +insert into sys.args values (11415, 30, 'arg_1', 'geometry', 0, 0, 1, 1); +insert into sys.args values (11416, 30, 'arg_2', 'geometry', 0, 0, 1, 2); +insert into sys.functions values (31, 'mbr_overlap', 'mbrOverlaps', 'geom', 0, 1, false, false, false, 2000); +insert into sys.args values (11417, 31, 'res_0', 'boolean', 1, 0, 0, 0); +insert into sys.args values (11418, 31, 'arg_1', 'mbr', 0, 0, 1, 1); +insert into sys.args values (11419, 31, 'arg_2', 'mbr', 0, 0, 1, 2); +insert into sys.functions values (32, 'mbr_above', 'mbrAbove', 'geom', 0, 1, false, false, false, 2000); +insert into sys.args values (11420, 32, 'res_0', 'boolean', 1, 0, 0, 0); +insert into sys.args values (11421, 32, 'arg_1', 'geometry', 0, 0, 1, 1); +insert into sys.args values (11422, 32, 'arg_2', 'geometry', 0, 0, 1, 2); +insert into sys.functions values (33, 'mbr_above', 'mbrAbove', 'geom', 0, 1, false, false, false, 2000); +insert into sys.args values (11423, 33, 'res_0', 'boolean', 1, 0, 0, 0); +insert into sys.args values (11424, 33, 'arg_1', 'mbr', 0, 0, 1, 1); +insert into sys.args values (11425, 33, 'arg_2', 'mbr', 0, 0, 1, 2); +insert into sys.functions values (34, 'mbr_below', 'mbrBelow', 'geom', 0, 1, false, false, false, 2000); +insert into sys.args values (11426, 34, 'res_0', 'boolean', 1, 0, 0, 0); +insert into sys.args values (11427, 34, 'arg_1', 'geometry', 0, 0, 1, 1); +insert into sys.args values (11428, 34, 'arg_2', 'geometry', 0, 0, 1, 2); +insert into sys.functions values (35, 'mbr_below', 'mbrBelow', 'geom', 0, 1, false, false, false, 2000); +insert into sys.args values (11429, 35, 'res_0', 'boolean', 1, 0, 0, 0); +insert into sys.args values (11430, 35, 'arg_1', 'mbr', 0, 0, 1, 1); +insert into sys.args values (11431, 35, 'arg_2', 'mbr', 0, 0, 1, 2); +insert into sys.functions values (36, 'mbr_right', 'mbrRight', 'geom', 0, 1, false, false, false, 2000); +insert into sys.args values (11432, 36, 'res_0', 'boolean', 1, 0, 0, 0); +insert into sys.args values (11433, 36, 'arg_1', 'geometry', 0, 0, 1, 1); +insert into sys.args values (11434, 36, 'arg_2', 'geometry', 0, 0, 1, 2); +insert into sys.functions values (37, 'mbr_right', 'mbrRight', 'geom', 0, 1, false, false, false, 2000); _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list