Changeset: 43db749925a8 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=43db749925a8
Added Files:
        sql/backends/monet5/sql_cast_impl_int.h
        sql/test/BugTracker-2017/Tests/round-or-truncate.Bug-6193.sql
        sql/test/BugTracker-2017/Tests/round-or-truncate.Bug-6193.stable.err
        sql/test/BugTracker-2017/Tests/round-or-truncate.Bug-6193.stable.out
Removed Files:
        sql/backends/monet5/sql_cast_impl_down_from_int.h
        sql/backends/monet5/sql_cast_impl_up_to_int.h
        
sql/test/sys-schema/Tests/check_ForeignKey_referential_integrity.stable.out.int128
Modified Files:
        gdk/gdk_calc.c
        geom/BugTracker/Tests/All
        geom/BugTracker/Tests/X_crash.SF-1971632.sql
        monetdb5/extras/mal_optimizer_template/Tests/All
        monetdb5/extras/mal_optimizer_template/Tests/opt_sql_append.sql
        monetdb5/optimizer/opt_pipes.c
        sql/backends/monet5/Makefile.ag
        sql/backends/monet5/generator/Tests/generator04.sql
        sql/backends/monet5/generator/Tests/generator04.stable.err
        sql/backends/monet5/sql.c
        sql/backends/monet5/sql_cast.c
        sql/backends/monet5/sql_cast_impl_down_from_flt.h
        sql/backends/monet5/sql_cast_impl_up_to_flt.h
        sql/jdbc/tests/Tests/All
        sql/server/sql_atom.c
        sql/test/ADT2006/Tests/bram.stable.out
        sql/test/BugTracker-2009/Tests/All
        
sql/test/BugTracker-2009/Tests/segfault_when_quitting_debugger.SF-2538837.sql
        sql/test/BugTracker-2015/Tests/cast_to_num.Bug-3744.stable.out
        sql/test/BugTracker-2016/Tests/All
        sql/test/BugTracker-2016/Tests/convert-function-test.Bug-3460.sql
        sql/test/BugTracker-2016/Tests/convert-function-test.Bug-3460.stable.out
        
sql/test/BugTracker-2016/Tests/convert-function-test.Bug-3460.stable.out.int128
        sql/test/BugTracker-2017/Tests/All
        sql/test/VOC/Tests/VOC.stable.out
        sql/test/mergetables/Tests/forex.stable.out
        sql/test/mergetables/Tests/forex.stable.out.int128
        sql/test/pg_regress/Tests/All
        sql/test/pg_regress/Tests/int8.sql
        sql/test/pg_regress/Tests/numeric.sql
        sql/test/pg_regress/Tests/numeric.stable.err
        sql/test/pg_regress/Tests/numeric.stable.out
        sql/test/pg_regress/Tests/numerology.stable.out
        sql/test/sys-schema/Tests/check_ForeignKey_referential_integrity.sql
        
sql/test/sys-schema/Tests/check_ForeignKey_referential_integrity.stable.out
Branch: default
Log Message:

Merge with Dec2016 branch.


diffs (truncated from 5597 to 300 lines):

diff --git a/gdk/gdk_calc.c b/gdk/gdk_calc.c
--- a/gdk/gdk_calc.c
+++ b/gdk/gdk_calc.c
@@ -13447,6 +13447,13 @@ convert_##TYPE1##_##TYPE2(const TYPE1 *s
 /* Special version of the above for converting from floating point.
  * The final assignment rounds the value which can still come out to
  * the NIL representation, so we need to check for that. */
+#ifdef TRUNCATE_NUMBERS
+#define roundflt(x)    (x)
+#define rounddbl(x)    (x)
+#else
+#define roundflt(x)    roundf(x)
+#define rounddbl(x)    round(x)
+#endif
 #define convertimpl_reduce_float(TYPE1, TYPE2)                         \
 static BUN                                                             \
 convert_##TYPE1##_##TYPE2(const TYPE1 *src, TYPE2 *restrict dst, BUN cnt, \
