Changeset: 3752da429894 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=3752da429894 Modified Files: sql/server/rel_optimizer.c Branch: mtest Log Message:
merge with default diffs (truncated from 4115 to 300 lines): diff --git a/README.rst b/README.rst --- a/README.rst +++ b/README.rst @@ -131,10 +131,16 @@ Bugs ---- We of course hope there aren't any, but if you do find one, you can -report bugs in our `bugzilla`__ instance. +report bugs in our `github`__ repository. + +Please note that we do not accept github Pull Requests. See the +`developers`__ page for instructions. -.. _bugzilla: https://bugs.monetdb.org -__ bugzilla_ +.. _github: https://github.com/MonetDB/MonetDB/issues +__ github_ + +.. _developers: https://www.monetdb.org/Developers +__ developers_ Copyright Notice ================ diff --git a/buildtools/coverity_model.c b/buildtools/coverity_model.c new file mode 100644 --- /dev/null +++ b/buildtools/coverity_model.c @@ -0,0 +1,185 @@ +/* + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * Copyright 1997 - July 2008 CWI, August 2008 - 2020 MonetDB B.V. + */ + +/* + * This file contains a model for Coverity Scan. + * This file is not a normal source file. It is not compiled by any + * compiler, but instead it is uploaded to the Coverity site and used + * during any analysis they do on our code. + * + * We model our use of the various allocation functions. + * Things we want to do is model that GDKmalloc and friends are paired + * with GDKfree, and that exceptions created by createException and + * createMalException should be freed with freeException. + * + * author: Sjoerd Mullender + */ + +typedef enum { GDK_FAIL, GDK_SUCCEED } gdk_return; +typedef struct {} *MalBlkPtr; + +void +GDKfree(void *blk) +{ + if (blk) { + __coverity_free__(blk); + __coverity_mark_as_afm_freed__(blk, "GDKfree"); + } +} + +void * +GDKmalloc(size_t size) +{ + int has_memory; + __coverity_negative_sink__(size); + if(has_memory) { + void *p = __coverity_alloc__(size); + __coverity_mark_as_afm_allocated__(p, "GDKfree"); + __coverity_mark_as_uninitialized_buffer__(p); + return p; + } + return 0; +} + +void * +GDKzalloc(size_t size) +{ + void *p = GDKmalloc(size); + if (p) { + for (size_t i = 0; i < size; i++) + ((char *) p)[i] = 0; + } + return p; +} + +char * +GDKstrdup(const char *s) +{ + char *p; + size_t i; + int has_memory; + if (s == 0) + return 0; + __coverity_string_null_sink__(s); + __coverity_string_size_sink__(s); + if (has_memory) { + p = __coverity_alloc_nosize__(); + __coverity_mark_as_afm_allocated__(p, "GDKfree"); + for (i = 0; (p[i] = s[i]); i++) + ; + return p; + } + return 0; +} + +char * +GDKstrndup(const char *s, size_t size) +{ + char *p; + size_t i; + __coverity_negative_sink__(size); + if (s == 0) + return 0; + p = GDKmalloc(size + 1); + if (p) { + for (i = 0; i < size && (p[i] = s[i]); i++) + ; + p[i] = 0; + } + return p; +} + +void * +GDKrealloc(void *blk, size_t size) +{ + void *p = GDKmalloc(size); + if (p != 0) + GDKfree(blk); + return p; +} + +void * +GDKmmap(const char *path, int mode, size_t size) +{ + int has_memory; + __coverity_negative_sink__(size); + if (has_memory) { + void *p = __coverity_alloc__(size); + __coverity_mark_as_afm_allocated__(p, "GDKmunmap"); + __coverity_writeall__(p); + return p; + } + return 0; +} + +gdk_return +GDKmunmap(void *p, size_t size) +{ + int failed; + __coverity_free__(p); + __coverity_mark_as_afm_freed__(p, "GDKmunmap"); + return failed ? GDK_FAIL : GDK_SUCCEED; +} + +void * +GDKmremap(const char *path, int mode, void *old_address, size_t old_size, size_t *new_size) +{ + void *p = GDKmmap(path, mode, new_size); + if (p) { + (void) GDKmunmap(old_address, old_size); + } + return p; +} + +char * +createException(enum malexception type, const char *fcn, const char *format, ...) +{ + char *p; + __coverity_format_string_sink__(format); + p = __coverity_alloc_nosize__(); + __coverity_mark_as_afm_allocated__(p, "freeException"); + return p; +} + +char * +createMalException(MalBlkPtr mb, int pc, enum malexception type, const char *format, ...) +{ + char *p; + __coverity_format_string_sink__(format); + p = __coverity_alloc_nosize__(); + __coverity_mark_as_afm_allocated__(p, "freeException"); + return p; +} + +char * +dupError(const char *err) +{ + char *p; + p = __coverity_alloc_nosize__(); + __coverity_mark_as_afm_allocated__(p, "freeException"); + return p; +} + +void +freeException(char *p) +{ + if (p) { + __coverity_free__(p); + __coverity_mark_as_afm_freed__(p, "freeException"); + } +} + +char * +concatErrors(char *err1, const char *err2) +{ + freeException(err1); + char *p; + p = __coverity_alloc_nosize__(); + __coverity_mark_as_afm_allocated__(p, "freeException"); + return p; +} diff --git a/gdk/ChangeLog b/gdk/ChangeLog --- a/gdk/ChangeLog +++ b/gdk/ChangeLog @@ -1,3 +1,6 @@ # ChangeLog file for GDK # This file is updated with Maddlog +* Tue Dec 1 2020 Sjoerd Mullender <sjo...@acm.org> +- We now save the location of the min and max values when known. + diff --git a/gdk/gdk.h b/gdk/gdk.h --- a/gdk/gdk.h +++ b/gdk/gdk.h @@ -712,7 +712,10 @@ typedef struct { #define GDKLIBRARY_BLOB_SORT 061040U /* first in Mar2018: blob compare changed */ #define GDKLIBRARY_OLDDATE 061041U /* first in Apr2019: time/date in old format */ -#define GDKLIBRARY 061042U /* first in Nov2019 */ +#define GDKLIBRARY_MINMAX_POS 061042U /* first in Nov2019 */ + +/* if the version number is updated, also fix snapshot_bats() in bat_logger.c */ +#define GDKLIBRARY 061043U /* first after Oct2020 */ typedef struct BAT { /* static bat properties */ @@ -2020,7 +2023,9 @@ gdk_export void VIEWbounds(BAT *b, BAT * */ enum prop_t { GDK_MIN_VALUE = 3, /* smallest non-nil value in BAT */ + GDK_MIN_POS, /* BUN position of smallest value */ GDK_MAX_VALUE, /* largest non-nil value in BAT */ + GDK_MAX_POS, /* BUN position of largest value */ GDK_HASH_BUCKETS, /* last used hash bucket size */ GDK_NUNIQUE, /* number of unique values */ }; diff --git a/gdk/gdk_aggr.c b/gdk/gdk_aggr.c --- a/gdk/gdk_aggr.c +++ b/gdk/gdk_aggr.c @@ -3534,6 +3534,7 @@ BATmin_skipnil(BAT *b, void *aggr, bit s bi = bat_iterator(b); res = BUNtail(bi, pos - b->hseqbase); BATsetprop(b, GDK_MIN_VALUE, b->ttype, res); + BATsetprop(b, GDK_MIN_POS, TYPE_oid, &(oid){pos - b->hseqbase}); } } if (aggr == NULL) { @@ -3633,8 +3634,10 @@ BATmax_skipnil(BAT *b, void *aggr, bit s } else { bi = bat_iterator(b); res = BUNtail(bi, pos - b->hseqbase); - if (b->tnonil) + if (b->tnonil) { BATsetprop(b, GDK_MAX_VALUE, b->ttype, res); + BATsetprop(b, GDK_MAX_POS, TYPE_oid, &(oid){pos - b->hseqbase}); + } } } if (aggr == NULL) { diff --git a/gdk/gdk_align.c b/gdk/gdk_align.c --- a/gdk/gdk_align.c +++ b/gdk/gdk_align.c @@ -274,114 +274,99 @@ VIEWunlink(BAT *b) gdk_return VIEWreset(BAT *b) { - bat tp, tvp; - Heap tail, *th = NULL; - BAT *v = NULL; - if (b == NULL) return GDK_FAIL; - assert(b->batCacheid > 0); - tp = VIEWtparent(b); - tvp = VIEWvtparent(b); - if (tp || tvp) { - BUN cnt; - const char *nme; - /* alloc heaps */ - tail = (Heap) {0}; - - cnt = BATcount(b) + 1; - nme = BBP_physical(b->batCacheid); - - assert(b->batCacheid > 0); - assert(tp || tvp || !b->ttype); + bat tp = VIEWtparent(b); _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list