Changeset: 53ba06566e98 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=53ba06566e98
Added Files:
        sql/test/BugTracker-2018/Tests/concat-str-int.Bug-6583.sql
        sql/test/BugTracker-2018/Tests/nested-merge-tables.Bug-6585.sql
        sql/test/BugTracker-2018/Tests/nested-merge-tables.Bug-6585.stable.err
        sql/test/BugTracker-2018/Tests/nested-merge-tables.Bug-6585.stable.out
        
sql/test/BugTracker-2018/Tests/sqlitelogictest-aritmetic-expressions-handling.Bug-6576.stable.out.int128
Modified Files:
        gdk/gdk_project.c
        sql/backends/monet5/sql_cat.c
        sql/server/rel_schema.c
        sql/test/BugTracker-2018/Tests/All
        
sql/test/BugTracker-2018/Tests/sqlitelogictest-not-between-wrong.Bug-6569.sql
        
sql/test/BugTracker-2018/Tests/sqlitelogictest-not-between-wrong.Bug-6569.stable.out
        testing/Mtest.py.in
Branch: default
Log Message:

Merge with Mar2018


diffs (truncated from 814 to 300 lines):

diff --git a/gdk/gdk_project.c b/gdk/gdk_project.c
--- a/gdk/gdk_project.c
+++ b/gdk/gdk_project.c
@@ -18,7 +18,7 @@
 
 #define project_loop(TYPE)                                             \
 static gdk_return                                                      \
