Changeset: 3a7bba6acd72 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=3a7bba6acd72 Modified Files: clients/Tests/exports.stable.out gdk/ChangeLog gdk/gdk.h gdk/gdk_bat.c gdk/gdk_group.c monetdb5/modules/kernel/bat5.c Branch: default Log Message:
Removed BATderivedTailProps and BATassertTailProps. Use version without Tail in the name. diffs (220 lines): diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out --- a/clients/Tests/exports.stable.out +++ b/clients/Tests/exports.stable.out @@ -109,7 +109,6 @@ BUN BATcount_no_nil(BAT *b); gdk_return BATdel(BAT *b, BAT *d); BAT *BATdense(oid hseq, oid tseq, BUN cnt) __attribute__((warn_unused_result)); void BATderiveProps(BAT *b, int expensive); -void BATderiveTailProps(BAT *b, int expensive); BAT *BATdiff(BAT *l, BAT *r, BAT *sl, BAT *sr, int nil_matches, BUN estimate); gdk_return BATextend(BAT *b, BUN newcap); void BATfakeCommit(BAT *b); diff --git a/gdk/ChangeLog b/gdk/ChangeLog --- a/gdk/ChangeLog +++ b/gdk/ChangeLog @@ -1,6 +1,9 @@ # ChangeLog file for MonetDB # This file is updated with Maddlog +* Wed Jul 6 2016 Sjoerd Mullender <sjo...@acm.org> +- Removed BATderiveTailProps. Use BATderiveProps instead. + * Fri Jul 1 2016 Sjoerd Mullender <sjo...@acm.org> - Removed the macro BUNfirst. It can be replaced by 0. diff --git a/gdk/gdk.h b/gdk/gdk.h --- a/gdk/gdk.h +++ b/gdk/gdk.h @@ -2687,7 +2687,6 @@ gdk_export int ALIGNsynced(BAT *b1, BAT gdk_export void BATassertProps(BAT *b); gdk_export void BATderiveProps(BAT *b, int expensive); -gdk_export void BATderiveTailProps(BAT *b, int expensive); #define BATPROPS_QUICK 0 /* only derive easy (non-resource consuming) properties */ #define BATPROPS_ALL 1 /* derive all possible properties; no matter what cost (key=hash) */ diff --git a/gdk/gdk_bat.c b/gdk/gdk_bat.c --- a/gdk/gdk_bat.c +++ b/gdk/gdk_bat.c @@ -1901,9 +1901,42 @@ BATmode(BAT *b, int mode) #define assert(test) ((void) ((test) || fprintf(stderr, "!WARNING: %s:%d: assertion `%s' failed\n", __FILE__, __LINE__, #test))) #endif -static void -BATassertTailProps(BAT *b) +/* Assert that properties are set correctly. + * + * A BAT can have a bunch of properties set. Mostly, the property + * bits are set if we *know* the property holds, and not set if we + * don't know whether the property holds (or if we know it doesn't + * hold). All properties are per column. + * + * 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. + * 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. + * sorted The column is sorted (ascending). If also revsorted, + * then all values are equal. + * revsorted The column is reversely sorted (descending). If + * also sorted, then all values are equal. + * + * The "key" property consists of two bits. The lower bit, when set, + * indicates that all values in the column are distinct. The upper + * bit, when set, indicates that all values must be distinct + * (BOUND2BTRUE). + * + * Note that the functions BATtseqbase and BATkey also set more + * properties than you might suspect. When setting properties on a + * newly created and filled BAT, you may want to first make sure the + * batCount is set correctly (e.g. by calling BATsetcount), then use + * BAThseqbase and BATkey, and finally set the other properties. + */ + +void +BATassertProps(BAT *b) { + int bbpstatus; BATiter bi = bat_iterator(b); BUN p, q; int (*cmpf)(const void *, const void *); @@ -1911,6 +1944,21 @@ BATassertTailProps(BAT *b) const void *prev = NULL, *valp, *nilp; int seennil = 0; + /* general BAT sanity */ + assert(b != NULL); + assert(b->batCacheid > 0); + assert(b->batCount >= b->batInserted); + + /* headless */ + assert(b->hseqbase < oid_nil); /* non-nil seqbase */ + assert(b->hseqbase + BATcount(b) < oid_nil); + + bbpstatus = BBP_status(b->batCacheid); + /* only at most one of BBPDELETED, BBPEXISTING, BBPNEW may be set */ + assert(((bbpstatus & BBPDELETED) != 0) + + ((bbpstatus & BBPEXISTING) != 0) + + ((bbpstatus & BBPNEW) != 0) <= 1); + assert(b != NULL); assert(b->ttype >= TYPE_void); assert(b->ttype < GDKatomcnt); @@ -2120,62 +2168,6 @@ BATassertTailProps(BAT *b) } } -/* Assert that properties are set correctly. - * - * A BAT can have a bunch of properties set. Mostly, the property - * bits are set if we *know* the property holds, and not set if we - * don't know whether the property holds (or if we know it doesn't - * hold). All properties are per column. - * - * 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. - * 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. - * sorted The column is sorted (ascending). If also revsorted, - * then all values are equal. - * revsorted The column is reversely sorted (descending). If - * also sorted, then all values are equal. - * - * The "key" property consists of two bits. The lower bit, when set, - * indicates that all values in the column are distinct. The upper - * bit, when set, indicates that all values must be distinct - * (BOUND2BTRUE). - * - * Note that the functions BATtseqbase and BATkey also set more - * properties than you might suspect. When setting properties on a - * newly created and filled BAT, you may want to first make sure the - * batCount is set correctly (e.g. by calling BATsetcount), then use - * BAThseqbase and BATkey, and finally set the other properties. - */ - -void -BATassertProps(BAT *b) -{ - int bbpstatus; - - /* general BAT sanity */ - assert(b != NULL); - assert(b->batCacheid > 0); - assert(b->batCount >= b->batInserted); - - /* headless */ - assert(b->hseqbase != oid_nil); - - bbpstatus = BBP_status(b->batCacheid); - /* only at most one of BBPDELETED, BBPEXISTING, BBPNEW may be set */ - assert(((bbpstatus & BBPDELETED) != 0) + - ((bbpstatus & BBPEXISTING) != 0) + - ((bbpstatus & BBPNEW) != 0) <= 1); - - BATassertTailProps(b); - assert(b->hseqbase < oid_nil); /* non-nil seqbase */ - assert(b->hseqbase + BATcount(b) < oid_nil); -} - /* derive properties that can be derived with a simple scan: sorted, * revsorted, dense; if expensive is set, we also check the key * property @@ -2184,7 +2176,7 @@ BATassertProps(BAT *b) * nonil. */ void -BATderiveTailProps(BAT *b, int expensive) +BATderiveProps(BAT *b, int expensive) { BATiter bi = bat_iterator(b); BUN p, q; @@ -2393,16 +2385,6 @@ BATderiveTailProps(BAT *b, int expensive } } #ifndef NDEBUG - BATassertTailProps(b); + BATassertProps(b); #endif } - -void -BATderiveProps(BAT *b, int expensive) -{ - if (b == NULL) { - assert(0); - return; - } - BATderiveTailProps(b, expensive); -} diff --git a/gdk/gdk_group.c b/gdk/gdk_group.c --- a/gdk/gdk_group.c +++ b/gdk/gdk_group.c @@ -846,8 +846,7 @@ BATgroup_internal(BAT **groups, BAT **ex /* not sorted, and no pre-existing hash table: we'll * build an incomplete hash table on the fly--also see - * BATassertTailProps and BATderiveTailProps for - * similar code; + * BATassertProps and BATderiveProps for similar code; * we also exploit if g is clustered */ ALGODEBUG fprintf(stderr, "#BATgroup(b=%s#" BUNFMT "," "g=%s#" BUNFMT "," diff --git a/monetdb5/modules/kernel/bat5.c b/monetdb5/modules/kernel/bat5.c --- a/monetdb5/modules/kernel/bat5.c +++ b/monetdb5/modules/kernel/bat5.c @@ -565,7 +565,7 @@ BKCgetKey(bit *ret, const bat *bid) *ret = TRUE; } else { if (!b->tkey) { - BATderiveTailProps(b, 1); + BATderiveProps(b, 1); } *ret = b->tkey ? TRUE : FALSE; } _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list