Changeset: fc6928d9cc0c for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=fc6928d9cc0c Modified Files: gdk/ChangeLog gdk/gdk.h gdk/gdk_align.c gdk/gdk_bat.c gdk/gdk_batop.c gdk/gdk_bbp.c gdk/gdk_calc.c gdk/gdk_cross.c gdk/gdk_firstn.c gdk/gdk_group.c gdk/gdk_join.c gdk/gdk_orderidx.c gdk/gdk_project.c gdk/gdk_sample.c gdk/gdk_select.c monetdb5/extras/rapi/converters.c.h monetdb5/modules/kernel/algebra.c monetdb5/modules/kernel/bat5.c monetdb5/modules/kernel/microbenchmark.c monetdb5/modules/mal/pcre.c monetdb5/modules/mal/remote.c monetdb5/modules/mal/tablet.c sql/backends/monet5/UDF/capi/capi.c sql/backends/monet5/sql_fround_impl.h sql/backends/monet5/sql_round_impl.h Branch: default Log Message:
Removed the tdense property. Note, there is no change to the BBP.dir format. diffs (truncated from 1858 to 300 lines): diff --git a/gdk/ChangeLog b/gdk/ChangeLog --- a/gdk/ChangeLog +++ b/gdk/ChangeLog @@ -1,3 +1,7 @@ # ChangeLog file for MonetDB # This file is updated with Maddlog +* Tue Mar 20 2018 Sjoerd Mullender <sjo...@acm.org> +- Removed the tdense property: it's function is completely replaced by + whether or not tseqbase is equal to oid_nil. + diff --git a/gdk/gdk.h b/gdk/gdk.h --- a/gdk/gdk.h +++ b/gdk/gdk.h @@ -773,7 +773,6 @@ typedef struct { bool varsized:1, /* varsized (1) or fixedsized (0) */ key:1, /* no duplicate values present */ unique:1, /* no duplicate values allowed */ - dense:1, /* OID only: only consecutive values */ nonil:1, /* there are no nils in the column */ nil:1, /* there is a nil in the column */ sorted:1, /* column is sorted in ascending order */ @@ -841,7 +840,6 @@ typedef struct BATiter { #define tseqbase T.seq #define tsorted T.sorted #define trevsorted T.revsorted -#define tdense T.dense #define tident T.id #define torderidx T.orderidx #define twidth T.width @@ -1469,9 +1467,11 @@ gdk_export void GDKqsort_rev(void *restr #define BATtordered(b) ((b)->ttype == TYPE_void || (b)->tsorted) #define BATtrevordered(b) (((b)->ttype == TYPE_void && is_oid_nil((b)->tseqbase)) || (b)->trevsorted) -#define BATtdense(b) (BATtvoid(b) && !is_oid_nil((b)->tseqbase)) -#define BATtvoid(b) (((b)->tdense && (b)->tsorted) || (b)->ttype==TYPE_void) -#define BATtkey(b) (b->tkey != FALSE || BATtdense(b)) +/* BAT is dense (i.e., BATtvoid() is true and tseqbase is not NIL) */ +#define BATtdense(b) (!is_oid_nil((b)->tseqbase)) +/* BATtvoid: BAT can be (or actually is) represented by TYPE_void */ +#define BATtvoid(b) (BATtdense(b) || (b)->ttype==TYPE_void) +#define BATtkey(b) ((b)->tkey || BATtdense(b)) /* set some properties that are trivial to deduce */ #define BATsettrivprop(b) \ @@ -1482,13 +1482,11 @@ gdk_export void GDKqsort_rev(void *restr ATOMtype((b)->ttype) == TYPE_oid); \ if ((b)->ttype == TYPE_void) { \ if (is_oid_nil((b)->tseqbase)) { \ - (b)->tdense = false; \ (b)->tnonil = (b)->batCount == 0; \ (b)->tnil = !(b)->tnonil; \ (b)->trevsorted = 1; \ (b)->tkey = (b)->batCount <= 1; \ } else { \ - (b)->tdense = 1; \ (b)->tnonil = 1; \ (b)->tnil = 0; \ (b)->tkey = 1; \ @@ -1505,25 +1503,20 @@ gdk_export void GDKqsort_rev(void *restr (b)->tnonil = 1; \ (b)->tnil = 0; \ if ((b)->ttype == TYPE_oid) { \ - (b)->tdense = 1; \ (b)->tseqbase = 0; \ } \ } else if ((b)->ttype == TYPE_oid) { \ /* b->batCount == 1 */ \ oid sqbs = ((const oid *) (b)->theap.base)[0]; \ if (is_oid_nil(sqbs)) { \ - (b)->tdense = 0; \ (b)->tnonil = 0; \ (b)->tnil = 1; \ } else { \ - (b)->tdense = 1; \ (b)->tnonil = 1; \ (b)->tnil = 0; \ } \ (b)->tseqbase = sqbs; \ } \ - } else if ((b)->ttype == TYPE_oid) { \ - (b)->tdense = !is_oid_nil((b)->tseqbase); \ } \ if (!ATOMlinear((b)->ttype)) { \ (b)->tsorted = 0; \ diff --git a/gdk/gdk_align.c b/gdk/gdk_align.c --- a/gdk/gdk_align.c +++ b/gdk/gdk_align.c @@ -197,11 +197,9 @@ BATmaterialize(BAT *b) t = b->tseqbase; x = (oid *) b->theap.base; if (is_oid_nil(t)) { - assert(!b->tdense); while (p < q) x[p++] = oid_nil; } else { - assert(b->tdense); while (p < q) x[p++] = t++; } diff --git a/gdk/gdk_bat.c b/gdk/gdk_bat.c --- a/gdk/gdk_bat.c +++ b/gdk/gdk_bat.c @@ -376,7 +376,6 @@ BATattach(int tt, const char *heapfile, BATsetcount(bn, cap); bn->tnonil = cap == 0; bn->tnil = 0; - bn->tdense = 0; bn->tseqbase = oid_nil; if (cap > 1) { bn->tsorted = 0; @@ -822,7 +821,6 @@ COLcopy(BAT *b, int tt, int writable, in BUN h = BUNlast(b); bn->tsorted = b->tsorted; bn->trevsorted = b->trevsorted; - bn->tdense = false; if (b->tkey) BATkey(bn, true); bn->tnonil = b->tnonil; @@ -845,7 +843,7 @@ COLcopy(BAT *b, int tt, int writable, in } } else { bn->tsorted = bn->trevsorted = 0; /* set based on count later */ - bn->tdense = bn->tnonil = bn->tnil = false; + bn->tnonil = bn->tnil = false; bn->tnosorted = bn->tnorevsorted = 0; bn->tnokey[0] = bn->tnokey[1] = 0; } @@ -926,14 +924,12 @@ setcolprops(BAT *b, const void *x) if (x) { b->tseqbase = * (const oid *) x; } - b->tdense = !is_oid_nil(b->tseqbase); b->tnil = is_oid_nil(b->tseqbase); b->tnonil = !b->tnil; } else { b->tnil = isnil; b->tnonil = !isnil; if (b->ttype == TYPE_oid) { - b->tdense = !isnil; b->tseqbase = * (const oid *) x; } } @@ -986,9 +982,8 @@ setcolprops(BAT *b, const void *x) b->trevsorted = 0; b->tnorevsorted = pos; } - if (b->tdense && (cmp >= 0 || * (const oid *) prv + 1 != * (const oid *) x)) { + if (BATtdense(b) && (cmp >= 0 || * (const oid *) prv + 1 != * (const oid *) x)) { assert(b->ttype == TYPE_oid); - b->tdense = 0; b->tseqbase = oid_nil; } if (isnil) { @@ -1028,7 +1023,7 @@ BUNappend(BAT *b, const void *t, bit for if (b->thash && b->tvheap) tsize = b->tvheap->size; - if (b->ttype == TYPE_void && !is_oid_nil(b->tseqbase)) { + if (b->ttype == TYPE_void && BATtdense(b)) { if (b->batCount == 0) { b->tseqbase = * (const oid *) t; } else if (is_oid_nil(* (oid *) t) || @@ -1090,7 +1085,7 @@ BUNdelete(BAT *b, oid o) ATOMunfix(b->ttype, BUNtail(bi, p)); ATOMdel(b->ttype, b->tvheap, (var_t *) BUNtloc(bi, p)); if (p != BUNlast(b) - 1 && - (b->ttype != TYPE_void || !is_oid_nil(b->tseqbase))) { + (b->ttype != TYPE_void || BATtdense(b))) { /* replace to-be-delete BUN with last BUN; materialize * void column before doing so */ if (b->ttype == TYPE_void && @@ -1181,19 +1176,16 @@ BUNinplace(BAT *b, BUN p, const void *t, ATOMcmp(tt, t, BUNtail(bi, nxt)) > 0) { b->tsorted = FALSE; b->tnosorted = nxt; - } else if (b->ttype != TYPE_void && b->tdense) { + } else if (b->ttype != TYPE_void && BATtdense(b)) { if (prv != BUN_NONE && 1 + * (oid *) BUNtloc(bi, prv) != * (oid *) t) { - b->tdense = FALSE; b->tseqbase = oid_nil; } else if (nxt != BUN_NONE && * (oid *) BUNtloc(bi, nxt) != 1 + * (oid *) t) { - b->tdense = FALSE; b->tseqbase = oid_nil; } else if (prv == BUN_NONE && nxt == BUN_NONE) { b->tseqbase = * (oid *) t; - b->tdense = !is_oid_nil(b->tseqbase); } } } else if (b->tnosorted >= p) @@ -1434,7 +1426,7 @@ BATkey(BAT *b, bool flag) assert(b->batCacheid > 0); assert(!b->tunique || flag); if (b->ttype == TYPE_void) { - if (!is_oid_nil(b->tseqbase) && !flag) { + if (BATtdense(b) && !flag) { GDKerror("BATkey: dense column must be unique.\n"); return GDK_FAIL; } @@ -1447,7 +1439,6 @@ BATkey(BAT *b, bool flag) b->batDirtydesc = TRUE; b->tkey = flag; if (!flag) { - b->tdense = 0; b->tseqbase = oid_nil; } else b->tnokey[0] = b->tnokey[1] = 0; @@ -1492,7 +1483,6 @@ BATtseqbase(BAT *b, oid o) } if (ATOMtype(b->ttype) == TYPE_oid) { b->tseqbase = o; - b->tdense = !is_oid_nil(o); /* adapt keyness */ if (BATtvoid(b)) { @@ -1524,7 +1514,6 @@ BATtseqbase(BAT *b, oid o) } else { assert(o == oid_nil); b->tseqbase = oid_nil; - b->tdense = false; } } @@ -1953,9 +1942,12 @@ BATmode(BAT *b, int mode) * * The properties currently maintained are: * - * dense Only valid for TYPE_oid columns: each value in the - * column is exactly one more than the previous value. - * This implies sorted, key, nonil. + * seqbase Only valid for TYPE_oid and TYPE_void columns: each + * value in the column is exactly one more than the + * previous value, starting at position 0 with the value + * stored in this property. + * This implies sorted, key, nonil (which therefore need + * to be set). * nil There is at least one NIL value in the column. * nonil There are no NIL values in the column. * key All values in the column are distinct. @@ -2046,19 +2038,17 @@ BATassertProps(BAT *b) assert(b->twidth == ATOMsize(b->ttype)); assert(b->tseqbase <= oid_nil); /* only oid/void columns can be dense */ - assert(!b->tdense || b->ttype == TYPE_oid || b->ttype == TYPE_void); - if (b->ttype == TYPE_oid && b->tdense) { + assert(is_oid_nil(b->tseqbase) || b->ttype == TYPE_oid || b->ttype == TYPE_void); + if (!is_oid_nil(b->tseqbase)) { + /* dense implies sorted and key */ assert(b->tsorted); - assert(!is_oid_nil(b->tseqbase)); - if (b->batCount > 0) { - assert(!is_oid_nil(b->tseqbase)); + assert(b->tkey); + assert(b->tnonil); + if (b->ttype == TYPE_oid && b->batCount > 0) { + /* tseqbase must correspond to actual value */ assert(* (oid *) BUNtail(bi, 0) == b->tseqbase); } } - /* dense checks */ - assert(!b->tdense || ATOMtype(b->ttype) == TYPE_oid); - assert(b->tdense == !is_oid_nil(b->tseqbase)); - assert(!b->tdense || b->tsorted); /* a column cannot both have and not have NILs */ assert(!b->tnil || !b->tnonil); if (b->ttype == TYPE_void) { @@ -2068,12 +2058,10 @@ BATassertProps(BAT *b) if (is_oid_nil(b->tseqbase)) { assert(BATcount(b) == 0 || !b->tnonil); assert(BATcount(b) <= 1 || !b->tkey); - /* assert(!b->tdense); */ assert(b->trevsorted); } else { assert(BATcount(b) == 0 || !b->tnil); assert(BATcount(b) <= 1 || !b->trevsorted); - /* assert(b->tdense); */ assert(b->tkey); } return; @@ -2139,7 +2127,7 @@ BATassertProps(BAT *b) assert(!b->tsorted || cmp <= 0); assert(!b->trevsorted || cmp >= 0); assert(!b->tkey || cmp != 0); - assert(!b->tdense || * (oid *) prev + 1 == * (oid *) valp); + assert(is_oid_nil(b->tseqbase) || * (oid *) prev + 1 == * (oid *) valp); } if (cmpnil) { cmp = cmpf(valp, nilp); diff --git a/gdk/gdk_batop.c b/gdk/gdk_batop.c --- a/gdk/gdk_batop.c +++ b/gdk/gdk_batop.c @@ -598,7 +598,7 @@ BATappend(BAT *b, BAT *n, BAT *s, bit fo HASHdestroy(b); /* we're not maintaining the hash here */ if (BATtdense(n) && cand == NULL && (BATcount(b) == 0 || - (!is_oid_nil(b->tseqbase) && + (BATtdense(b) && _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list