Changeset: 53bb444c8ee1 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=53bb444c8ee1
Added Files:
        sql/test/BugTracker-2009/Tests/AVG_of_SQRT.SF-2757642.sql
        
sql/test/BugTracker-2017/Tests/insert_into_multiple_subqueries.Bug-6448.sql
        
sql/test/BugTracker-2017/Tests/insert_into_multiple_subqueries.Bug-6448.stable.err
        
sql/test/BugTracker-2017/Tests/insert_into_multiple_subqueries.Bug-6448.stable.out
        
sql/test/BugTracker-2017/Tests/sqlitelogictest-cast-decimal.Bug-6445.stable.err
        
sql/test/BugTracker-2017/Tests/sqlitelogictest-cast-decimal.Bug-6445.stable.out
        sql/test/BugTracker-2017/Tests/sqlsmith.Bug-6449.sql
        sql/test/BugTracker-2017/Tests/sqlsmith.Bug-6449.stable.err
        sql/test/BugTracker-2017/Tests/sqlsmith.Bug-6449.stable.out
        sql/test/BugTracker-2017/Tests/table_returning_with.Bug-6444.sql
        sql/test/BugTracker-2017/Tests/table_returning_with.Bug-6444.stable.err
        sql/test/BugTracker-2017/Tests/table_returning_with.Bug-6444.stable.out
        sql/test/Tests/fsum.sql
        sql/test/Tests/fsum.stable.err
        sql/test/Tests/fsum.stable.out
        sql/test/Tests/fsum1.sql.src
        sql/test/Tests/fsum1.stable.err.src
        sql/test/Tests/fsum1.stable.out.src
        sql/test/mergetables/Tests/sqlsmith.Bug-6451.sql
        sql/test/mergetables/Tests/sqlsmith.Bug-6451.stable.err
        sql/test/mergetables/Tests/sqlsmith.Bug-6451.stable.out
        sql/test/mergetables/Tests/sqlsmith.Bug-6453.sql
        sql/test/mergetables/Tests/sqlsmith.Bug-6453.stable.err
        sql/test/mergetables/Tests/sqlsmith.Bug-6453.stable.out
        sql/test/mergetables/Tests/sqlsmith.Bug-6455.sql
        sql/test/mergetables/Tests/sqlsmith.Bug-6455.stable.err
        sql/test/mergetables/Tests/sqlsmith.Bug-6455.stable.out
Removed Files:
        sql/test/BugTracker-2009/Tests/AVG_of_SQRT.SF-2757642.SQL.py
        sql/test/BugTracker-2011/Tests/and-power.Bug-3013.stable.out.int128
Modified Files:
        MonetDB.spec
        NT/monetdb_config.h.in
        buildtools/selinux/monetdb.te
        clients/Tests/exports.stable.out
        configure.ag
        gdk/ChangeLog.Jul2017
        gdk/gdk.h
        gdk/gdk_aggr.c
        gdk/gdk_atoms.c
        gdk/gdk_atoms.h
        gdk/gdk_bat.c
        gdk/gdk_calc.c
        gdk/gdk_group.c
        gdk/gdk_hash.c
        gdk/gdk_join.c
        gdk/gdk_orderidx.c
        gdk/gdk_utils.c
        geom/monetdb5/geom.c
        geom/monetdb5/geom.h
        monetdb5/mal/mal_parser.c
        monetdb5/modules/kernel/mmath.h
        sql/backends/monet5/sql_gencode.c
        sql/server/rel_dump.c
        sql/server/rel_optimizer.c
        sql/server/rel_rel.c
        sql/server/rel_select.c
        sql/server/rel_sequence.c
        sql/server/rel_updates.c
        sql/server/sql_parser.h
        sql/server/sql_parser.y
        sql/server/sql_privileges.c
        sql/server/sql_scan.c
        sql/test/BugTracker-2009/Tests/AVG_of_SQRT.SF-2757642.stable.out
        sql/test/BugTracker-2011/Tests/and-power.Bug-3013.stable.out
        sql/test/BugTracker-2015/Tests/string_split.Bug-3564.stable.err
        sql/test/BugTracker-2017/Tests/All
        