@@ -13468,7 +13475,7 @@ convert_##TYPE1##_##TYPE2(const TYPE1 *s
                                CONV_OVERFLOW(TYPE1, #TYPE2, src[i]);   \
                        dst[i] = TYPE2##_nil;                           \
                        nils++;                                         \
-               } else if ((dst[i] = (TYPE2) src[i]) == TYPE2##_nil &&  \
+               } else if ((dst[i] = (TYPE2) round##TYPE1(src[i])) == 
TYPE2##_nil && \
                           abort_on_error)                              \
                        CONV_OVERFLOW(TYPE1, #TYPE2, src[i]);           \
        }                                                               \
@@ -13575,6 +13582,9 @@ convertimpl_reduce_float(dbl, lng)
 #ifdef HAVE_HGE
 convertimpl_reduce_float(dbl, hge)
 #endif
+#undef rounddbl
+/* no rounding here */
+#define rounddbl(x)    (x)
 convertimpl_reduce_float(dbl, flt)
 convertimpl_copy(dbl)
 
diff --git a/geom/BugTracker/Tests/All b/geom/BugTracker/Tests/All
--- a/geom/BugTracker/Tests/All
+++ b/geom/BugTracker/Tests/All
@@ -1,7 +1,7 @@
 # tests related to bug reports:
 # <descriptive-name>.SF-<bug-report-id>[.<ext>]
 
-HAVE_GEOM&THREADS=1?X_crash.SF-1971632
+HAVE_GEOM?X_crash.SF-1971632
 HAVE_GEOM?copy_into_crash.SF-1975402
 HAVE_GEOM?copy_into_mbr.3492
 
diff --git a/geom/BugTracker/Tests/X_crash.SF-1971632.sql 
b/geom/BugTracker/Tests/X_crash.SF-1971632.sql
--- a/geom/BugTracker/Tests/X_crash.SF-1971632.sql
+++ b/geom/BugTracker/Tests/X_crash.SF-1971632.sql
@@ -1,3 +1,5 @@
+set optimizer = 'sequential_pipe'; -- to get predictable errors
+
 CREATE TABLE geoms (id INTEGER, g GEOMETRY);
 INSERT INTO geoms values (1, 'POINT(10 10)');
 INSERT INTO geoms values (2, 'LINESTRING(10 10, 20 20, 30 40)');
diff --git a/monetdb5/extras/mal_optimizer_template/Tests/All 
b/monetdb5/extras/mal_optimizer_template/Tests/All
--- a/monetdb5/extras/mal_optimizer_template/Tests/All
+++ b/monetdb5/extras/mal_optimizer_template/Tests/All
@@ -1,1 +1,1 @@
-THREADS=1?opt_sql_append
+opt_sql_append
diff --git a/monetdb5/extras/mal_optimizer_template/Tests/opt_sql_append.sql 
b/monetdb5/extras/mal_optimizer_template/Tests/opt_sql_append.sql
--- a/monetdb5/extras/mal_optimizer_template/Tests/opt_sql_append.sql
+++ b/monetdb5/extras/mal_optimizer_template/Tests/opt_sql_append.sql
@@ -1,3 +1,5 @@
+set optimizer = 'sequential_pipe'; -- to get predictable errors
+
 create table ttt (a int, b int, c int);
 select optimizer;
 select def from optimizers() where name = optimizer;
diff --git a/monetdb5/optimizer/opt_pipes.c b/monetdb5/optimizer/opt_pipes.c
--- a/monetdb5/optimizer/opt_pipes.c
+++ b/monetdb5/optimizer/opt_pipes.c
@@ -157,8 +157,8 @@ static struct PIPELINES {
         "optimizer.dataflow();"
         "optimizer.querylog();"
         "optimizer.multiplex();"
+        "optimizer.generator();"
         "optimizer.profiler();"
-        "optimizer.generator();"
         "optimizer.candidates();"
 //      "optimizer.jit();" awaiting the new batcalc api
 //      "optimizer.oltp();"awaiting the autocommit front-end changes
diff --git a/sql/backends/monet5/Makefile.ag b/sql/backends/monet5/Makefile.ag
--- a/sql/backends/monet5/Makefile.ag
+++ b/sql/backends/monet5/Makefile.ag
@@ -40,9 +40,8 @@ lib__sql = {
                sql_result.c sql_result.h \
                sql_cast.c sql_cast.h \
                sql_cast_impl_down_from_flt.h \
-               sql_cast_impl_down_from_int.h \
+               sql_cast_impl_int.h \
                sql_cast_impl_up_to_flt.h \
-               sql_cast_impl_up_to_int.h \
                sql_round.c sql_round_impl.h sql_bat2time.c \
                sql_fround.c sql_fround_impl.h \
                sql_orderidx.c sql_orderidx.h \
diff --git a/sql/backends/monet5/generator/Tests/generator04.sql 
b/sql/backends/monet5/generator/Tests/generator04.sql
--- a/sql/backends/monet5/generator/Tests/generator04.sql
+++ b/sql/backends/monet5/generator/Tests/generator04.sql
@@ -1,3 +1,5 @@
+set optimizer = 'sequential_pipe'; -- to get predictable errors
+
 -- some unit  tests
 select * from generate_series('a','a','c');
 
diff --git a/sql/backends/monet5/generator/Tests/generator04.stable.err 
b/sql/backends/monet5/generator/Tests/generator04.stable.err
--- a/sql/backends/monet5/generator/Tests/generator04.stable.err
+++ b/sql/backends/monet5/generator/Tests/generator04.stable.err
@@ -31,8 +31,8 @@ stderr of test 'generator04` in director
 
 MAPI  = (monetdb) /var/tmp/mtest-20019/.s.monetdb.36969
 QUERY = select * from generate_series('a','a','c');
-ERROR = !conversion of string 'c' to type bte failed.
-MAPI  = (monetdb) /var/tmp/mtest-20019/.s.monetdb.36969
+ERROR = !conversion of string 'a' to type bte failed.
+MAPI  = (monetdb) /var/tmp/mtest-3000/.s.monetdb.31545
 QUERY = select * from generate_series(false,true,false) ;
 ERROR = !zero step size not allowed
 MAPI  = (monetdb) /var/tmp/mtest-20019/.s.monetdb.36969
diff --git a/sql/backends/monet5/sql.c b/sql/backends/monet5/sql.c
--- a/sql/backends/monet5/sql.c
+++ b/sql/backends/monet5/sql.c
@@ -2588,13 +2588,13 @@ mvc_bin_import_table_wrap(Client cntxt, 
                        // no filename for this column, skip for now because we 
potentially don't know the count yet
                        continue;
                } else if (tpe < TYPE_str || tpe == TYPE_date || tpe == 
TYPE_daytime || tpe == TYPE_timestamp) {
-                       c = BATattach(col->type.type->localtype, fname, 
PERSISTENT);
+                       c = BATattach(col->type.type->localtype, fname, 
TRANSIENT);
                        if (c == NULL)
                                throw(SQL, "sql", "Failed to attach file %s", 
fname);
                        BATsetaccess(c, BAT_READ);
                } else if (tpe == TYPE_str) {
                        /* get the BAT and fill it with the strings */
-                       c = COLnew(0, TYPE_str, 0, PERSISTENT);
+                       c = COLnew(0, TYPE_str, 0, TRANSIENT);
                        if (c == NULL)
                                throw(SQL, "sql", MAL_MALLOC_FAIL);
                        /* this code should be extended to deal with larger 
text strings. */
@@ -2637,7 +2637,7 @@ mvc_bin_import_table_wrap(Client cntxt, 
                                BUN loop = 0;
                                const void* nil = ATOMnilptr(tpe);
                                // fill the new BAT with NULL values
-                               c = COLnew(0, tpe, cnt, PERSISTENT);
+                               c = COLnew(0, tpe, cnt, TRANSIENT);
                                for(loop = 0; loop < cnt; loop++) {
                                        BUNappend(c, nil, 0);
                                }
diff --git a/sql/backends/monet5/sql_cast.c b/sql/backends/monet5/sql_cast.c
--- a/sql/backends/monet5/sql_cast.c
+++ b/sql/backends/monet5/sql_cast.c
@@ -465,96 +465,96 @@ SQLbatstr_cast(Client cntxt, MalBlkPtr m
        return msg;
 }
 
-/* sql_cast_impl_up_to_int */
+/* up casting */
 
 #define TP1 bte
 #define TP2 bte
-#include "sql_cast_impl_up_to_int.h"
+#include "sql_cast_impl_int.h"
 #undef TP2
 #undef TP1
 
 #define TP1 bte
 #define TP2 sht
-#include "sql_cast_impl_up_to_int.h"
+#include "sql_cast_impl_int.h"
 #undef TP2
 #undef TP1
 
 #define TP1 sht
 #define TP2 sht
-#include "sql_cast_impl_up_to_int.h"
+#include "sql_cast_impl_int.h"
 #undef TP2
 #undef TP1
 
 #define TP1 bte
 #define TP2 int
-#include "sql_cast_impl_up_to_int.h"
+#include "sql_cast_impl_int.h"
 #undef TP2
 #undef TP1
 
 #define TP1 sht
 #define TP2 int
-#include "sql_cast_impl_up_to_int.h"
+#include "sql_cast_impl_int.h"
 #undef TP2
 #undef TP1
 
 #define TP1 int
 #define TP2 int
-#include "sql_cast_impl_up_to_int.h"
+#include "sql_cast_impl_int.h"
 #undef TP2
 #undef TP1
 
 #define TP1 bte
 #define TP2 lng
-#include "sql_cast_impl_up_to_int.h"
+#include "sql_cast_impl_int.h"
 #undef TP2
 #undef TP1
 
 #define TP1 sht
 #define TP2 lng
-#include "sql_cast_impl_up_to_int.h"
+#include "sql_cast_impl_int.h"
 #undef TP2
 #undef TP1
 
 #define TP1 int
 #define TP2 lng
-#include "sql_cast_impl_up_to_int.h"
+#include "sql_cast_impl_int.h"
 #undef TP2
 #undef TP1
 
 #define TP1 lng
 #define TP2 lng
-#include "sql_cast_impl_up_to_int.h"
+#include "sql_cast_impl_int.h"
 #undef TP2
 #undef TP1
 
 #ifdef HAVE_HGE
 #define TP1 bte
 #define TP2 hge
-#include "sql_cast_impl_up_to_int.h"
+#include "sql_cast_impl_int.h"
 #undef TP2
 #undef TP1
 
 #define TP1 sht
 #define TP2 hge
-#include "sql_cast_impl_up_to_int.h"
+#include "sql_cast_impl_int.h"
 #undef TP2
 #undef TP1
 
 #define TP1 int
 #define TP2 hge
-#include "sql_cast_impl_up_to_int.h"
+#include "sql_cast_impl_int.h"
 #undef TP2
 #undef TP1
 
 #define TP1 lng
 #define TP2 hge
-#include "sql_cast_impl_up_to_int.h"
+#include "sql_cast_impl_int.h"
 #undef TP2
 #undef TP1
 
 #define TP1 hge
 #define TP2 hge
-#include "sql_cast_impl_up_to_int.h"
+#include "sql_cast_impl_int.h"
 #undef TP2
 #undef TP1
 #endif
@@ -691,64 +691,66 @@ SQLbatstr_cast(Client cntxt, MalBlkPtr m
 #undef TP1
 #endif
 
-/* sql_cast_impl_down_from_int */
+/* down casting */
+
+#define DOWNCAST
 
 #define TP1 sht
 #define TP2 bte
-#include "sql_cast_impl_down_from_int.h"
+#include "sql_cast_impl_int.h"
 #undef TP2
 #undef TP1
 
 #define TP1 int
 #define TP2 bte
-#include "sql_cast_impl_down_from_int.h"
+#include "sql_cast_impl_int.h"
 #undef TP2
 #undef TP1
 
 #define TP1 lng
 #define TP2 bte
-#include "sql_cast_impl_down_from_int.h"
+#include "sql_cast_impl_int.h"
 #undef TP2
 #undef TP1
 
 #ifdef HAVE_HGE
 #define TP1 hge
 #define TP2 bte
-#include "sql_cast_impl_down_from_int.h"
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to