Changeset: b5d7548a3425 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=b5d7548a3425 Added Files: sql/test/BugTracker-2018/Tests/sqlitelogictest-cast-null-add.Bug-6630.sql sql/test/BugTracker-2018/Tests/sqlitelogictest-cast-null-add.Bug-6630.stable.err sql/test/BugTracker-2018/Tests/sqlitelogictest-cast-null-add.Bug-6630.stable.out Modified Files: configure.ag monetdb5/modules/atoms/uuid.c sql/backends/monet5/Tests/pyapi09.stable.out sql/backends/monet5/Tests/pyapi28.stable.out sql/server/rel_optimizer.c sql/server/sql_atom.c sql/test/BugTracker-2016/Tests/set-negative-querytimeout.Bug-6070.stable.err sql/test/BugTracker-2018/Tests/All Branch: default Log Message:
Merge with Mar2018 branch. diffs (truncated from 420 to 300 lines): diff --git a/configure.ag b/configure.ag --- a/configure.ag +++ b/configure.ag @@ -735,6 +735,12 @@ AS_VAR_IF([enable_sanitizer], [no], [], AC_SUBST([CFLAGS]) AC_SUBST([X_CFLAGS]) +# see https://software.intel.com/en-us/forums/intel-c-compiler/topic/760979 +AS_CASE([$CC_ver], [icc-*], [ + AS_IF([test -f /usr/include/math.h && ! grep -q _LIB_VERSION_TYPE /usr/include/math.h], + [AC_DEFINE([INTEL_MATH_H_HACK], 1, + [Define if using Intel compiler with icompatible system math.h])])]) + AC_MSG_CHECKING([for ld -Bsymbolic-functions option]) save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions" @@ -2920,6 +2926,17 @@ AH_TOP([ @%:@define _SEEN_MONETDB_CONFIG_H 1 ]) AH_BOTTOM([ +@%:@ifdef INTEL_MATH_H_HACK +/* see https://software.intel.com/en-us/forums/intel-c-compiler/topic/760979 */ +typedef enum { + _IEEE_ = -1, /* According to IEEE 754/IEEE 854. */ + _SVID_, /* According to System V, release 4. */ + _XOPEN_, /* Nowadays also Unix98. */ + _POSIX_, + _ISOC_ /* Actually this is ISO C99. */ +} _LIB_VERSION_TYPE; +@%:@endif + @%:@ifdef HAVE_SYS_TYPES_H @%:@ include <sys/types.h> @%:@endif diff --git a/monetdb5/modules/atoms/uuid.c b/monetdb5/modules/atoms/uuid.c --- a/monetdb5/modules/atoms/uuid.c +++ b/monetdb5/modules/atoms/uuid.c @@ -37,7 +37,12 @@ #endif #define UUID_STRLEN 36 /* length of string representation */ -typedef struct { +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 diff --git a/sql/backends/monet5/Tests/pyapi09.stable.out b/sql/backends/monet5/Tests/pyapi09.stable.out --- a/sql/backends/monet5/Tests/pyapi09.stable.out +++ b/sql/backends/monet5/Tests/pyapi09.stable.out @@ -23,7 +23,7 @@ stdout of test 'pyapi09` in directory 's # MonetDB/R module loaded Ready. -[ 0 1 2 ..., 99997 99998 99999] +[ 0 1 2 ... 99997 99998 99999] # 14:42:12 > # 14:42:12 > "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e" "--host=/var/tmp/mtest-30058" "--port=35977" diff --git a/sql/backends/monet5/Tests/pyapi28.stable.out b/sql/backends/monet5/Tests/pyapi28.stable.out --- a/sql/backends/monet5/Tests/pyapi28.stable.out +++ b/sql/backends/monet5/Tests/pyapi28.stable.out @@ -23,45 +23,7 @@ stdout of test 'pyapi28` in directory 's # MonetDB/R module loaded Ready. -# SQL catalog created, loading sql scripts once -# loading sql script: 09_like.sql -# loading sql script: 10_math.sql -# loading sql script: 11_times.sql -# loading sql script: 12_url.sql -# loading sql script: 13_date.sql -# loading sql script: 14_inet.sql -# loading sql script: 15_querylog.sql -# loading sql script: 16_tracelog.sql -# loading sql script: 17_temporal.sql -# loading sql script: 20_vacuum.sql -# loading sql script: 21_dependency_functions.sql -# loading sql script: 22_clients.sql -# loading sql script: 23_skyserver.sql -# loading sql script: 24_zorder.sql -# loading sql script: 25_debug.sql -# loading sql script: 26_sysmon.sql -# loading sql script: 27_rejects.sql -# loading sql script: 39_analytics.sql -# loading sql script: 39_analytics_hge.sql -# loading sql script: 40_geom.sql -# loading sql script: 40_json.sql -# loading sql script: 40_json_hge.sql -# loading sql script: 41_md5sum.sql -# loading sql script: 45_uuid.sql -# loading sql script: 46_gsl.sql -# loading sql script: 46_profiler.sql -# loading sql script: 51_sys_schema_extension.sql -# loading sql script: 72_fits.sql -# loading sql script: 74_netcdf.sql -# loading sql script: 75_storagemodel.sql -# loading sql script: 80_statistics.sql -# loading sql script: 80_udf.sql -# loading sql script: 80_udf_hge.sql -# loading sql script: 85_bam.sql -# loading sql script: 90_generator.sql -# loading sql script: 90_generator_hge.sql -# loading sql script: 99_system.sql -['hello' 'hello' 'hello' ..., 'hello' 'hello' 'hello'] +['hello' 'hello' 'hello' ... 'hello' 'hello' 'hello'] # 16:15:17 > # 16:15:17 > "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e" "--host=/var/tmp/mtest-30857" "--port=39674" 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 @@ -5914,8 +5914,7 @@ exp_mark_used(sql_rel *subrel, sql_exp * static void positional_exps_mark_used( sql_rel *rel, sql_rel *subrel ) { - if (!rel->exps) - assert(0); + assert(rel->exps); if ((is_topn(subrel->op) || is_sample(subrel->op)) && subrel->l) subrel = subrel->l; @@ -8593,7 +8592,8 @@ exp_find_conflicts(mvc *sql, sql_exp *e, exps_find_conflicts(sql, e->l, aexps, conflicts); exps_find_conflicts(sql, e->r, aexps, conflicts); } else if (e->flag == cmp_in || e->flag == cmp_notin) { - exps_find_conflicts(sql, e->l, aexps, conflicts); + exp_find_conflicts(sql, e->l, aexps, conflicts); + exps_find_conflicts(sql, e->r, aexps, conflicts); } else { exp_find_conflicts(sql, e->l, aexps, conflicts); exp_find_conflicts(sql, e->r, aexps, conflicts); diff --git a/sql/server/sql_atom.c b/sql/server/sql_atom.c --- a/sql/server/sql_atom.c +++ b/sql/server/sql_atom.c @@ -1196,6 +1196,7 @@ atom * atom_add(atom *a1, atom *a2) { ValRecord dst; + if ((!EC_COMPUTE(a1->tpe.type->eclass) && (a1->tpe.type->eclass != EC_DEC || a1->tpe.digits != a2->tpe.digits || a1->tpe.scale != a2->tpe.scale)) || a1->tpe.digits < a2->tpe.digits || a1->tpe.type->localtype != a2->tpe.type->localtype) { return NULL; } @@ -1211,6 +1212,8 @@ atom_add(atom *a1, atom *a2) return NULL; a1->data = dst; dst.vtype = TYPE_dbl; + if (a1->isnull || a2->isnull) + a1->isnull = 1; if (VARconvert(&dst, &a1->data, 1) == GDK_SUCCEED) a1->d = dst.val.dval; return a1; @@ -1220,6 +1223,7 @@ atom * atom_sub(atom *a1, atom *a2) { ValRecord dst; + if ((!EC_COMPUTE(a1->tpe.type->eclass) && (a1->tpe.type->eclass != EC_DEC || a1->tpe.digits != a2->tpe.digits || a1->tpe.scale != a2->tpe.scale)) || a1->tpe.digits < a2->tpe.digits || a1->tpe.type->localtype != a2->tpe.type->localtype) { return NULL; } @@ -1237,6 +1241,8 @@ atom_sub(atom *a1, atom *a2) a1 = a2; a1->data = dst; dst.vtype = TYPE_dbl; + if (a1->isnull || a2->isnull) + a1->isnull = 1; if (VARconvert(&dst, &a1->data, 1) == GDK_SUCCEED) a1->d = dst.val.dval; return a1; @@ -1255,6 +1261,10 @@ atom_mul(atom *a1, atom *a2) dst.vtype = v1.vtype = v2.vtype = TYPE_dbl; v1.val.dval = a1->d; v2.val.dval = a2->d; + if (a1->isnull) + return a1; + if (a2->isnull) + return a2; if (VARcalcmul(&dst, &v1, &v2, 1) != GDK_SUCCEED) return NULL; a1->data.vtype = TYPE_dbl; @@ -1268,6 +1278,10 @@ atom_mul(atom *a1, atom *a2) a1 = a2; a2 = t; } + if (a1->isnull || a2->isnull) { + a1->isnull = 1; + return a1; + } dst.vtype = a1->tpe.type->localtype; if (VARcalcmul(&dst, &a1->data, &a2->data, 1) != GDK_SUCCEED) return NULL; @@ -1283,6 +1297,9 @@ int atom_inc( atom *a ) { ValRecord dst; + + if (a->isnull) + return -1; dst.vtype = a->data.vtype; if (VARcalcincr(&dst, &a->data, 1) != GDK_SUCCEED) return -1; @@ -1296,6 +1313,8 @@ atom_inc( atom *a ) int atom_is_zero( atom *a ) { + if (a->isnull) + return 0; switch(a->tpe.type->localtype) { case TYPE_bte: return a->data.val.btval == 0; @@ -1322,6 +1341,8 @@ atom_is_zero( atom *a ) int atom_is_true( atom *a ) { + if (a->isnull) + return 0; switch(a->tpe.type->localtype) { case TYPE_bit: return a->data.val.btval != 0; diff --git a/sql/test/BugTracker-2016/Tests/set-negative-querytimeout.Bug-6070.stable.err b/sql/test/BugTracker-2016/Tests/set-negative-querytimeout.Bug-6070.stable.err --- a/sql/test/BugTracker-2016/Tests/set-negative-querytimeout.Bug-6070.stable.err +++ b/sql/test/BugTracker-2016/Tests/set-negative-querytimeout.Bug-6070.stable.err @@ -31,13 +31,14 @@ stderr of test 'set-negative-querytimeou MAPI = (monetdb) /var/tmp/mtest-9911/.s.monetdb.38717 QUERY = CALL "sys"."settimeout"(-9); -ERROR = !Query time out should be > 0 -MAPI = (monetdb) /var/tmp/mtest-1493/.s.monetdb.37430 +ERROR = !Query time out should be >= 0 +MAPI = (monetdb) /var/tmp/mtest-15044/.s.monetdb.30743 QUERY = CALL "sys"."settimeout"(7, -9); -ERROR = !Session time out should be > 0 -MAPI = (monetdb) /var/tmp/mtest-1493/.s.monetdb.37430 +ERROR = !Session time out should be >= 0 +MAPI = (monetdb) /var/tmp/mtest-15044/.s.monetdb.30743 QUERY = CALL "sys"."setsession"(-8); -ERROR = !Query time out should be > 0 +ERROR = !Query time out should be >= 0 + # 17:30:21 > diff --git a/sql/test/BugTracker-2018/Tests/All b/sql/test/BugTracker-2018/Tests/All --- a/sql/test/BugTracker-2018/Tests/All +++ b/sql/test/BugTracker-2018/Tests/All @@ -76,3 +76,4 @@ or_in_subselect.Bug-6625 strptime.Bug-6626 singleton-stddev.Bug-6627 create_table_if_not_exists_returns_42000.Bug-6629 +sqlitelogictest-cast-null-add.Bug-6630 diff --git a/sql/test/BugTracker-2018/Tests/sqlitelogictest-cast-null-add.Bug-6630.sql b/sql/test/BugTracker-2018/Tests/sqlitelogictest-cast-null-add.Bug-6630.sql new file mode 100644 --- /dev/null +++ b/sql/test/BugTracker-2018/Tests/sqlitelogictest-cast-null-add.Bug-6630.sql @@ -0,0 +1,26 @@ +CREATE TABLE tab1(col0 INTEGER, col1 INTEGER, col2 INTEGER); +CREATE TABLE tab2(col0 INTEGER, col1 INTEGER, col2 INTEGER); + +INSERT INTO tab1 VALUES(51,14,96), (85,5,59), (91,47,68); +INSERT INTO tab2 VALUES(64,77,40), (75,67,58), (46,51,23); + +SELECT 0 + CAST ( NULL AS INTEGER ) + 0; -- NULL + +-- A single column with 3 NULL values +SELECT CAST ( 90 + CAST ( NULL AS INTEGER ) + + - 90 AS BIGINT ) FROM tab1 AS cor0 WHERE NULL IS NULL; + +SELECT CAST ( 24 - CAST ( NULL AS INTEGER ) + - 29 + COUNT ( * ) + - 46 AS BIGINT ) AS col2 FROM tab2; -- NULL + +SELECT DISTINCT CAST ( + 2 + + CAST ( NULL AS INTEGER ) - - ( + 69 ) AS BIGINT ) FROM tab2 AS cor0; -- NULL + +SELECT ALL CAST ( - 8 + CAST ( NULL AS INTEGER ) + 43 AS BIGINT ) FROM tab2 cor0; -- A single column with 3 NULL values + +-- A single column with 3 NULL values +SELECT ALL CAST ( 51 + + CAST ( NULL AS INTEGER ) - - - 17 AS BIGINT ) AS col0 FROM tab2; + +-- Two columns with 3 NULL values +SELECT ALL CAST ( col1 / - - ( + CAST ( NULL AS INTEGER ) ) AS BIGINT ) col0, + CAST ( 39 + + + CAST ( NULL AS INTEGER ) + + - 10 + col1 / - col0 AS BIGINT ) AS col1 FROM tab2; + +DROP TABLE tab1; +DROP TABLE tab2; diff --git a/sql/test/BugTracker-2018/Tests/sqlitelogictest-cast-null-add.Bug-6630.stable.err b/sql/test/BugTracker-2018/Tests/sqlitelogictest-cast-null-add.Bug-6630.stable.err new file mode 100644 --- /dev/null +++ b/sql/test/BugTracker-2018/Tests/sqlitelogictest-cast-null-add.Bug-6630.stable.err @@ -0,0 +1,35 @@ +stderr of test 'sqlitelogictest-cast-null-add.Bug-6630` in directory 'sql/test/BugTracker-2018` itself: + + +# 16:13:37 > +# 16:13:37 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" "mapi_open=true" "--set" "mapi_port=35639" "--set" "mapi_usock=/var/tmp/mtest-10835/.s.monetdb.35639" "--set" "monet_prompt=" "--forcemito" "--dbpath=/home/niels/scratch/rc-monetdb/Linux-x86_64/var/MonetDB/mTests_sql_test_BugTracker-2018" "--set" "embedded_c=true" +# 16:13:37 > + +# builtin opt gdk_dbpath = /home/niels/scratch/rc-monetdb/Linux-x86_64/var/monetdb5/dbfarm/demo +# builtin opt gdk_debug = 0 +# builtin opt gdk_vmtrim = no _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list