Changeset: cc8895b12974 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=cc8895b12974 Added Files: sql/test/BugTracker-2018/Tests/select_where_true.Bug-6654.sql sql/test/BugTracker-2018/Tests/select_where_true.Bug-6654.stable.err sql/test/BugTracker-2018/Tests/select_where_true.Bug-6654.stable.out Modified Files: gdk/gdk.h gdk/gdk_aggr.c gdk/gdk_bat.c gdk/gdk_batop.c gdk/gdk_firstn.c gdk/gdk_join.c gdk/gdk_logger.c gdk/gdk_tm.c gdk/gdk_utils.c geom/monetdb5/geom.c geom/monetdb5/geomBulk.c geom/monetdb5/geom_upgrade.c monetdb5/extras/rapi/converters.c.h monetdb5/mal/mal_authorize.c monetdb5/mal/mal_debugger.c monetdb5/modules/atoms/batxml.c monetdb5/modules/atoms/json.c monetdb5/modules/atoms/mtime.c monetdb5/modules/atoms/url.c monetdb5/modules/kernel/aggr.c monetdb5/modules/kernel/batstr.c monetdb5/modules/mal/calc.c monetdb5/modules/mal/pcre.c monetdb5/modules/mal/tablet.c monetdb5/modules/mal/tokenizer.c monetdb5/modules/mal/wlc.c sql/backends/monet5/UDF/capi/capi.c sql/backends/monet5/UDF/pyapi/conversion.c sql/backends/monet5/UDF/udf/udf.c sql/backends/monet5/sql.c sql/backends/monet5/sql_bat2time.c sql/backends/monet5/sql_cast.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_result.c sql/backends/monet5/sql_round_impl.h sql/backends/monet5/sql_upgrades.c sql/backends/monet5/vaults/bam/bam_db_interface.c sql/backends/monet5/vaults/bam/bam_export.c sql/backends/monet5/vaults/bam/bam_lib.c sql/server/rel_optimizer.c sql/storage/bat/bat_logger.c sql/storage/bat/bat_table.c sql/test/BugTracker-2018/Tests/All testing/Mtest.py.in Branch: analytics Log Message:
Merge with default. diffs (truncated from 2628 to 300 lines): diff --git a/gdk/gdk.h b/gdk/gdk.h --- a/gdk/gdk.h +++ b/gdk/gdk.h @@ -1229,6 +1229,15 @@ typedef var_t stridx_t; #define BUNtvar(bi,p) (assert((bi).b->ttype && (bi).b->tvarsized), Tbase((bi).b)+BUNtvaroff(bi,p)) #define BUNtail(bi,p) ((bi).b->ttype?(bi).b->tvarsized?BUNtvar(bi,p):BUNtloc(bi,p):BUNtpos(bi,p)) +/* return the oid value at BUN position p from the (v)oid bat b + * works with any TYPE_void or TYPE_oid bat */ +#define BUNtoid(b,p) (assert(ATOMtype((b)->ttype) == TYPE_oid), \ + (is_oid_nil((b)->tseqbase) \ + ? ((b)->ttype == TYPE_void \ + ? (void) (p), oid_nil \ + : ((const oid *) (b)->T.heap.base)[p]) \ + : (oid) ((b)->tseqbase + (BUN) (p)))) + static inline BATiter bat_iterator(BAT *b) { diff --git a/gdk/gdk_aggr.c b/gdk/gdk_aggr.c --- a/gdk/gdk_aggr.c +++ b/gdk/gdk_aggr.c @@ -3327,14 +3327,14 @@ concat_strings(void *res, int what, BAT* if (cand == NULL) { if(nonil) { BATloop(b,p,q) { - s = BUNtail(bi, p); + s = BUNtvar(bi, p); next_length = strlen(s); single_length += next_length + separator_length; single_oid = p; } } else { BATloop(b,p,q) { - s = BUNtail(bi, p); + s = BUNtvar(bi, p); if (*s != '\200') { next_length = strlen(s); single_length += next_length + separator_length; @@ -3353,7 +3353,7 @@ concat_strings(void *res, int what, BAT* goto finish; } BATloop(b,p,q){ - s = BUNtail(bi, p); + s = BUNtvar(bi, p); next_length = strlen(s); memcpy(single_str + offset, s, next_length); offset += next_length; @@ -3400,7 +3400,7 @@ concat_strings(void *res, int what, BAT* i = *cand++ - seqb; if (i >= end) break; - s = BUNtail(bi, i); + s = BUNtvar(bi, i); next_length = strlen(s); single_length += next_length + separator_length; single_oid = i; @@ -3410,7 +3410,7 @@ concat_strings(void *res, int what, BAT* i = *cand++ - seqb; if (i >= end) break; - s = BUNtail(bi, i); + s = BUNtvar(bi, i); if (*s != '\200') { next_length = strlen(s); single_length += next_length + separator_length; @@ -3433,7 +3433,7 @@ concat_strings(void *res, int what, BAT* i = *cand++ - seqb; if (i >= end) break; - s = BUNtail(bi, i); + s = BUNtvar(bi, i); next_length = strlen(s); memcpy(single_str + offset, s, next_length); offset += next_length; @@ -3472,7 +3472,7 @@ concat_strings(void *res, int what, BAT* if (gids == NULL || (gids[i] >= min && gids[i] <= max)) { gid = gids ? gids[i] - min : (oid) i; if (lastoid[gid] != BUN_NONE) { - s = BUNtail(bi, i); + s = BUNtvar(bi, i); if (*s != '\200') { next_length = strlen(s); lengths[gid] += next_length + separator_length; @@ -3498,7 +3498,7 @@ concat_strings(void *res, int what, BAT* if (gids == NULL || (gids[i] >= min && gids[i] <= max)) { gid = gids ? gids[i] - min : (oid) i; if (lastoid[gid] < BUN_NONE) { - s = BUNtail(bi, i); + s = BUNtvar(bi, i); next_length = strlen(s); memcpy(astrings[gid] + lengths[gid], s, next_length); lengths[gid] += next_length; @@ -3532,7 +3532,7 @@ concat_strings(void *res, int what, BAT* if (gids == NULL || (gids[i] >= min && gids[i] <= max)) { gid = gids ? gids[i] - min : (oid) i; if (lastoid[gid] != BUN_NONE) { - s = BUNtail(bi, i); + s = BUNtvar(bi, i); if (*s != '\200') { next_length = strlen(s); lengths[gid] += next_length; @@ -3562,7 +3562,7 @@ concat_strings(void *res, int what, BAT* if (gids == NULL || (gids[i] >= min && gids[i] <= max)) { gid = gids ? gids[i] - min : (oid) i; if (lastoid[gid] < BUN_NONE) { - s = BUNtail(bi, i); + s = BUNtvar(bi, i); next_length = strlen(s); memcpy(astrings[gid] + lengths[gid], s, next_length); lengths[gid] += next_length; diff --git a/gdk/gdk_bat.c b/gdk/gdk_bat.c --- a/gdk/gdk_bat.c +++ b/gdk/gdk_bat.c @@ -1339,11 +1339,10 @@ gdk_return void_replace_bat(BAT *b, BAT *p, BAT *u, bool force) { BUN r, s; - BATiter uii = bat_iterator(p); BATiter uvi = bat_iterator(u); BATloop(u, r, s) { - oid updid = *(oid *) BUNtail(uii, r); + oid updid = BUNtoid(p, r); const void *val = BUNtail(uvi, r); if (void_inplace(b, updid, val, force) != GDK_SUCCEED) diff --git a/gdk/gdk_batop.c b/gdk/gdk_batop.c --- a/gdk/gdk_batop.c +++ b/gdk/gdk_batop.c @@ -705,7 +705,7 @@ BATappend(BAT *b, BAT *n, BAT *s, bool f if (b->ttype != TYPE_void && b->tsorted && BATtdense(b) && (BATtdense(n) == 0 || cand != NULL || - 1 + *(oid *) BUNtloc(bi, last) != *(oid *) BUNtail(ni, start))) { + 1 + *(oid *) BUNtloc(bi, last) != BUNtoid(n, start))) { b->tseqbase = oid_nil; } b->tnonil &= n->tnonil; @@ -2050,7 +2050,6 @@ BATmergecand(BAT *a, BAT *b) const oid *restrict ap, *restrict bp, *ape, *bpe; oid *restrict p, i; oid af, al, bf, bl; - BATiter ai, bi; bit ad, bd; BATcheck(a, "BATmergecand", NULL); @@ -2072,12 +2071,10 @@ BATmergecand(BAT *a, BAT *b) return COLcopy(a, a->ttype, false, TRANSIENT); } /* we can return a if a fully covers b (and v.v) */ - ai = bat_iterator(a); - bi = bat_iterator(b); - af = *(oid*) BUNtail(ai, 0); - bf = *(oid*) BUNtail(bi, 0); - al = *(oid*) BUNtail(ai, BUNlast(a) - 1); - bl = *(oid*) BUNtail(bi, BUNlast(b) - 1); + af = BUNtoid(a, 0); + bf = BUNtoid(b, 0); + al = BUNtoid(a, BUNlast(a) - 1); + bl = BUNtoid(b, BUNlast(b) - 1); ad = (af + BATcount(a) - 1 == al); /* i.e., dense */ bd = (bf + BATcount(b) - 1 == bl); /* i.e., dense */ if (ad && bd) { @@ -2181,7 +2178,6 @@ BATintersectcand(BAT *a, BAT *b) const oid *restrict ap, *restrict bp, *ape, *bpe; oid *restrict p; oid af, al, bf, bl; - BATiter ai, bi; BATcheck(a, "BATintersectcand", NULL); BATcheck(b, "BATintersectcand", NULL); @@ -2198,12 +2194,10 @@ BATintersectcand(BAT *a, BAT *b) return newdensecand(0, 0); } - ai = bat_iterator(a); - bi = bat_iterator(b); - af = *(oid*) BUNtail(ai, 0); - bf = *(oid*) BUNtail(bi, 0); - al = *(oid*) BUNtail(ai, BUNlast(a) - 1); - bl = *(oid*) BUNtail(bi, BUNlast(b) - 1); + af = BUNtoid(a, 0); + bf = BUNtoid(b, 0); + al = BUNtoid(a, BUNlast(a) - 1); + bl = BUNtoid(b, BUNlast(b) - 1); if ((af + BATcount(a) - 1 == al) && (bf + BATcount(b) - 1 == bl)) { /* both lists are VOID */ diff --git a/gdk/gdk_firstn.c b/gdk/gdk_firstn.c --- a/gdk/gdk_firstn.c +++ b/gdk/gdk_firstn.c @@ -57,9 +57,9 @@ * in-place. We start off with a heap containing the first N elements * of the input, and then go over the rest of the input, replacing the * root of the heap with a new value if appropriate (if the new value - * is among the first-N seen so far). The siftup macro then restores - * the heap property. */ -#define siftup(OPER, START, SWAP) \ + * is among the first-N seen so far). The siftdown macro then + * restores the heap property. */ +#define siftdown(OPER, START, SWAP) \ do { \ pos = (START); \ childpos = (pos << 1) + 1; \ @@ -84,7 +84,7 @@ #define heapify(OPER, SWAP) \ do { \ for (i = n / 2; i > 0; i--) \ - siftup(OPER, i - 1, SWAP); \ + siftdown(OPER, i - 1, SWAP); \ } while (0) #define LTany(p1, p2) (cmp(BUNtail(bi, oids[p1] - b->hseqbase), \ @@ -123,7 +123,7 @@ if (OP(vals[i - b->hseqbase], \ vals[oids[0] - b->hseqbase])) { \ oids[0] = i; \ - siftup(OP##fix, 0, SWAP1); \ + siftdown(OP##fix, 0, SWAP1); \ } \ } \ } while (0) @@ -148,7 +148,7 @@ BATfirstn_unique(BAT *b, BAT *s, BUN n, const oid *restrict cand, *candend; int tpe = b->ttype; int (*cmp)(const void *, const void *); - /* variables used in heapify/siftup macros */ + /* variables used in heapify/siftdown macros */ oid item; BUN pos, childpos; @@ -274,7 +274,7 @@ BATfirstn_unique(BAT *b, BAT *s, BUN n, if (cmp(BUNtail(bi, i - b->hseqbase), BUNtail(bi, oids[0] - b->hseqbase)) < 0) { oids[0] = i; - siftup(LTany, 0, SWAP1); + siftdown(LTany, 0, SWAP1); } } break; @@ -311,7 +311,7 @@ BATfirstn_unique(BAT *b, BAT *s, BUN n, if (cmp(BUNtail(bi, i - b->hseqbase), BUNtail(bi, oids[0] - b->hseqbase)) > 0) { oids[0] = i; - siftup(GTany, 0, SWAP1); + siftdown(GTany, 0, SWAP1); } } break; @@ -390,7 +390,7 @@ BATfirstn_unique(BAT *b, BAT *s, BUN n, vals[oids[0] - b->hseqbase]))) { \ oids[0] = i; \ goids[0] = gv[ci]; \ - siftup(OP##fixgrp, 0, SWAP2); \ + siftdown(OP##fixgrp, 0, SWAP2); \ } \ ci++; \ } \ @@ -418,7 +418,7 @@ BATfirstn_unique_with_groups(BAT *b, BAT const oid *restrict cand, *candend; int tpe = b->ttype; int (*cmp)(const void *, const void *); - /* variables used in heapify/siftup macros */ + /* variables used in heapify/siftdown macros */ oid item; BUN pos, childpos; @@ -502,7 +502,7 @@ BATfirstn_unique_with_groups(BAT *b, BAT && i < oids[0]) -- always false */) { oids[0] = i; goids[0] = gv[ci]; - siftup(LTvoidgrp, 0, SWAP2); + siftdown(LTvoidgrp, 0, SWAP2); } ci++; } @@ -515,7 +515,7 @@ BATfirstn_unique_with_groups(BAT *b, BAT /* && i > oids[0] -- always true */)) { oids[0] = i; goids[0] = gv[ci]; - siftup(GTvoidgrp, 0, SWAP2); + siftdown(GTvoidgrp, 0, SWAP2); } ci++; } @@ -555,7 +555,7 @@ BATfirstn_unique_with_groups(BAT *b, BAT BUNtail(bi, oids[0] - b->hseqbase)) < 0)) { oids[0] = i; goids[0] = gv[ci]; - siftup(LTanygrp, 0, SWAP2); + siftdown(LTanygrp, 0, SWAP2); } ci++; } @@ -596,7 +596,7 @@ BATfirstn_unique_with_groups(BAT *b, BAT BUNtail(bi, oids[0] - b->hseqbase)) > 0)) { oids[0] = i; goids[0] = gv[ci]; - siftup(GTanygrp, 0, SWAP2); _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list