-project_##TYPE(BAT *bn, BAT *l, BAT *r, int nilcheck)                  \
+project_##TYPE(BAT *bn, BAT *l, BAT *r, bool nilcheck)                 \
 {                                                                      \
        oid lo, hi;                                                     \
        const TYPE *restrict rt;                                        \
@@ -39,11 +39,11 @@ project_##TYPE(BAT *bn, BAT *l, BAT *r, 
                        if (o[lo] < rseq || o[lo] >= rend) {            \
                                if (is_oid_nil(o[lo])) {                \
                                        bt[lo] = TYPE##_nil;            \
-                                       bn->tnonil = 0;                 \
-                                       bn->tnil = 1;                   \
-                                       bn->tsorted = 0;                \
-                                       bn->trevsorted = 0;             \
-                                       bn->tkey = 0;                   \
+                                       bn->tnonil = false;             \
+                                       bn->tnil = true;                \
+                                       bn->tsorted = false;            \
+                                       bn->trevsorted = false;         \
+                                       bn->tkey = false;               \
                                        lo++;                           \
                                        break;                          \
                                } else {                                \
@@ -54,8 +54,8 @@ project_##TYPE(BAT *bn, BAT *l, BAT *r, 
                                v = rt[o[lo] - rseq];                   \
                                bt[lo] = v;                             \
                                if (is_##TYPE##_nil(v) && bn->tnonil) { \
-                                       bn->tnonil = 0;                 \
-                                       bn->tnil = 1;                   \
+                                       bn->tnonil = false;             \
+                                       bn->tnil = true;                \
                                        lo++;                           \
                                        break;                          \
                                }                                       \
@@ -66,11 +66,11 @@ project_##TYPE(BAT *bn, BAT *l, BAT *r, 
                if (o[lo] < rseq || o[lo] >= rend) {                    \
                        if (is_oid_nil(o[lo])) {                        \
                                bt[lo] = TYPE##_nil;                    \
-                               bn->tnonil = 0;                         \
-                               bn->tnil = 1;                           \
-                               bn->tsorted = 0;                        \
-                               bn->trevsorted = 0;                     \
-                               bn->tkey = 0;                           \
+                               bn->tnonil = false;                     \
+                               bn->tnil = true;                        \
+                               bn->tsorted = false;                    \
+                               bn->trevsorted = false;                 \
+                               bn->tkey = false;                       \
                        } else {                                        \
                                GDKerror("BATproject: does not match 
always\n"); \
                                return GDK_FAIL;                        \
@@ -110,20 +110,20 @@ project_void(BAT *bn, BAT *l, BAT *r)
        bt = (oid *) Tloc(bn, 0);
        bn->tsorted = l->tsorted;
        bn->trevsorted = l->trevsorted;
-       bn->tkey = l->tkey & 1;
-       bn->tnonil = 1;
-       bn->tnil = 0;
+       bn->tkey = l->tkey;
+       bn->tnonil = true;
+       bn->tnil = false;
        rseq = r->hseqbase;
        rend = rseq + BATcount(r);
        for (lo = 0, hi = lo + BATcount(l); lo < hi; lo++) {
                if (o[lo] < rseq || o[lo] >= rend) {
                        if (is_oid_nil(o[lo])) {
                                bt[lo] = oid_nil;
-                               bn->tnonil = 0;
-                               bn->tnil = 1;
-                               bn->tsorted = 0;
-                               bn->trevsorted = 0;
-                               bn->tkey = 0;
+                               bn->tnonil = false;
+                               bn->tnil = true;
+                               bn->tsorted = false;
+                               bn->trevsorted = false;
+                               bn->tkey = false;
                        } else {
                                GDKerror("BATproject: does not match always\n");
                                return GDK_FAIL;
@@ -138,7 +138,7 @@ project_void(BAT *bn, BAT *l, BAT *r)
 }
 
 static gdk_return
-project_any(BAT *bn, BAT *l, BAT *r, int nilcheck)
+project_any(BAT *bn, BAT *l, BAT *r, bool nilcheck)
 {
        BUN n;
        oid lo, hi;
@@ -158,11 +158,11 @@ project_any(BAT *bn, BAT *l, BAT *r, int
                if (o[lo] < rseq || o[lo] >= rend) {
                        if (is_oid_nil(o[lo])) {
                                tfastins_nocheck(bn, n, nil, Tsize(bn));
-                               bn->tnonil = 0;
-                               bn->tnil = 1;
-                               bn->tsorted = 0;
-                               bn->trevsorted = 0;
-                               bn->tkey = 0;
+                               bn->tnonil = false;
+                               bn->tnil = true;
+                               bn->tsorted = false;
+                               bn->trevsorted = false;
+                               bn->tkey = false;
                        } else {
                                GDKerror("BATproject: does not match always\n");
                                goto bunins_failed;
@@ -171,8 +171,8 @@ project_any(BAT *bn, BAT *l, BAT *r, int
                        v = BUNtail(ri, o[lo] - rseq);
                        tfastins_nocheck(bn, n, v, Tsize(bn));
                        if (nilcheck && bn->tnonil && cmp(v, nil) == 0) {
-                               bn->tnonil = 0;
-                               bn->tnil = 1;
+                               bn->tnonil = false;
+                               bn->tnil = true;
                        }
                }
        }
@@ -189,7 +189,8 @@ BATproject(BAT *l, BAT *r)
        BAT *bn;
        oid lo, hi;
        gdk_return res;
-       int tpe = ATOMtype(r->ttype), nilcheck = 1, stringtrick = 0;
+       int tpe = ATOMtype(r->ttype);
+       bool nilcheck = true, stringtrick = false;
        BUN lcount = BATcount(l), rcount = BATcount(r);
        lng t0 = 0;
 
@@ -264,26 +265,26 @@ BATproject(BAT *l, BAT *r)
                tpe = r->twidth == 1 ? TYPE_bte : (r->twidth == 2 ? TYPE_sht : 
(r->twidth == 4 ? TYPE_int : TYPE_lng));
                /* int's nil representation is a valid offset, so
                 * don't check for nils */
-               nilcheck = 0;
-               stringtrick = 1;
+               nilcheck = false;
+               stringtrick = true;
        }
        bn = COLnew(l->hseqbase, tpe, BATcount(l), TRANSIENT);
        if (bn == NULL)
                return NULL;
        if (stringtrick) {
                /* "string type" */
-               bn->tsorted = 0;
-               bn->trevsorted = 0;
-               bn->tkey = 0;
-               bn->tnonil = 0;
+               bn->tsorted = false;
+               bn->trevsorted = false;
+               bn->tkey = false;
+               bn->tnonil = false;
        } else {
                /* be optimistic, we'll clear these if necessary later */
-               bn->tnonil = 1;
-               bn->tsorted = 1;
-               bn->trevsorted = 1;
-               bn->tkey = 1;
+               bn->tnonil = true;
+               bn->tsorted = true;
+               bn->trevsorted = true;
+               bn->tkey = true;
                if (l->tnonil && r->tnonil)
-                       nilcheck = 0; /* don't bother checking: no nils */
+                       nilcheck = false; /* don't bother checking: no nils */
                if (tpe != TYPE_oid &&
                    tpe != ATOMstorage(tpe) &&
                    !ATOMvarsized(tpe) &&
@@ -298,7 +299,7 @@ BATproject(BAT *l, BAT *r)
                        tpe = ATOMstorage(tpe);
                }
        }
-       bn->tnil = 0;
+       bn->tnil = false;
 
        switch (tpe) {
        case TYPE_bte:
@@ -362,18 +363,18 @@ BATproject(BAT *l, BAT *r)
                                goto bailout;
                }
                bn->ttype = r->ttype;
-               bn->tvarsized = 1;
+               bn->tvarsized = true;
                bn->twidth = r->twidth;
                bn->tshift = r->tshift;
 
-               bn->tnil = 0; /* we don't know */
+               bn->tnil = false; /* we don't know */
        }
        /* some properties follow from certain combinations of input
         * properties */
        if (BATcount(bn) <= 1) {
-               bn->tkey = 1;
-               bn->tsorted = 1;
-               bn->trevsorted = 1;
+               bn->tkey = true;
+               bn->tsorted = true;
+               bn->trevsorted = true;
        } else {
                bn->tkey = l->tkey && r->tkey;
                bn->tsorted = (l->tsorted & r->tsorted) | (l->trevsorted & 
r->trevsorted);
@@ -433,8 +434,8 @@ BATprojectchain(BAT **bats)
        const void *nil;        /* nil representation for last BAT */
        BUN p, cnt, off;
        oid hseq, tseq;
-       int allnil = 0, nonil = 1;
-       int stringtrick = 0;
+       bool allnil = false, nonil = true;
+       bool stringtrick = false;
 
        /* count number of participating BATs and allocate some
         * temporary work space */
@@ -449,8 +450,7 @@ BATprojectchain(BAT **bats)
        tseq = oid_nil;         /* initialize, but overwritten before use */
        off = 0;                /* this will be the BUN offset into last BAT */
        for (i = n = 0; b != NULL; n++, i++) {
-               if (!b->tnonil)
-                       nonil = 0; /* not guaranteed without nils */
+               nonil &= b->tnonil; /* not guaranteed without nils */
                if (!allnil) {
                        if (n > 0 && ba[i-1].vals == NULL) {
                                /* previous BAT was dense-tailed: we will
@@ -491,7 +491,7 @@ BATprojectchain(BAT **bats)
                                        if (b->ttype == TYPE_void &&
                                            is_oid_nil(b->tseqbase)) {
                                                tseq = oid_nil;
-                                               allnil = 1;
+                                               allnil = true;
                                        } else
                                                ba[i].vals = (const oid *) 
Tloc(b, off);
                                }
@@ -506,7 +506,7 @@ BATprojectchain(BAT **bats)
                                        tseq = oid_nil;
                                        if (b->ttype == TYPE_void &&
                                            is_oid_nil(b->tseqbase))
-                                               allnil = 1;
+                                               allnil = true;
                                        else
                                                ba[i].vals = (const oid *) 
Tloc(b, 0);
                                }
@@ -523,7 +523,7 @@ BATprojectchain(BAT **bats)
        }
        assert(n >= 1);         /* not too few inputs */
        b = bats[-2];           /* the last BAT in the list (bats[-1]==NULL) */
-       tpe = b->ttype;         /* its type */
+       tpe = ATOMtype(b->ttype); /* its type */
        nil = ATOMnilptr(tpe);
        if (allnil) {
                /* somewhere on the way we encountered a void-nil BAT */
@@ -554,16 +554,16 @@ BATprojectchain(BAT **bats)
            cnt > 0 &&
            ATOMstorage(b->ttype) == TYPE_str &&
            b->batRestricted == BAT_READ) {
-               stringtrick = 1;
+               stringtrick = true;
                tpe = b->twidth == 1 ? TYPE_bte : (b->twidth == 2 ? TYPE_sht : 
(b->twidth == 4 ? TYPE_int : TYPE_lng));
        }
 
-       bn = COLnew(hseq, ATOMtype(tpe), cnt, TRANSIENT);
+       bn = COLnew(hseq, tpe, cnt, TRANSIENT);
        if (bn == NULL || cnt == 0) {
                GDKfree(ba);
                return bn;
        }
-       bn->tnil = bn->tnonil = 0; /* we're not paying attention to this */
+       bn->tnil = bn->tnonil = false; /* we're not paying attention to this */
        n = i - 1;              /* ba[n] is last BAT */
 
 /* figure out the "other" type, i.e. not compatible with oid */
@@ -618,7 +618,7 @@ BATprojectchain(BAT **bats)
                                        o -= ba[i].hlo;
                                        if (o >= ba[i].cnt) {
                                                if (o == oid_nil - ba[i].hlo) {
-                                                       bn->tnil = 1;
+                                                       bn->tnil = true;
                                                        o = oid_nil;
                                                        break;
                                                }
@@ -642,7 +642,7 @@ BATprojectchain(BAT **bats)
                                o -= ba[i].hlo;
                                if (o >= ba[i].cnt) {
                                        if (o == oid_nil - ba[i].hlo) {
-                                               bn->tnil = 1;
+                                               bn->tnil = true;
                                                o = oid_nil;
                                                break;
                                        }
@@ -674,7 +674,7 @@ BATprojectchain(BAT **bats)
                                o -= ba[i].hlo;
                                if (o >= ba[i].cnt) {
                                        if (o == oid_nil - ba[i].hlo) {
-                                               bn->tnil = 1;
+                                               bn->tnil = true;
                                                v = nil;
                                                o = oid_nil;
                                                break;
@@ -705,7 +705,7 @@ BATprojectchain(BAT **bats)
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to