sql/test/BugTracker-2017/Tests/extract_quarter_week_from_date.Bug-3831.sql
        sql/test/BugTracker/Tests/drop_schema_crash.SF-1504794.stable.err
        sql/test/BugTracker/Tests/set_a_new_user_password.SF-1844050.stable.err
        sql/test/Dependencies/Tests/Dependencies.stable.err
        sql/test/Tests/All
        sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.int128
        sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out
        sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.int128
        sql/test/emptydb-upgrade-hge/Tests/upgrade.stable.out.int128
        sql/test/emptydb-upgrade/Tests/upgrade.stable.out
        sql/test/emptydb-upgrade/Tests/upgrade.stable.out.int128
        sql/test/mergetables/Tests/All
        sql/test/testdb-upgrade-chain-hge/Tests/upgrade.stable.out.int128
        sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out
        sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out.int128
        sql/test/testdb-upgrade-hge/Tests/upgrade.stable.out.int128
        sql/test/testdb-upgrade/Tests/upgrade.stable.out
        sql/test/testdb-upgrade/Tests/upgrade.stable.out.int128
        testing/Mtest.py.in
        tools/merovingian/daemon/merovingian.c
Branch: jitudf
Log Message:

Merge with default.


diffs (truncated from 25152 to 300 lines):

diff --git a/MonetDB.spec b/MonetDB.spec
--- a/MonetDB.spec
+++ b/MonetDB.spec
@@ -885,7 +885,7 @@ developer, but if you do want to test, t
 
 %if %{?rhel:0}%{!?rhel:1} || 0%{?rhel} >= 7
 %package selinux
-Summary: MonetDB - Monet Database Management System
+Summary: SELinux policy files for MonetDB
 Group: Applications/Databases
 %if "%{_selinux_policy_version}" != ""
 Requires:       selinux-policy >= %{_selinux_policy_version}
@@ -1002,6 +1002,11 @@ make %{?_smp_mflags}
 
 %if %{?rhel:0}%{!?rhel:1} || 0%{?rhel} >= 7
 cd buildtools/selinux
+%if 0%{?fedora} < 27
+# no `map' policy available before Fedora 27
+sed -i '/map/d' monetdb.te
+%endif
+
 for selinuxvariant in %{selinux_variants}
 do
   make NAME=${selinuxvariant} -f /usr/share/selinux/devel/Makefile
@@ -1041,6 +1046,9 @@ done
 %postun -p /sbin/ldconfig
 
 %changelog
+* Sun Nov  5 2017 Sjoerd Mullender <sjo...@acm.org> - 11.27.9-20171105
+- BZ#6460 - selinux doen't allow mmap
+
 * Mon Oct 23 2017 Sjoerd Mullender <sjo...@acm.org> - 11.27.9-20171023
 - Rebuilt.
 - BZ#6207: identifier ambiguous when grouping and selecting the same
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
@@ -160,14 +160,6 @@
 /* Define if the fits module is to be enabled */
 /* #undef HAVE_FITS */
 
-/* Define to 1 if you have the `fpclass' function. */
-#define HAVE_FPCLASS 1         /* uses _fpclass, see mmath.c */
-
-/* Define to 1 if you have the `fpclassify' function. */
-#if defined(_MSC_VER) && _MSC_VER > 1600
-#define HAVE_FPCLASSIFY 1
-#endif
-
 /* Define to 1 if fseeko (and presumably ftello) exists and is declared. */
 /* #undef HAVE_FSEEKO */
 
diff --git a/buildtools/selinux/monetdb.te b/buildtools/selinux/monetdb.te
--- a/buildtools/selinux/monetdb.te
+++ b/buildtools/selinux/monetdb.te
@@ -1,4 +1,4 @@
-policy_module(monetdb, 0.1)
+policy_module(monetdb, 0.2)
 # The above line declares that this file is a SELinux policy file. Its
 # name is monetdb, so the file should be saved as monetdb.te
 
