Changeset: 1e07a13940f9 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=1e07a13940f9 Added Files: sql/test/BugTracker-2016/Tests/min-max-uuid-column-wrong-results.Bug-3953.sql Removed Files: sql/test/BugTracker-2016/Tests/data-uuid.csv.bz2 sql/test/BugTracker-2016/Tests/min-max-uuid-column-wrong-results.Bug-3953.sql.in Modified Files: NT/monetdb_config.h.in clients/Tests/exports.stable.out configure.ag gdk/ChangeLog gdk/gdk.h gdk/gdk_aggr.c gdk/gdk_align.c gdk/gdk_atoms.c gdk/gdk_atoms.h gdk/gdk_bat.c gdk/gdk_batop.c gdk/gdk_bbp.c gdk/gdk_calc.c gdk/gdk_calc_compare.h gdk/gdk_calc_private.h gdk/gdk_firstn.c gdk/gdk_group.c gdk/gdk_hash.c gdk/gdk_imprints.c gdk/gdk_join.c gdk/gdk_logger.c gdk/gdk_logger.h gdk/gdk_project.c gdk/gdk_qsort.c gdk/gdk_search.c gdk/gdk_select.c gdk/gdk_ssort.c gdk/gdk_unique.c gdk/gdk_utils.c gdk/gdk_value.c geom/monetdb5/geom.c monetdb5/extras/rapi/converters.c.h monetdb5/mal/mal_atom.c monetdb5/mal/mal_authorize.c monetdb5/mal/mal_builder.c monetdb5/mal/mal_debugger.c monetdb5/mal/mal_function.c monetdb5/mal/mal_instruction.c monetdb5/mal/mal_interpreter.c monetdb5/mal/mal_parser.c monetdb5/modules/atoms/color.c monetdb5/modules/atoms/color.h monetdb5/modules/atoms/json.c monetdb5/modules/atoms/mtime.c monetdb5/modules/atoms/str.c monetdb5/modules/kernel/algebra.c monetdb5/modules/kernel/batcolor.c monetdb5/modules/kernel/batmmath.c monetdb5/modules/kernel/microbenchmark.c monetdb5/modules/kernel/mmath.c monetdb5/modules/kernel/mmath.h monetdb5/modules/mal/batcalc.c monetdb5/modules/mal/calc.c monetdb5/modules/mal/clients.c monetdb5/modules/mal/iterator.c monetdb5/modules/mal/language.c monetdb5/modules/mal/mal_io.c monetdb5/modules/mal/mkey.c monetdb5/modules/mal/pcre.c monetdb5/modules/mal/remote.c monetdb5/modules/mal/tablet.c monetdb5/optimizer/opt_mergetable.c monetdb5/optimizer/opt_multiplex.c monetdb5/optimizer/opt_remap.c sql/ChangeLog sql/backends/monet5/LSST/lsst.c sql/backends/monet5/Tests/pyloader07.sql sql/backends/monet5/Tests/pyloader07.stable.out sql/backends/monet5/Tests/pyloader07.stable.out.Windows sql/backends/monet5/UDF/pyapi/conversion.c sql/backends/monet5/UDF/pyapi/convert_loops.h sql/backends/monet5/UDF/pyapi/emit.c sql/backends/monet5/UDF/pyapi/type_conversion.c sql/backends/monet5/UDF/udf/udf_impl.h sql/backends/monet5/generator/generator.c sql/backends/monet5/sql.c sql/backends/monet5/sql_cast_impl_down_from_flt.h sql/backends/monet5/sql_cast_impl_int.h sql/backends/monet5/sql_cast_impl_up_to_flt.h sql/backends/monet5/sql_cat.c sql/backends/monet5/sql_fround.c sql/backends/monet5/sql_fround_impl.h sql/backends/monet5/sql_result.c sql/backends/monet5/sql_round.c sql/backends/monet5/sql_round_impl.h sql/backends/monet5/sql_scenario.c sql/backends/monet5/sql_user.c sql/backends/monet5/vaults/bam/bam_lib.c sql/backends/monet5/vaults/fits/fits.c sql/backends/monet5/vaults/lidar/lidar.c sql/backends/monet5/vaults/netcdf/netcdf.c sql/backends/monet5/vaults/shp/shp.c sql/server/sql_atom.c sql/server/sql_mvc.c sql/server/sql_parser.y sql/server/sql_privileges.c sql/storage/bat/bat_storage.c sql/storage/bat/bat_table.c sql/storage/store.c sql/storage/store_dependency.c sql/test/BugTracker-2016/Tests/All sql/test/BugTracker-2017/Tests/double-groupby-column.Bug-6207.sql sql/test/BugTracker-2017/Tests/double-groupby-column.Bug-6207.stable.out sql/test/Tests/fsum.sql sql/test/Tests/fsum.stable.err sql/test/Tests/fsum.stable.out sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out sql/test/emptydb-upgrade/Tests/upgrade.stable.out sql/test/mergetables/Tests/All sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out sql/test/testdb-upgrade/Tests/upgrade.stable.out testing/Mtest.py.in Branch: jitudf Log Message:
Merge with default. diffs (truncated from 8668 to 300 lines): diff --git a/NT/monetdb_config.h.in b/NT/monetdb_config.h.in --- a/NT/monetdb_config.h.in +++ b/NT/monetdb_config.h.in @@ -33,6 +33,12 @@ #define _CRT_SECURE_NO_DEPRECATE 1 #endif +/* include Intel's mathimf.h early, before any other include files + * might try to include math.h */ +#ifdef __INTEL_COMPILER +#include <mathimf.h> +#endif + #include <malloc.h> #if defined(_DEBUG) && defined(_CRTDBG_MAP_ALLOC) @@ -229,11 +235,6 @@ /* Define to 1 if you have the <io.h> header file. */ #define HAVE_IO_H 1 -/* Define to 1 if you have the `isinf' function. */ -#if !defined(_MSC_VER) || _MSC_VER > 1600 -#define HAVE_ISINF 1 -#endif - /* Define to 1 if you have the <kvm.h> header file. */ /* #undef HAVE_KVM_H */ @@ -361,7 +362,7 @@ /* #undef HAVE_NL_LANGINFO */ /* Define to 1 if you have the `nextafterf' function. */ -#if !defined(_MSC_VER) || _MSC_VER > 1600 +#if defined(__INTEL_COMPILER) || !defined(_MSC_VER) || _MSC_VER > 1600 #define HAVE_NEXTAFTERF 1 #endif @@ -422,7 +423,7 @@ /* #undef HAVE_RESTRICT */ /* Define to 1 if you have the `round' function. */ -#if !defined(_MSC_VER) || _MSC_VER > 1600 +#if defined(__INTEL_COMPILER) || !defined(_MSC_VER) || _MSC_VER > 1600 #define HAVE_ROUND 1 #endif diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out --- a/clients/Tests/exports.stable.out +++ b/clients/Tests/exports.stable.out @@ -378,7 +378,7 @@ const bte bte_nil; int closedir(DIR *dir); ssize_t dblFromStr(const char *src, size_t *len, dbl **dst); ssize_t dblToStr(str *dst, size_t *len, const dbl *src); -const dbl dbl_nil; +NANCONST dbl dbl_nil; char *dirname(char *path); int dlclose(void *handle); char *dlerror(void); @@ -388,7 +388,7 @@ size_t escapedStr(char *dst, const char size_t escapedStrlen(const char *src, const char *sep1, const char *sep2, int quote); ssize_t fltFromStr(const char *src, size_t *len, flt **dst); ssize_t fltToStr(str *dst, size_t *len, const flt *src); -const flt flt_nil; +NANCONST flt flt_nil; geomcatalogfix_fptr geomcatalogfix_get(void); void geomcatalogfix_set(geomcatalogfix_fptr); geomsqlfix_fptr geomsqlfix_get(void); diff --git a/configure.ag b/configure.ag --- a/configure.ag +++ b/configure.ag @@ -2730,7 +2730,6 @@ AC_CHECK_FUNCS([\ getopt_long \ gettimeofday \ getuid \ - isinf \ llabs \ localtime_r \ lockf \ diff --git a/gdk/ChangeLog b/gdk/ChangeLog --- a/gdk/ChangeLog +++ b/gdk/ChangeLog @@ -1,6 +1,10 @@ # ChangeLog file for MonetDB # This file is updated with Maddlog +* Tue Nov 7 2017 Sjoerd Mullender <sjo...@acm.org> +- The NIL representation of the internal flt and dbl types was changed + from the smallest representable finite value to NaN (not-a-number). + * Mon Sep 18 2017 Sjoerd Mullender <sjo...@acm.org> - Changed the interface of ATOMformat and VALformat: they now return a pointer to the allocated string. diff --git a/gdk/gdk.h b/gdk/gdk.h --- a/gdk/gdk.h +++ b/gdk/gdk.h @@ -863,7 +863,8 @@ typedef struct { #define GDKLIBRARY_NOKEY 061034 /* nokey values can't be trusted */ #define GDKLIBRARY_BADEMPTY 061035 /* possibility of duplicate empty str */ #define GDKLIBRARY_TALIGN 061036 /* talign field in BBP.dir */ -#define GDKLIBRARY 061037 +#define GDKLIBRARY_NIL_NAN 061037 /* flt/dbl NIL not represented by NaN */ +#define GDKLIBRARY 061040 typedef struct BAT { /* static bat properties */ @@ -1297,13 +1298,13 @@ gdk_export BUN ORDERfndlast(BAT *b, cons gdk_export BUN BUNfnd(BAT *b, const void *right); #define BUNfndVOID(b, v) \ - (((*(const oid*)(v) == oid_nil) ^ ((b)->tseqbase == oid_nil)) | \ + ((is_oid_nil(*(const oid*)(v)) ^ is_oid_nil((b)->tseqbase)) | \ (*(const oid*)(v) < (b)->tseqbase) | \ (*(const oid*)(v) >= (b)->tseqbase + (b)->batCount) ? \ BUN_NONE : \ (BUN) (*(const oid*)(v) - (b)->tseqbase)) -#define BATttype(b) ((b)->ttype == TYPE_void && (b)->tseqbase != oid_nil ? \ +#define BATttype(b) ((b)->ttype == TYPE_void && !is_oid_nil((b)->tseqbase) ? \ TYPE_oid : (b)->ttype) #define Tbase(b) ((b)->tvheap->base) @@ -1532,19 +1533,19 @@ gdk_export void GDKqsort(void *h, void * gdk_export void GDKqsort_rev(void *h, void *t, const void *base, size_t n, int hs, int ts, int tpe); #define BATtordered(b) ((b)->ttype == TYPE_void || (b)->tsorted) -#define BATtrevordered(b) (((b)->ttype == TYPE_void && (b)->tseqbase == oid_nil) || (b)->trevsorted) -#define BATtdense(b) (BATtvoid(b) && (b)->tseqbase != oid_nil) +#define BATtrevordered(b) (((b)->ttype == TYPE_void && is_oid_nil((b)->tseqbase)) || (b)->trevsorted) +#define BATtdense(b) (BATtvoid(b) && !is_oid_nil((b)->tseqbase)) #define BATtvoid(b) (((b)->tdense && (b)->tsorted) || (b)->ttype==TYPE_void) #define BATtkey(b) (b->tkey != FALSE || BATtdense(b)) /* set some properties that are trivial to deduce */ #define BATsettrivprop(b) \ do { \ - assert((b)->hseqbase != oid_nil); \ + assert(!is_oid_nil((b)->hseqbase)); \ (b)->batDirtydesc = 1; /* likely already set */ \ /* the other head properties should already be correct */ \ if ((b)->ttype == TYPE_void) { \ - if ((b)->tseqbase == oid_nil) { \ + if (is_oid_nil((b)->tseqbase)) { \ (b)->tnonil = (b)->batCount == 0; \ (b)->tnil = !(b)->tnonil; \ (b)->trevsorted = 1; \ @@ -1574,7 +1575,7 @@ gdk_export void GDKqsort_rev(void *h, vo } else if ((b)->ttype == TYPE_oid) { \ /* b->batCount == 1 */ \ oid sqbs; \ - if ((sqbs = ((oid *) (b)->theap.base)[0]) == oid_nil) { \ + if (is_oid_nil((sqbs = ((oid *) (b)->theap.base)[0]))) { \ (b)->tdense = 0; \ (b)->tnonil = 0; \ (b)->tnil = 1; \ @@ -2431,7 +2432,7 @@ gdk_export void *THRdata[THREADDATA]; static inline bat BBPcheck(bat x, const char *y) { - if (x && x != bat_nil) { + if (!is_bat_nil(x)) { assert(x > 0); if (x < 0 || x >= getBBPsize() || BBP_logical(x) == NULL) { @@ -2461,7 +2462,7 @@ static inline char * Tpos(BATiter *bi, BUN p) { bi->tvid = bi->b->tseqbase; - if (bi->tvid != oid_nil) + if (!is_oid_nil(bi->tvid)) bi->tvid += p; return (char*)&bi->tvid; } diff --git a/gdk/gdk_aggr.c b/gdk/gdk_aggr.c --- a/gdk/gdk_aggr.c +++ b/gdk/gdk_aggr.c @@ -104,12 +104,12 @@ BATgroupaggrinit(BAT *b, BAT *g, BAT *e, gids = (const oid *) Tloc(g, 0); /* find first non-nil */ for (i = 0, ngrp = BATcount(g); i < ngrp; i++, gids++) { - if (*gids != oid_nil) { + if (!is_oid_nil(*gids)) { min = *gids; break; } } - if (min != oid_nil) { + if (!is_oid_nil(min)) { /* found a non-nil, max must be last * value (and there is one!) */ max = * (const oid *) Tloc(g, BUNlast(g) - 1); @@ -118,7 +118,7 @@ BATgroupaggrinit(BAT *b, BAT *g, BAT *e, /* we'll do a complete scan */ gids = (const oid *) Tloc(g, 0); for (i = 0, ngrp = BATcount(g); i < ngrp; i++, gids++) { - if (*gids != oid_nil) { + if (!is_oid_nil(*gids)) { if (*gids < min) min = *gids; if (*gids > max) @@ -151,13 +151,6 @@ BATgroupaggrinit(BAT *b, BAT *g, BAT *e, /* ---------------------------------------------------------------------- */ /* sum */ -#if defined(_MSC_VER) && !defined(__INTEL_COMPILER) && _MSC_VER < 1800 -#include <float.h> -#define isnan(x) _isnan(x) -#define isinf(x) (_fpclass(x) & (_FPCLASS_NINF | _FPCLASS_PINF)) -#define isfinite(x) _finite(x) -#endif - static inline int samesign(double x, double y) { @@ -215,6 +208,7 @@ dofsum(const void *restrict values, oid volatile double lo, hi; double twopow = pow((double) FLT_RADIX, (double) (DBL_MAX_EXP - 1)); BUN nils = 0; + volatile flt f; ALGODEBUG fprintf(stderr, "#%s: floating point summation\n", func); /* we only deal with the two floating point types */ @@ -260,9 +254,9 @@ dofsum(const void *restrict values, oid continue; if (pergroup[grp].partials == NULL) continue; - if (tp1 == TYPE_flt && ((const flt *) values)[listi] != flt_nil) + if (tp1 == TYPE_flt && !is_flt_nil(((const flt *) values)[listi])) x = ((const flt *) values)[listi]; - else if (tp1 == TYPE_dbl && ((const dbl *) values)[listi] != dbl_nil) + else if (tp1 == TYPE_dbl && !is_dbl_nil(((const dbl *) values)[listi])) x = ((const dbl *) values)[listi]; else { /* it's a nil */ @@ -362,15 +356,17 @@ dofsum(const void *restrict values, oid pergroup[grp].partials = NULL; x = 2 * (hi + y); if (tp2 == TYPE_flt) { - if (x > GDK_flt_max || - x <= GDK_flt_min) { + f = (flt) x; + if (isinf(f) || + isnan(f) || + is_flt_nil(f)) { if (abort_on_error) goto overflow; ((flt *) results)[grp] = flt_nil; nils++; } else - ((flt *) results)[grp] = (flt) x; - } else if (x == GDK_dbl_min) { + ((flt *) results)[grp] = f; + } else if (is_dbl_nil(x)) { if (abort_on_error) goto overflow; ((dbl *) results)[grp] = dbl_nil; @@ -432,14 +428,15 @@ dofsum(const void *restrict values, oid GDKfree(pergroup[grp].partials); pergroup[grp].partials = NULL; if (tp2 == TYPE_flt) { - if (hi > GDK_flt_max || hi <= GDK_flt_min) { + f = (flt) hi; + if (isinf(f) || isnan(f) || is_flt_nil(f)) { if (abort_on_error) goto overflow; ((flt *) results)[grp] = flt_nil; nils++; } else - ((flt *) results)[grp] = (flt) hi; - } else if (hi == GDK_dbl_min) { + ((flt *) results)[grp] = f; + } else if (is_dbl_nil(hi)) { if (abort_on_error) goto overflow; ((dbl *) results)[grp] = dbl_nil; @@ -486,7 +483,7 @@ dofsum(const void *restrict values, oid int seenval = 0; \ for (i = start; i < end && nils == 0; i++) { \ x = vals[i]; \ - if (x == TYPE1##_nil) { \ + if (is_##TYPE1##_nil(x)) { \ if (!skip_nils) { \ sum = TYPE2##_nil; \ nils = 1; \ @@ -519,7 +516,7 @@ dofsum(const void *restrict values, oid if (i >= end) \ break; \ x = vals[i]; \ - if (x == TYPE1##_nil) { \ + if (is_##TYPE1##_nil(x)) { \ if (!skip_nils) { \ sum = TYPE2##_nil; \ nils = 1; \ @@ -547,10 +544,10 @@ dofsum(const void *restrict values, oid (gids[i] >= min && gids[i] <= max)) { \ gid = gids ? gids[i] - min : (oid) i; \ x = vals[i]; \ - if (x == TYPE1##_nil) { \ + if (is_##TYPE1##_nil(x)) { \ if (!skip_nils) { \ sums[gid] = TYPE2##_nil; \ _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list