Changeset: 2704de9856ab for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=2704de9856ab Added Files: sql/test/BugTracker-2018/Tests/multiple-insertinto-table-Bug-6578.stable.err sql/test/BugTracker-2018/Tests/multiple-insertinto-table-Bug-6578.stable.out sql/test/BugTracker-2018/Tests/sqlitelogictest-not-between-wrong.Bug-6569.stable.err sql/test/BugTracker-2018/Tests/sqlitelogictest-not-between-wrong.Bug-6569.stable.out Modified Files: gdk/gdk_batop.c gdk/gdk_select.c monetdb5/modules/kernel/Tests/select.malC monetdb5/modules/kernel/Tests/select.stable.out Branch: default Log Message:
Merge with Mar2018 branch. diffs (truncated from 1736 to 300 lines): diff --git a/gdk/gdk_batop.c b/gdk/gdk_batop.c --- a/gdk/gdk_batop.c +++ b/gdk/gdk_batop.c @@ -531,9 +531,6 @@ BATappend(BAT *b, BAT *n, BAT *s, bit fo } } - if (BATcount(b) == 0) - BAThseqbase(b, s ? s->hseqbase : n->hseqbase); - if (b->tunique) { /* if b has the unique bit set, only insert values * from n that don't already occur in b, and make sure diff --git a/gdk/gdk_select.c b/gdk/gdk_select.c --- a/gdk/gdk_select.c +++ b/gdk/gdk_select.c @@ -28,7 +28,7 @@ A = (oid *) Tloc((B), 0); \ } \ A[(I)] = (V); \ - } while (0) + } while (false) BAT * virtualize(BAT *bn) @@ -38,13 +38,13 @@ virtualize(BAT *bn) (((bn->ttype == TYPE_void && !is_oid_nil(bn->tseqbase)) || bn->ttype == TYPE_oid) && bn->tkey && bn->tsorted)); - /* since bn has unique and strictly ascending tail values, we - * can easily check whether the tail is dense */ + /* since bn has unique and strictly ascending values, we can + * easily check whether the column is dense */ if (bn && bn->ttype == TYPE_oid && (BATcount(bn) <= 1 || * (const oid *) Tloc(bn, 0) + BATcount(bn) - 1 == * (const oid *) Tloc(bn, BUNlast(bn) - 1))) { - /* tail is dense, replace by virtual oid */ + /* column is dense, replace by virtual oid */ ALGODEBUG fprintf(stderr, "#virtualize(bn=%s#"BUNFMT",seq="OIDFMT")\n", BATgetId(bn), BATcount(bn), BATcount(bn) > 0 ? * (const oid *) Tloc(bn, 0) : 0); @@ -56,7 +56,7 @@ virtualize(BAT *bn) bn->theap.storage = bn->theap.newstorage = STORE_MEM; bn->theap.size = 0; bn->ttype = TYPE_void; - bn->tvarsized = 1; + bn->tvarsized = true; bn->twidth = 0; bn->tshift = 0; } @@ -85,11 +85,11 @@ doublerange(oid l1, oid h1, oid l2, oid *p++ = l1++; while (l2 < h2) *p++ = l2++; - bn->tkey = 1; - bn->tsorted = 1; + bn->tkey = true; + bn->tsorted = true; bn->trevsorted = BATcount(bn) <= 1; - bn->tnil = 0; - bn->tnonil = 1; + bn->tnil = false; + bn->tnonil = true; return bn; } @@ -119,11 +119,11 @@ doubleslice(BAT *b, BUN l1, BUN h1, BUN o = (const oid *) Tloc(b, l2); while (l2++ < h2) *p++ = *o++; - bn->tkey = 1; - bn->tsorted = 1; + bn->tkey = true; + bn->tsorted = true; bn->trevsorted = BATcount(bn) <= 1; - bn->tnil = 0; - bn->tnonil = 1; + bn->tnil = false; + bn->tnonil = true; return virtualize(bn); } @@ -221,7 +221,7 @@ BAT_hashselect(BAT *b, BAT *s, BAT *bn, } } BATsetcount(bn, cnt); - bn->tkey = 1; + bn->tkey = true; if (cnt > 1) { /* hash chains produce results in the order high to * low, so we just need to reverse */ @@ -231,7 +231,7 @@ BAT_hashselect(BAT *b, BAT *s, BAT *bn, dst[h] = o; } } - bn->tsorted = 1; + bn->tsorted = true; bn->trevsorted = bn->batCount <= 1; bn->tseqbase = bn->batCount == 0 ? 0 : bn->batCount == 1 ? *dst : oid_nil; return bn; @@ -240,37 +240,37 @@ BAT_hashselect(BAT *b, BAT *s, BAT *bn, /* Imprints select code */ /* inner check */ -#define impscheck(CAND,TEST,ADD) \ -do { \ - e = (BUN) (i+limit-pr_off+off); \ - if (im[icnt] & mask) { \ - if ((im[icnt] & ~innermask) == 0) { \ - while (p < q && o < e) { \ - v = src[o-off]; \ - ADD; \ - cnt++; \ - p++; \ - if (p < q) \ - CAND; \ - } \ - } else { \ - while (p < q && o < e) { \ - v = src[o-off]; \ - ADD; \ - cnt += (TEST); \ - p++; \ - if (p < q) \ - CAND; \ - } \ - } \ - } else { \ - while (p < q && o < e) { \ - p++; \ - if (p < q) \ - CAND; \ - } \ - } \ -} while (0) +#define impscheck(CAND,TEST,ADD) \ + do { \ + e = (BUN) (i+limit-pr_off+off); \ + if (im[icnt] & mask) { \ + if ((im[icnt] & ~innermask) == 0) { \ + while (p < q && o < e) { \ + v = src[o-off]; \ + ADD; \ + cnt++; \ + p++; \ + if (p < q) \ + CAND; \ + } \ + } else { \ + while (p < q && o < e) { \ + v = src[o-off]; \ + ADD; \ + cnt += (TEST); \ + p++; \ + if (p < q) \ + CAND; \ + } \ + } \ + } else { \ + while (p < q && o < e) { \ + p++; \ + if (p < q) \ + CAND; \ + } \ + } \ + } while (false) /* main loop for imprints */ /* @@ -279,162 +279,163 @@ do { \ * i is the iterator for the values in imprints */ #define impsloop(CAND,TEST,ADD) \ -do { \ - BUN dcnt, icnt, limit, i, l, e; \ - cchdc_t *restrict d = (cchdc_t *) imprints->dict; \ - bte rpp = ATOMelmshift(IMPS_PAGE >> b->tshift); \ - CAND; \ - for (i = 0, dcnt = 0, icnt = 0; \ - dcnt < imprints->dictcnt && i + off < w + pr_off && p < q; \ - dcnt++) { \ - limit = ((BUN) d[dcnt].cnt) << rpp; \ - while (i + limit + off <= o + pr_off) { \ - i += limit; \ - icnt += d[dcnt].repeat ? 1 : d[dcnt].cnt; \ - dcnt++; \ + do { \ + BUN dcnt, icnt, limit, i, l, e; \ + cchdc_t *restrict d = (cchdc_t *) imprints->dict; \ + bte rpp = ATOMelmshift(IMPS_PAGE >> b->tshift); \ + CAND; \ + for (i = 0, dcnt = 0, icnt = 0; \ + dcnt < imprints->dictcnt && i + off < w + pr_off && p < q; \ + dcnt++) { \ limit = ((BUN) d[dcnt].cnt) << rpp; \ - } \ - if (!d[dcnt].repeat) { \ - limit = (BUN) 1 << rpp; \ - l = icnt + d[dcnt].cnt; \ while (i + limit + off <= o + pr_off) { \ - icnt++; \ i += limit; \ + icnt += d[dcnt].repeat ? 1 : d[dcnt].cnt; \ + dcnt++; \ + limit = ((BUN) d[dcnt].cnt) << rpp; \ } \ - for (; \ - icnt < l && i + off < w + pr_off; \ - icnt++) { \ + if (!d[dcnt].repeat) { \ + limit = (BUN) 1 << rpp; \ + l = icnt + d[dcnt].cnt; \ + while (i + limit + off <= o + pr_off) { \ + icnt++; \ + i += limit; \ + } \ + for (; \ + icnt < l && i + off < w + pr_off; \ + icnt++) { \ + impscheck(CAND,TEST,ADD); \ + i += limit; \ + } \ + } \ + else { \ impscheck(CAND,TEST,ADD); \ i += limit; \ + icnt++; \ } \ } \ - else { \ - impscheck(CAND,TEST,ADD); \ - i += limit; \ - icnt++; \ - } \ - } \ -} while (0) + } while (false) #define quickins(dst, cnt, o, bn) \ do { \ assert((cnt) < BATcapacity(bn)); \ dst[cnt] = (o); \ - } while (0) + } while (false) /* construct the mask */ #define impsmask(CAND,TEST,B) \ -do { \ - uint##B##_t *restrict im = (uint##B##_t *) imprints->imps; \ - uint##B##_t mask = 0, innermask; \ - int lbin, hbin; \ - int tpe = ATOMbasetype(b->ttype); \ - lbin = IMPSgetbin(tpe, imprints->bits, imprints->bins, tl); \ - hbin = IMPSgetbin(tpe, imprints->bits, imprints->bins, th); \ - /* note: (1<<n)-1 gives a sequence of n one bits */ \ - /* to set bits hbin..lbin inclusive, we would do: */ \ - /* mask = ((1 << (hbin + 1)) - 1) - ((1 << lbin) - 1); */ \ - /* except ((1 << (hbin + 1)) - 1) is not defined if */ \ - /* hbin == sizeof(uint##B##_t)*8 - 1 */ \ - /* the following does work, however */ \ - mask = (((((uint##B##_t) 1 << hbin) - 1) << 1) | 1) - (((uint##B##_t) 1 << lbin) - 1); \ - innermask = mask; \ - if (!b->tnonil || vl != minval) \ - innermask = IMPSunsetBit(B, innermask, lbin); \ - if (vh != maxval) \ - innermask = IMPSunsetBit(B, innermask, hbin); \ - if (anti) { \ - uint##B##_t tmp = mask; \ - mask = ~innermask; \ - innermask = ~tmp; \ - } \ + do { \ + uint##B##_t *restrict im = (uint##B##_t *) imprints->imps; \ + uint##B##_t mask = 0, innermask; \ + int lbin, hbin; \ + int tpe = ATOMbasetype(b->ttype); \ + lbin = IMPSgetbin(tpe, imprints->bits, imprints->bins, tl); \ + hbin = IMPSgetbin(tpe, imprints->bits, imprints->bins, th); \ + /* note: (1<<n)-1 gives a sequence of n one bits */ \ + /* to set bits hbin..lbin inclusive, we would do: */ \ + /* mask = ((1 << (hbin + 1)) - 1) - ((1 << lbin) - 1); */ \ + /* except ((1 << (hbin + 1)) - 1) is not defined if */ \ + /* hbin == sizeof(uint##B##_t)*8 - 1 */ \ + /* the following does work, however */ \ + mask = (((((uint##B##_t) 1 << hbin) - 1) << 1) | 1) - (((uint##B##_t) 1 << lbin) - 1); \ + innermask = mask; \ + if (!b->tnonil || vl != minval) \ + innermask = IMPSunsetBit(B, innermask, lbin); \ + if (vh != maxval) \ + innermask = IMPSunsetBit(B, innermask, hbin); \ + if (anti) { \ + uint##B##_t tmp = mask; \ + mask = ~innermask; \ + innermask = ~tmp; \ + } \ \ - if (BATcapacity(bn) < maximum) { \ - impsloop(CAND, TEST, \ - buninsfix(bn, dst, cnt, o, \ _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list