Changeset: 0f49374a80da for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=0f49374a80da Removed Files: monetdb5/scheduler/Tests/memo04.malC Modified Files: clients/Tests/exports.stable.out gdk/ChangeLog gdk/gdk.h gdk/gdk_bat.c gdk/gdk_batop.c gdk/gdk_firstn.c gdk/gdk_group.c geom/monetdb5/geom.c geom/monetdb5/geom.mal geom/monetdb5/geomBulk.c monetdb5/extras/rapi/Tests/rapi00.malC monetdb5/extras/rapi/Tests/rapi01.malC monetdb5/extras/rapi/Tests/rapi01.stable.err monetdb5/extras/rapi/Tests/rapi02.malC monetdb5/extras/rapi/Tests/rapi03.malC monetdb5/extras/rapi/Tests/rapi04.malC monetdb5/extras/rapi/Tests/rapi05.malC monetdb5/extras/rapi/Tests/rapi06.malC monetdb5/extras/rapi/Tests/rapi07.malC monetdb5/extras/rapi/Tests/rapi08.malC monetdb5/extras/rapi/Tests/rapi10.malC monetdb5/extras/sphinx/sphinx.mal monetdb5/mal/Tests/tst077.stable.out monetdb5/mal/Tests/tst1012.malC monetdb5/mal/Tests/tst802.stable.out monetdb5/mal/Tests/tst810.stable.out monetdb5/mal/Tests/tst819.stable.out monetdb5/mal/Tests/tst850.stable.out monetdb5/mal/Tests/tst866.stable.out monetdb5/mal/Tests/tst870.stable.out monetdb5/mal/Tests/tst880.stable.out monetdb5/mal/Tests/tst890.stable.out monetdb5/mal/Tests/tst901.stable.out monetdb5/mal/Tests/tst901a.stable.out monetdb5/mal/Tests/tst902.stable.out monetdb5/mal/Tests/tst904.stable.out monetdb5/mal/Tests/tst906.stable.out monetdb5/mal/Tests/tst907.stable.out monetdb5/mal/Tests/tst908.stable.out monetdb5/mal/Tests/tst911.stable.out monetdb5/mal/Tests/tst913.stable.out monetdb5/mal/Tests/tst960.stable.out monetdb5/mal/mal_parser.c monetdb5/modules/atoms/batxml.mal monetdb5/modules/atoms/json.mal monetdb5/modules/atoms/mtime.mal monetdb5/modules/atoms/uuid.mal monetdb5/modules/kernel/alarm.mal monetdb5/modules/kernel/algebra.c monetdb5/modules/kernel/algebra.mal monetdb5/modules/kernel/bat5.c monetdb5/modules/kernel/bat5.mal monetdb5/modules/kernel/batcolor.mal monetdb5/modules/kernel/batmmath.mal monetdb5/modules/kernel/batstr.mal monetdb5/modules/kernel/group.mal monetdb5/modules/kernel/microbenchmark.mal monetdb5/modules/kernel/status.mal monetdb5/modules/mal/Tests/inspect05.malC monetdb5/modules/mal/Tests/inspect05.stable.out.int128 monetdb5/modules/mal/Tests/partition.stable.out monetdb5/modules/mal/Tests/remote12.malC monetdb5/modules/mal/Tests/remote12.stable.err monetdb5/modules/mal/Tests/tokenizer00.malC monetdb5/modules/mal/batExtensions.c monetdb5/modules/mal/batExtensions.mal monetdb5/modules/mal/groupby.c monetdb5/modules/mal/mal_mapi.c monetdb5/modules/mal/manifold.c monetdb5/modules/mal/mat.c monetdb5/modules/mal/mdb.mal monetdb5/modules/mal/orderidx.mal monetdb5/modules/mal/remote.c monetdb5/modules/mal/tablet.c monetdb5/optimizer/Tests/CXexample.stable.out monetdb5/optimizer/Tests/DCexample.malC monetdb5/optimizer/Tests/DCexample2.stable.out monetdb5/optimizer/Tests/GCexample01.stable.out monetdb5/optimizer/Tests/JPexample.stable.out monetdb5/optimizer/Tests/Mexample.malC monetdb5/optimizer/Tests/Mexample.stable.out monetdb5/optimizer/Tests/dataflow.malC monetdb5/optimizer/Tests/inline00.stable.out monetdb5/optimizer/Tests/inline01.stable.out monetdb5/optimizer/Tests/inline02.malC monetdb5/optimizer/Tests/inline02.stable.out monetdb5/optimizer/Tests/inline03.malC monetdb5/optimizer/Tests/inline03.stable.out monetdb5/optimizer/Tests/inline04.malC monetdb5/optimizer/Tests/inline04.stable.out monetdb5/optimizer/Tests/inline05.malC monetdb5/optimizer/Tests/inline05.stable.out monetdb5/optimizer/Tests/inline06.malC monetdb5/optimizer/Tests/inline06.stable.out monetdb5/optimizer/Tests/inline07.malC monetdb5/optimizer/Tests/inline07.stable.out monetdb5/optimizer/Tests/inline08.malC monetdb5/optimizer/Tests/inline08.stable.out monetdb5/optimizer/Tests/inline09.malC monetdb5/optimizer/Tests/inline09.stable.out monetdb5/optimizer/Tests/inline10.malC monetdb5/optimizer/Tests/inline10.stable.out monetdb5/optimizer/Tests/inline11.malC monetdb5/optimizer/Tests/inline12.malC monetdb5/optimizer/Tests/inline12.stable.out monetdb5/optimizer/Tests/inlineCst.malC monetdb5/optimizer/Tests/inlineCst.stable.out monetdb5/optimizer/Tests/inlineFunction2.malC monetdb5/optimizer/Tests/inlineIfthen.malC monetdb5/optimizer/Tests/inlineIfthen.stable.out monetdb5/optimizer/Tests/manifold2.malC monetdb5/optimizer/Tests/manifold2.stable.out monetdb5/optimizer/Tests/remap.malC monetdb5/optimizer/Tests/remap.stable.out monetdb5/optimizer/Tests/tst4000.stable.out monetdb5/optimizer/Tests/tst4003.stable.out monetdb5/optimizer/Tests/tst4010.stable.out monetdb5/optimizer/Tests/tst4630.malC monetdb5/optimizer/optimizer.mal monetdb5/scheduler/Tests/memo01.malC monetdb5/scheduler/Tests/memo02.malC monetdb5/scheduler/Tests/mutation00.malC monetdb5/scheduler/Tests/oct00.malC monetdb5/scheduler/Tests/oct01.malC monetdb5/scheduler/Tests/oct02.malC monetdb5/scheduler/Tests/oct02.stable.out sql/ChangeLog sql/backends/monet5/generator/generator.c sql/backends/monet5/sql.c sql/backends/monet5/vaults/bam/Tests/bam_lib_mal.mal sql/backends/monet5/vaults/bam/bam.mal sql/backends/monet5/vaults/shp/shp.c sql/test/BugTracker-2011/Tests/crash_on_alias.Bug-2798.stable.out sql/test/BugTracker-2011/Tests/crash_on_alias.Bug-2798.stable.out.int128 sql/test/BugTracker-2014/Tests/nil_2dec_lng.Bug-3592.stable.out sql/test/BugTracker-2014/Tests/nil_2dec_lng.Bug-3592.stable.out.single sql/test/bugs/Tests/select_select_bug.sql sql/test/bugs/Tests/select_select_bug.stable.out sql/test/leaks/Tests/check1.stable.out sql/test/leaks/Tests/check2.stable.out sql/test/leaks/Tests/check3.stable.out sql/test/leaks/Tests/check4.stable.out sql/test/leaks/Tests/check5.stable.out sql/test/mapi/Tests/mal_int128.malC Branch: python3udf Log Message:
Merge with default. diffs (truncated from 5444 to 300 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 @@ -108,8 +108,6 @@ BAT *BATconvert(BAT *b, BAT *s, int tp, 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,10 @@ # ChangeLog file for MonetDB # This file is updated with Maddlog +* Wed Jul 6 2016 Sjoerd Mullender <sjo...@acm.org> +- Removed BATderiveTailProps and BATderiveProps. Just set the properties + you know about, or use BATsettrivprop. + * 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 @@ -2686,8 +2686,6 @@ gdk_export void BATundo(BAT *b); gdk_export int ALIGNsynced(BAT *b1, BAT *b2); 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); @@ -2119,290 +2167,3 @@ BATassertTailProps(BAT *b) assert(!b->tnil || seennil); } } - -/* 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 - * note that we don't check nil/nonil: we usually know pretty quickly - * that a column is not sorted, but we usually need a full scan for - * nonil. - */ -void -BATderiveTailProps(BAT *b, int expensive) -{ - BATiter bi = bat_iterator(b); - BUN p, q; - int (*cmpf)(const void *, const void *); - int cmp; - const void *prev = NULL, *valp, *nilp; - int sorted, revsorted, key, dense; - const char *nme = NULL; - char *ext = NULL; - size_t nmelen; - Heap *hp = NULL; - Hash *hs = NULL; - BUN hb, prb; - oid sqbs = oid_nil; - - if (b == NULL) { - assert(0); - return; - } - assert((b->tkey & BOUND2BTRUE) == 0); - BATsettrivprop(b); - cmpf = ATOMcompare(b->ttype); - nilp = ATOMnilptr(b->ttype); - b->batDirtydesc = 1; /* we will be changing things */ - if (b->ttype == TYPE_void || b->batCount <= 1) { - /* BATsettrivprop has already taken care of all - * properties except for (no)nil if count == 1 */ - if (b->batCount == 1) { - valp = BUNtail(bi, 0); - if (cmpf(valp, nilp) == 0) { - b->tnil = 1; - b->tnonil = 0; - } else { - b->tnil = 0; - b->tnonil = 1; - } - } - return; - } - /* tentatively set until proven otherwise */ - key = 1; - sorted = revsorted = (ATOMlinear(b->ttype) != 0); - dense = (b->ttype == TYPE_oid); - /* if no* props already set correctly, we can maybe speed - * things up, if not set correctly, reset them now and set - * them later */ - if (!b->tkey && - b->tnokey[0] < b->batCount && - b->tnokey[1] < b->batCount && - b->tnokey[0] != b->tnokey[1] && - cmpf(BUNtail(bi, b->tnokey[0]), - BUNtail(bi, b->tnokey[1])) == 0) { - /* we found proof that the column doesn't deserve the - * key property, no need to check the hard way */ - expensive = 0; - key = 0; - } else { - b->tnokey[0] = 0; - b->tnokey[1] = 0; - } - if (!b->tsorted && - b->tnosorted > 0 && - b->tnosorted < b->batCount && - cmpf(BUNtail(bi, b->tnosorted - 1), - BUNtail(bi, b->tnosorted)) > 0) { - sorted = 0; - dense = 0; - } else { - b->tnosorted = 0; - } - if (!b->trevsorted && - b->tnorevsorted > 0 && - b->tnorevsorted < b->batCount && - cmpf(BUNtail(bi, b->tnorevsorted - 1), - BUNtail(bi, b->tnorevsorted)) < 0) { - revsorted = 0; - } else { - b->tnorevsorted = 0; - } - if (dense && - !b->tdense && - b->tnodense < b->batCount && - (b->tnodense == 0 ? - * (oid *) BUNtail(bi, b->tnodense) == oid_nil : - * (oid *) BUNtail(bi, b->tnodense - 1) + 1 != * (oid *) BUNtail(bi, b->tnodense))) { - dense = 0; - } else { - b->tnodense = 0; - } - if (expensive) { - BUN mask; - - nme = BBP_physical(b->batCacheid); - nmelen = strlen(nme); - if (ATOMsize(b->ttype) == 1) - mask = 1 << 8; - else if (ATOMsize(b->ttype) == 2) - mask = 1 << 16; - else - mask = HASHmask(b->batCount); - if ((hp = GDKzalloc(sizeof(Heap))) == NULL || - (hp->filename = GDKmalloc(nmelen + 30)) == NULL || - (hp->farmid = BBPselectfarm(TRANSIENT, b->ttype, hashheap)) < 0 || - snprintf(hp->filename, nmelen + 30, - "%s.hash" SZFMT, nme, MT_getpid()) < 0 || - (ext = GDKstrdup(hp->filename + nmelen + 1)) == NULL || - (hs = HASHnew(hp, b->ttype, BUNlast(b), mask, BUN_NONE)) == NULL) { - if (hp) { - if (hp->filename) - GDKfree(hp->filename); - GDKfree(hp); - } - if (ext) - GDKfree(ext); - hp = NULL; - ext = NULL; - fprintf(stderr, - "#BATderiveProps: cannot allocate " - "hash table: not doing full check\n"); - } - } - for (q = BUNlast(b), p = 0; _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list