Mercurial > hg > MonetDB-extend
changeset 51:6086f2212001
Aggregates don't generally get an "abort_on_error" argument.
author | Sjoerd Mullender <sjoerd@acm.org> |
---|---|
date | Wed, 04 Aug 2021 14:12:50 +0200 (2021-08-04) |
parents | 3531b398df38 |
children | 22b5ec33dd19 |
files | gmean/README.rst gmean/gmean.c |
diffstat | 2 files changed, 18 insertions(+), 30 deletions(-) [+] |
line wrap: on
line diff
--- a/gmean/README.rst Wed Jun 23 13:41:14 2021 +0200 +++ b/gmean/README.rst Wed Aug 04 14:12:50 2021 +0200 @@ -124,13 +124,13 @@ address groupedgmean_int comment "geometric mean"; - command subgmean(val:bat[:int], g:bat[:oid], e:bat[:any_1], - skip_nils:bit, abort_on_error:bit) :bat[:dbl] + command subgmean(val:bat[:int], g:bat[:oid], e:bat[:any_1], skip_nils:bit) + :bat[:dbl] address subgroupedgmean_int comment "geometric mean"; command subgmean(val:bat[:int], g:bat[:oid], e:bat[:any_1], s:bat[:oid], - skip_nils:bit, abort_on_error:bit) :bat[:dbl] + skip_nils:bit) :bat[:dbl] address subgroupedgmeancand_int comment "geometric mean"; @@ -148,10 +148,10 @@ args(1,4, batarg("",dbl),batarg("b",int),batarg("g",oid),batargany("e",1))), command("gmean", "subgmean", subgroupedgmean_int, false, "geometric mean", - args(1,6, batarg("",dbl),batarg("b",int),batarg("g",oid),batargany("e",1),arg("skip_nils",bit),arg("abort_on_error",bit))), + args(1,5, batarg("",dbl),batarg("b",int),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))), command("gmean", "subgmean", subgroupedgmeancand_int, false, "geometric mean", - args(1,7, batarg("",dbl),batarg("b",int),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit),arg("abort_on_error",bit))), + args(1,6, batarg("",dbl),batarg("b",int),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))), { .imp=NULL } /* sentinel */ }; @@ -293,11 +293,9 @@ static char * subgroupedgmean_int(bat *retval, const bat *bid, const bat *gid, - const bat *eid, - const bit *skip_nils, const bit *abort_on_error) + const bat *eid, const bit *skip_nils) { - return subgroupedgmeancand_int(retval, bid, gid, eid, NULL, - skip_nils, abort_on_error); + return subgroupedgmeancand_int(retval, bid, gid, eid, NULL, skip_nils); } static char * @@ -315,8 +313,7 @@ static char * subgroupedgmeancand_int(bat *retval, const bat *bid, const bat *gid, - const bat *eid, const bat *sid, - const bit *skip_nils, const bit *abort_on_error) + const bat *eid, const bat *sid, const bit *skip_nils) { ... } @@ -335,10 +332,7 @@ The ``skip_nils`` value is generally ``true``, and we will actually ignore it. It could be ``false`` for e.g. a ``COUNT(*)`` aggregate -where ``NULL`` values have to be counted as well. The -``abort_on_error`` value is also generally ``true`` since that is the -normal way SQL expects errors to be handled. We will ignore this -value as well. +where ``NULL`` values have to be counted as well. When an aggregate function is called, the first input parameter should refer to a BAT, but the other three input BATs are optional. If they
--- a/gmean/gmean.c Wed Jun 23 13:41:14 2021 +0200 +++ b/gmean/gmean.c Wed Aug 04 14:12:50 2021 +0200 @@ -64,7 +64,7 @@ static char * subgroupedgmeancand_int(bat *retval, const bat *bid, const bat *gid, const bat *eid, const bat *sid, - const bit *skip_nils, const bit *abort_on_error) + const bit *skip_nils) { BAT *b, *bn; /* these two are always assigned */ BAT *g = NULL; /* these three are optional and may not ... */ @@ -73,7 +73,6 @@ /* we ignore these two inputs */ (void) skip_nils; - (void) abort_on_error; /* the bat we're supposed to be working on (bid) is not * optional, but the others are, so we test whether the bat id @@ -140,11 +139,9 @@ /* In general we need to distinguish two cases per group: there * are no non-nil values, then the result should be nil; there * are non-nil values, then the result should be the aggregate. - * If there is an error (e.g. overflow), the abort_on_error flag - * determines what should happen: if set, there should not be - * any result (error return), if not set, the group value should - * be set to nil. We shouldn't get any overflow errors, so this - * doesn't apply here. */ + * If there is an error (e.g. overflow), there should not be any + * result (error return). We shouldn't get any overflow errors, + * so this doesn't apply here. */ const int *vals = (const int *) Tloc(b, 0); const oid *gids = NULL; if (g && !BATtdense(g)) @@ -243,18 +240,15 @@ static char * subgroupedgmean_int(bat *retval, const bat *bid, const bat *gid, - const bat *eid, - const bit *skip_nils, const bit *abort_on_error) + const bat *eid, const bit *skip_nils) { - return subgroupedgmeancand_int(retval, bid, gid, eid, NULL, - skip_nils, abort_on_error); + return subgroupedgmeancand_int(retval, bid, gid, eid, NULL, skip_nils); } static char * groupedgmean_int(bat *retval, const bat *bid, const bat *gid, const bat *eid) { - return subgroupedgmeancand_int(retval, bid, gid, eid, NULL, - &(bit){1}, &(bit){1}); + return subgroupedgmeancand_int(retval, bid, gid, eid, NULL, &(bit){1}); } #include "mel.h" @@ -271,10 +265,10 @@ args(1,4, batarg("",dbl),batarg("b",int),batarg("g",oid),batargany("e",1))), command("gmean", "subgmean", subgroupedgmean_int, false, "geometric mean", - args(1,6, batarg("",dbl),batarg("b",int),batarg("g",oid),batargany("e",1),arg("skip_nils",bit),arg("abort_on_error",bit))), + args(1,5, batarg("",dbl),batarg("b",int),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))), command("gmean", "subgmean", subgroupedgmeancand_int, false, "geometric mean", - args(1,7, batarg("",dbl),batarg("b",int),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit),arg("abort_on_error",bit))), + args(1,6, batarg("",dbl),batarg("b",int),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))), { .imp=NULL } /* sentinel */ };