@@ -39,6 +39,7 @@ manage_files_pattern(mserver5_t, mserver
 manage_dirs_pattern(mserver5_t, mserver5_db_t, mserver5_db_t)
 manage_files_pattern(monetdbd_t, mserver5_db_t, mserver5_db_t)
 manage_dirs_pattern(monetdbd_t, mserver5_db_t, mserver5_db_t)
+allow mserver5_t mserver5_db_t:file { map };
 
 # the context used for the configuration files
 type monetdbd_etc_t;
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
@@ -10,7 +10,6 @@ void ALIGNsetH(BAT *b1, BAT *b2);
 void ALIGNsetT(BAT *b1, BAT *b2);
 int ALIGNsynced(BAT *b1, BAT *b2);
 int ATOMallocate(const char *nme);
-int ATOMcmp(int id, const void *v_1, const void *v_2);
 ptr ATOMdup(int id, const void *val);
 bte ATOMelmshift(int sz);
 char *ATOMformat(int id, const void *val);
diff --git a/configure.ag b/configure.ag
--- a/configure.ag
+++ b/configure.ag
@@ -2722,8 +2722,6 @@ AC_CHECK_FUNCS([\
        fabsf \
        fallocate \
        fcntl \
-       fpclass \
-       fpclassify \
        fsync \
        ftime \
        getexecname \
diff --git a/gdk/ChangeLog.Jul2017 b/gdk/ChangeLog.Jul2017
--- a/gdk/ChangeLog.Jul2017
+++ b/gdk/ChangeLog.Jul2017
@@ -1,3 +1,10 @@
 # ChangeLog file for MonetDB
 # This file is updated with Maddlog
 
+* Mon Oct 30 2017 Sjoerd Mullender <sjo...@acm.org>
+- Reimplemented summing of a column of floating point (flt and dbl)
+  values.  The old code could give wildly inaccurate results when adding
+  up lots and lots of values due to lack of precision.  Try SELECT sum(c)
+  FROM t; where t is 100,000,000 rows, c is of type REAL and all values
+  are equal to 1.1.  (The old code returned 33554432 instead of 1.1e8.)
+
diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -1795,7 +1795,7 @@ gdk_export BAT *BBPquickdesc(bat b, int 
  * value. `val' is a direct pointer to the atom value. Its return
  * value should be an hash_t between 0 and 'mask'.
  *
- * @item The @emph{ATOMcmp()} operation computes two atomic
+ * @item The @emph{ATOMcmp()} operation compares two atomic
  * values. Its parameters are pointers to atomic values.
  *
  * @item The @emph{ATOMlen()} operation computes the byte length for a
@@ -1896,7 +1896,6 @@ gdk_export int ATOMindex(const char *nme
 gdk_export str ATOMname(int id);
 gdk_export size_t ATOMlen(int id, const void *v);
 gdk_export ptr ATOMnil(int id);
-gdk_export int ATOMcmp(int id, const void *v_1, const void *v_2);
 gdk_export int ATOMprint(int id, const void *val, stream *fd);
 gdk_export char *ATOMformat(int id, const void *val);
 
@@ -2773,7 +2772,7 @@ gdk_export void ALIGNsetT(BAT *b1, BAT *
        for (hb = HASHget(h, hash_##TYPE(h, v));                \
             hb != HASHnil(h);                                  \
             hb = HASHgetlink(h,hb))                            \
-               if (simple_EQ(v, BUNtloc(bi, hb), TYPE))
+               if (* (const TYPE *) v == * (const TYPE *) BUNtloc(bi, hb))
 
 #define HASHloop_bte(bi, h, hb, v)     HASHloop_TYPE(bi, h, hb, v, bte)
 #define HASHloop_sht(bi, h, hb, v)     HASHloop_TYPE(bi, h, hb, v, sht)
diff --git a/gdk/gdk_aggr.c b/gdk/gdk_aggr.c
--- a/gdk/gdk_aggr.c
+++ b/gdk/gdk_aggr.c
@@ -10,7 +10,11 @@
 #include "gdk.h"
 #include "gdk_private.h"
 #include "gdk_calc_private.h"
+#if defined(_MSC_VER) && defined(__INTEL_COMPILER)
+#include <mathimf.h>
+#else
 #include <math.h>
+#endif
 
 /* grouped aggregates
  *
@@ -147,6 +151,314 @@ 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)
+{
+       return (x >= 0) == (y >= 0);
+}
+
+/* Add two values, producing the sum and the remainder due to limited
+ * range of floating point arithmetic.  This function depends on the
+ * fact that the sum returns INFINITY in *hi of the correct sign
+ * (i.e. isinf() returns TRUE) in case of overflow. */
+static inline void
+twosum(volatile double *hi, volatile double *lo, double x, double y)
+{
+       volatile double yr;
+
+       assert(fabs(x) >= fabs(y));
+
+       *hi = x + y;
+       yr = *hi - x;
+       *lo = y - yr;
+}
+
+static inline void
+exchange(double *x, double *y)
+{
+       double t = *x;
+       *x = *y;
+       *y = t;
+}
+
+/* this function was adapted from https://bugs.python.org/file10357/msum4.py */
+static BUN
+dofsum(const void *restrict values, oid seqb, BUN start, BUN end,
+       void *restrict results, BUN ngrp, int tp1, int tp2,
+       const oid *restrict cand, const oid *candend, const oid *restrict gids,
+       oid min, oid max, int skip_nils, int abort_on_error,
+       int nil_if_empty, const char *func)
+{
+       struct pergroup {
+               int npartials;
+               int maxpartials;
+               int valseen;
+#ifdef INFINITES_ALLOWED
+               float infs;
+#else
+               int infs;
+#endif
+               double *partials;
+       } *pergroup;
+       BUN listi;
+       int parti;
+       int i;
+       BUN grp;
+       double x, y;
+       volatile double lo, hi;
+       double twopow = pow((double) FLT_RADIX, (double) (DBL_MAX_EXP - 1));
+       BUN nils = 0;
+
+       ALGODEBUG fprintf(stderr, "#%s: floating point summation\n", func);
+       /* we only deal with the two floating point types */
+       assert(tp1 == TYPE_flt || tp1 == TYPE_dbl);
+       assert(tp2 == TYPE_flt || tp2 == TYPE_dbl);
+       /* if input is dbl, then so it output */
+       assert(tp2 == TYPE_flt || tp1 == TYPE_dbl);
+       /* if no gids, then we have a single group */
+       assert(ngrp == 1 || gids != NULL);
+       if (gids == NULL || ngrp == 1) {
+               min = max = 0;
+               ngrp = 1;
+               gids = NULL;
+       }
+       pergroup = GDKmalloc(ngrp * sizeof(*pergroup));
+       if (pergroup == NULL)
+               return BUN_NONE;
+       for (grp = 0; grp < ngrp; grp++) {
+               pergroup[grp].npartials = 0;
+               pergroup[grp].valseen = 0;
+               pergroup[grp].maxpartials = 2;
+               pergroup[grp].infs = 0;
+               pergroup[grp].partials = GDKmalloc(pergroup[grp].maxpartials * 
sizeof(double));
+               if (pergroup[grp].partials == NULL) {
+                       while (grp > 0)
+                               GDKfree(pergroup[--grp].partials);
+                       GDKfree(pergroup);
+                       return BUN_NONE;
+               }
+       }
+       for (;;) {
+               if (cand) {
+                       if (cand >= candend)
+                               break;
+                       listi = *cand++ - seqb;
+               } else {
+                       if (start >= end)
+                               break;
+                       listi = start++;
+               }
+               grp = gids ? gids[listi] : 0;
+               if (grp < min || grp > max)
+                       continue;
+               if (pergroup[grp].partials == NULL)
+                       continue;
+               if (tp1 == TYPE_flt && ((const flt *) values)[listi] != flt_nil)
+                       x = ((const flt *) values)[listi];
+               else if (tp1 == TYPE_dbl && ((const dbl *) values)[listi] != 
dbl_nil)
+                       x = ((const dbl *) values)[listi];
+               else {
+                       /* it's a nil */
+                       if (!skip_nils) {
+                               if (tp2 == TYPE_flt)
+                                       ((flt *) results)[grp] = flt_nil;
+                               else
+                                       ((dbl *) results)[grp] = dbl_nil;
+                               GDKfree(pergroup[grp].partials);
+                               pergroup[grp].partials = NULL;
+                               if (++nils == ngrp)
+                                       break;
+                       }
+                       continue;
+               }
+               pergroup[grp].valseen = 1;
+#ifdef INFINITES_ALLOWED
+               if (isinf(x)) {
+                       pergroup[grp].infs += x;
+                       continue;
+               }
+#endif
+               i = 0;
+               for (parti = 0; parti < pergroup[grp].npartials; parti++) {
+                       y = pergroup[grp].partials[parti];
+                       if (fabs(x) < fabs(y))
+                               exchange(&x, &y);
+                       twosum(&hi, &lo, x, y);
+                       if (isinf(hi)) {
+                               int sign = hi > 0 ? 1 : -1;
+                               hi = x - twopow * sign;
+                               x = hi - twopow * sign;
+                               pergroup[grp].infs += sign;
+                               if (fabs(x) < fabs(y))
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to