LCOV - code coverage report
Current view: top level - monetdb5/modules/kernel - aggr.c (source / functions) Hit Total Coverage
Test: coverage.info Lines: 266 464 57.3 %
Date: 2024-10-04 20:04:04 Functions: 40 116 34.5 %

          Line data    Source code
       1             : /*
       2             :  * SPDX-License-Identifier: MPL-2.0
       3             :  *
       4             :  * This Source Code Form is subject to the terms of the Mozilla Public
       5             :  * License, v. 2.0.  If a copy of the MPL was not distributed with this
       6             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       7             :  *
       8             :  * Copyright 2024 MonetDB Foundation;
       9             :  * Copyright August 2008 - 2023 MonetDB B.V.;
      10             :  * Copyright 1997 - July 2008 CWI.
      11             :  */
      12             : 
      13             : #include "monetdb_config.h"
      14             : #include "mal.h"
      15             : #include "mal_exception.h"
      16             : #include "aggr.h"
      17             : 
      18             : /*
      19             :  * grouped aggregates
      20             :  */
      21             : static str
      22       20645 : AGGRgrouped_bat_or_val(bat *retval1, bat *retval2, const bat *bid,
      23             :                                            const bat *gid, const bat *eid, const bat *sid,
      24             :                                            bool skip_nils, int scale, int tp,
      25             :                                            BAT *(*grpfunc1)(BAT *, BAT *, BAT *, BAT *, int, bool),
      26             :                                            gdk_return(*grpfunc2)(BAT **, BAT **, BAT *, BAT *,
      27             :                                                                                          BAT *, BAT *, int, bool, int),
      28             :                                            BAT * (*quantilefunc)(BAT *, BAT *, BAT *, BAT *, int,
      29             :                                                                                          double, bool), const bat *quantile,
      30             :                                            const double *quantile_val, const char *malfunc)
      31             : {
      32       20645 :         BAT *b, *g, *e, *s, *bn = NULL, *cnts = NULL, *q = NULL;
      33       20645 :         double qvalue;
      34             : 
      35             :         /* exactly one of grpfunc1, grpfunc2 and quantilefunc is non-NULL */
      36       20645 :         assert((grpfunc1 != NULL) + (grpfunc2 != NULL) + (quantilefunc != NULL) == 1);
      37             : 
      38             :         /* if retval2 is non-NULL, we must have grpfunc2 */
      39       20645 :         assert(retval2 == NULL || grpfunc2 != NULL);
      40             :         /* only quantiles need a quantile BAT */
      41       20645 :         assert((quantilefunc == NULL) == (quantile == NULL && quantile_val == NULL));
      42             : 
      43       20645 :         b = BATdescriptor(*bid);
      44       20646 :         g = gid ? BATdescriptor(*gid) : NULL;
      45       20645 :         e = eid ? BATdescriptor(*eid) : NULL;
      46       20646 :         s = sid ? BATdescriptor(*sid) : NULL;
      47       20646 :         q = quantile ? BATdescriptor(*quantile) : NULL;
      48             : 
      49       20643 :         if (b == NULL ||
      50       20643 :                 (gid != NULL && g == NULL) ||
      51       20643 :                 (eid != NULL && e == NULL) ||
      52       20643 :                 (sid != NULL && s == NULL) ||
      53       20643 :                 ((quantile != NULL && quantile_val != NULL) && q == NULL)) {
      54           0 :                 BBPreclaim(b);
      55           0 :                 BBPreclaim(g);
      56           0 :                 BBPreclaim(e);
      57           0 :                 BBPreclaim(s);
      58           0 :                 BBPreclaim(q);
      59           0 :                 throw(MAL, malfunc, SQLSTATE(HY002) RUNTIME_OBJECT_MISSING);
      60             :         }
      61       20643 :         if (tp == TYPE_any &&
      62          43 :                 (grpfunc1 == BATgroupmedian ||
      63          40 :                  grpfunc1 == BATgroupmedian_avg ||
      64           3 :                  quantilefunc == BATgroupquantile ||
      65             :                  quantilefunc == BATgroupquantile_avg))
      66          72 :                 tp = b->ttype;
      67             : 
      68       20643 :         if (grpfunc1) {
      69       20356 :                 bn = (*grpfunc1) (b, g, e, s, tp, skip_nils);
      70         287 :         } else if (quantilefunc) {
      71          40 :                 if (!quantile_val) {
      72          22 :                         assert(BATcount(q) > 0 || BATcount(b) == 0);
      73          22 :                         assert(q->ttype == TYPE_dbl);
      74          22 :                         if (BATcount(q) == 0) {
      75             :                                 qvalue = 0.5;
      76             :                         } else {
      77          19 :                                 MT_lock_set(&q->theaplock);
      78          19 :                                 qvalue = ((const dbl *) Tloc(q, 0))[0];
      79          19 :                                 MT_lock_unset(&q->theaplock);
      80          19 :                                 if (qvalue < 0 || qvalue > 1) {
      81           6 :                                         BBPunfix(b->batCacheid);
      82           6 :                                         BBPreclaim(g);
      83           6 :                                         BBPreclaim(e);
      84           6 :                                         BBPreclaim(s);
      85           6 :                                         BBPunfix(q->batCacheid);
      86           6 :                                         throw(MAL, malfunc,
      87             :                                                   "quantile value of %f is not in range [0,1]", qvalue);
      88             :                                 }
      89             :                         }
      90          16 :                         BBPunfix(q->batCacheid);
      91             :                 } else {
      92          18 :                         qvalue = *(quantile_val);
      93             :                 }
      94          34 :                 bn = (*quantilefunc) (b, g, e, s, tp, qvalue, skip_nils);
      95         377 :         } else if ((*grpfunc2) (&bn, retval2 ? &cnts : NULL, b, g, e, s, tp,
      96             :                                                         skip_nils, scale) != GDK_SUCCEED) {
      97           0 :                 bn = NULL;
      98             :         }
      99             : 
     100       20637 :         BBPunfix(b->batCacheid);
     101       20638 :         BBPreclaim(g);
     102       20640 :         BBPreclaim(e);
     103       20640 :         BBPreclaim(s);
     104       20640 :         if (bn == NULL)
     105           4 :                 throw(MAL, malfunc, GDK_EXCEPTION);
     106       20636 :         *retval1 = bn->batCacheid;
     107       20636 :         BBPkeepref(bn);
     108       20633 :         if (retval2) {
     109         116 :                 *retval2 = cnts->batCacheid;
     110         116 :                 BBPkeepref(cnts);
     111             :         }
     112             :         return MAL_SUCCEED;
     113             : }
     114             : 
     115             : static str
     116       20628 : AGGRgrouped(bat *retval1, bat *retval2, const bat *bid, const bat *gid,
     117             :                         const bat *eid, const bat *sid, bool skip_nils, int scale, int tp,
     118             :                         BAT *(*grpfunc1)(BAT *, BAT *, BAT *, BAT *, int, bool),
     119             :                         gdk_return(*grpfunc2)(BAT **, BAT **, BAT *, BAT *, BAT *, BAT *,
     120             :                                                                   int, bool, int), BAT * (*quantilefunc)(BAT *,
     121             :                                                                                                                                                  BAT *,
     122             :                                                                                                                                                  BAT *,
     123             :                                                                                                                                                  BAT *,
     124             :                                                                                                                                                  int,
     125             :                                                                                                                                                  double,
     126             :                                                                                                                                                  bool),
     127             :                         const bat *quantile, const char *malfunc)
     128             : {
     129       20628 :         return AGGRgrouped_bat_or_val(retval1, retval2, bid, gid, eid, sid,
     130             :                                                                   skip_nils, scale, tp, grpfunc1, grpfunc2,
     131             :                                                                   quantilefunc, quantile, NULL, malfunc);
     132             : }
     133             : 
     134             : static str
     135           0 : AGGRsum3_bte(bat *retval, const bat *bid, const bat *gid, const bat *eid)
     136             : {
     137           0 :         return AGGRgrouped(retval, NULL, bid, gid, eid, NULL, true, 0, TYPE_bte,
     138             :                                            BATgroupsum, NULL, NULL, NULL, "aggr.sum");
     139             : }
     140             : 
     141             : static str
     142           0 : AGGRsum3_sht(bat *retval, const bat *bid, const bat *gid, const bat *eid)
     143             : {
     144           0 :         return AGGRgrouped(retval, NULL, bid, gid, eid, NULL, true, 0, TYPE_sht,
     145             :                                            BATgroupsum, NULL, NULL, NULL, "aggr.sum");
     146             : }
     147             : 
     148             : static str
     149           0 : AGGRsum3_int(bat *retval, const bat *bid, const bat *gid, const bat *eid)
     150             : {
     151           0 :         return AGGRgrouped(retval, NULL, bid, gid, eid, NULL, true, 0, TYPE_int,
     152             :                                            BATgroupsum, NULL, NULL, NULL, "aggr.sum");
     153             : }
     154             : 
     155             : str
     156           0 : AGGRsum3_lng(bat *retval, const bat *bid, const bat *gid, const bat *eid)
     157             : {
     158           0 :         return AGGRgrouped(retval, NULL, bid, gid, eid, NULL, true, 0, TYPE_lng,
     159             :                                            BATgroupsum, NULL, NULL, NULL, "aggr.sum");
     160             : }
     161             : 
     162             : #ifdef HAVE_HGE
     163             : str
     164           0 : AGGRsum3_hge(bat *retval, const bat *bid, const bat *gid, const bat *eid)
     165             : {
     166           0 :         return AGGRgrouped(retval, NULL, bid, gid, eid, NULL, true, 0, TYPE_hge,
     167             :                                            BATgroupsum, NULL, NULL, NULL, "aggr.sum");
     168             : }
     169             : #endif
     170             : 
     171             : static str
     172           0 : AGGRsum3_flt(bat *retval, const bat *bid, const bat *gid, const bat *eid)
     173             : {
     174           0 :         return AGGRgrouped(retval, NULL, bid, gid, eid, NULL, true, 0, TYPE_flt,
     175             :                                            BATgroupsum, NULL, NULL, NULL, "aggr.sum");
     176             : }
     177             : 
     178             : static str
     179           0 : AGGRsum3_dbl(bat *retval, const bat *bid, const bat *gid, const bat *eid)
     180             : {
     181           0 :         return AGGRgrouped(retval, NULL, bid, gid, eid, NULL, true, 0, TYPE_dbl,
     182             :                                            BATgroupsum, NULL, NULL, NULL, "aggr.sum");
     183             : }
     184             : 
     185             : static str
     186           0 : AGGRprod3_bte(bat *retval, const bat *bid, const bat *gid, const bat *eid)
     187             : {
     188           0 :         return AGGRgrouped(retval, NULL, bid, gid, eid, NULL, true, 0, TYPE_bte,
     189             :                                            BATgroupprod, NULL, NULL, NULL, "aggr.prod");
     190             : }
     191             : 
     192             : static str
     193           0 : AGGRprod3_sht(bat *retval, const bat *bid, const bat *gid, const bat *eid)
     194             : {
     195           0 :         return AGGRgrouped(retval, NULL, bid, gid, eid, NULL, true, 0, TYPE_sht,
     196             :                                            BATgroupprod, NULL, NULL, NULL, "aggr.prod");
     197             : }
     198             : 
     199             : static str
     200           0 : AGGRprod3_int(bat *retval, const bat *bid, const bat *gid, const bat *eid)
     201             : {
     202           0 :         return AGGRgrouped(retval, NULL, bid, gid, eid, NULL, true, 0, TYPE_int,
     203             :                                            BATgroupprod, NULL, NULL, NULL, "aggr.prod");
     204             : }
     205             : 
     206             : static str
     207           0 : AGGRprod3_lng(bat *retval, const bat *bid, const bat *gid, const bat *eid)
     208             : {
     209           0 :         return AGGRgrouped(retval, NULL, bid, gid, eid, NULL, true, 0, TYPE_lng,
     210             :                                            BATgroupprod, NULL, NULL, NULL, "aggr.prod");
     211             : }
     212             : 
     213             : #ifdef HAVE_HGE
     214             : static str
     215           0 : AGGRprod3_hge(bat *retval, const bat *bid, const bat *gid, const bat *eid)
     216             : {
     217           0 :         return AGGRgrouped(retval, NULL, bid, gid, eid, NULL, true, 0, TYPE_hge,
     218             :                                            BATgroupprod, NULL, NULL, NULL, "aggr.prod");
     219             : }
     220             : #endif
     221             : 
     222             : static str
     223           0 : AGGRprod3_flt(bat *retval, const bat *bid, const bat *gid, const bat *eid)
     224             : {
     225           0 :         return AGGRgrouped(retval, NULL, bid, gid, eid, NULL, true, 0, TYPE_flt,
     226             :                                            BATgroupprod, NULL, NULL, NULL, "aggr.prod");
     227             : }
     228             : 
     229             : static str
     230           0 : AGGRprod3_dbl(bat *retval, const bat *bid, const bat *gid, const bat *eid)
     231             : {
     232           0 :         return AGGRgrouped(retval, NULL, bid, gid, eid, NULL, true, 0, TYPE_dbl,
     233             :                                            BATgroupprod, NULL, NULL, NULL, "aggr.prod");
     234             : }
     235             : 
     236             : static str
     237           0 : AGGRavg13_dbl(bat *retval, const bat *bid, const bat *gid, const bat *eid)
     238             : {
     239           0 :         return AGGRgrouped(retval, NULL, bid, gid, eid, NULL, true, 0, TYPE_dbl,
     240             :                                            NULL, BATgroupavg, NULL, NULL, "aggr.avg");
     241             : }
     242             : 
     243             : static str
     244           0 : AGGRavg23_dbl(bat *retval1, bat *retval2, const bat *bid, const bat *gid,
     245             :                           const bat *eid)
     246             : {
     247           0 :         return AGGRgrouped(retval1, retval2, bid, gid, eid, NULL, true, 0, TYPE_dbl,
     248             :                                            NULL, BATgroupavg, NULL, NULL, "aggr.avg");
     249             : }
     250             : 
     251             : static str
     252           0 : AGGRavg14_dbl(bat *retval, const bat *bid, const bat *gid, const bat *eid,
     253             :                           int *scale)
     254             : {
     255           0 :         return AGGRgrouped(retval, NULL, bid, gid, eid, NULL, true, *scale,
     256             :                                            TYPE_dbl, NULL, BATgroupavg, NULL, NULL, "aggr.avg");
     257             : }
     258             : 
     259             : static str
     260           0 : AGGRavg24_dbl(bat *retval1, bat *retval2, const bat *bid, const bat *gid,
     261             :                           const bat *eid, int *scale)
     262             : {
     263           0 :         return AGGRgrouped(retval1, retval2, bid, gid, eid, NULL, true, *scale,
     264             :                                            TYPE_dbl, NULL, BATgroupavg, NULL, NULL, "aggr.avg");
     265             : }
     266             : 
     267             : static str
     268           0 : AGGRstdev3_dbl(bat *retval, const bat *bid, const bat *gid, const bat *eid)
     269             : {
     270           0 :         return AGGRgrouped(retval, NULL, bid, gid, eid, NULL, true, 0, TYPE_dbl,
     271             :                                            BATgroupstdev_sample, NULL, NULL, NULL, "aggr.stdev");
     272             : }
     273             : 
     274             : static str
     275           0 : AGGRstdevp3_dbl(bat *retval, const bat *bid, const bat *gid, const bat *eid)
     276             : {
     277           0 :         return AGGRgrouped(retval, NULL, bid, gid, eid, NULL, true, 0, TYPE_dbl,
     278             :                                            BATgroupstdev_population, NULL, NULL, NULL,
     279             :                                            "aggr.stdevp");
     280             : }
     281             : 
     282             : static str
     283           0 : AGGRvariance3_dbl(bat *retval, const bat *bid, const bat *gid, const bat *eid)
     284             : {
     285           0 :         return AGGRgrouped(retval, NULL, bid, gid, eid, NULL, true, 0, TYPE_dbl,
     286             :                                            BATgroupvariance_sample, NULL, NULL, NULL,
     287             :                                            "aggr.variance");
     288             : }
     289             : 
     290             : static str
     291           0 : AGGRvariancep3_dbl(bat *retval, const bat *bid, const bat *gid, const bat *eid)
     292             : {
     293           0 :         return AGGRgrouped(retval, NULL, bid, gid, eid, NULL, true, 0, TYPE_dbl,
     294             :                                            BATgroupvariance_population, NULL, NULL, NULL,
     295             :                                            "aggr.variancep");
     296             : }
     297             : 
     298             : static str
     299           0 : AGGRcount3(bat *retval, const bat *bid, const bat *gid, const bat *eid,
     300             :                    const bit *ignorenils)
     301             : {
     302           0 :         return AGGRgrouped(retval, NULL, bid, gid, eid, NULL, *ignorenils, 0,
     303             :                                            TYPE_lng, BATgroupcount, NULL, NULL, NULL, "aggr.count");
     304             : }
     305             : 
     306             : static str
     307           0 : AGGRcount3nonils(bat *retval, const bat *bid, const bat *gid, const bat *eid)
     308             : {
     309           0 :         return AGGRgrouped(retval, NULL, bid, gid, eid, NULL, true, 0, TYPE_lng,
     310             :                                            BATgroupcount, NULL, NULL, NULL, "aggr.count");
     311             : }
     312             : 
     313             : static str
     314           0 : AGGRcount3nils(bat *retval, const bat *bid, const bat *gid, const bat *eid)
     315             : {
     316           0 :         return AGGRgrouped(retval, NULL, bid, gid, eid, NULL, false, 0, TYPE_lng,
     317             :                                            BATgroupcount, NULL, NULL, NULL, "aggr.count");
     318             : }
     319             : 
     320             : #include "algebra.h"                  /* for ALGprojection */
     321             : static str
     322           1 : AGGRmin3(bat *retval, const bat *bid, const bat *gid, const bat *eid)
     323             : {
     324           1 :         bat tmpid;
     325           1 :         str err;
     326             : 
     327           1 :         err = AGGRgrouped(&tmpid, NULL, bid, gid, eid, NULL, false, 0, TYPE_oid,
     328             :                                           BATgroupmin, NULL, NULL, NULL, "aggr.min");
     329           1 :         if (err == MAL_SUCCEED) {
     330           1 :                 err = ALGprojection(retval, &tmpid, bid);
     331           1 :                 BBPrelease(tmpid);
     332             :         }
     333           1 :         return err;
     334             : }
     335             : 
     336             : static str
     337           1 : AGGRmax3(bat *retval, const bat *bid, const bat *gid, const bat *eid)
     338             : {
     339           1 :         bat tmpid;
     340           1 :         str err;
     341             : 
     342           1 :         err = AGGRgrouped(&tmpid, NULL, bid, gid, eid, NULL, false, 0, TYPE_oid,
     343             :                                           BATgroupmax, NULL, NULL, NULL, "aggr.max");
     344           1 :         if (err == MAL_SUCCEED) {
     345           1 :                 err = ALGprojection(retval, &tmpid, bid);
     346           1 :                 BBPrelease(tmpid);
     347             :         }
     348           1 :         return err;
     349             : }
     350             : 
     351             : static str
     352           9 : AGGRsubsum_bte(bat *retval, const bat *bid, const bat *gid, const bat *eid,
     353             :                            const bit *skip_nils)
     354             : {
     355           9 :         return AGGRgrouped(retval, NULL, bid, gid, eid, NULL, *skip_nils,
     356             :                                            0, TYPE_bte, BATgroupsum, NULL,
     357             :                                            NULL, NULL, "aggr.subsum");
     358             : }
     359             : 
     360             : static str
     361          11 : AGGRsubsum_sht(bat *retval, const bat *bid, const bat *gid, const bat *eid,
     362             :                            const bit *skip_nils)
     363             : {
     364          11 :         return AGGRgrouped(retval, NULL, bid, gid, eid, NULL, *skip_nils,
     365             :                                            0, TYPE_sht, BATgroupsum, NULL,
     366             :                                            NULL, NULL, "aggr.subsum");
     367             : }
     368             : 
     369             : static str
     370         807 : AGGRsubsum_int(bat *retval, const bat *bid, const bat *gid, const bat *eid,
     371             :                            const bit *skip_nils)
     372             : {
     373         807 :         return AGGRgrouped(retval, NULL, bid, gid, eid, NULL, *skip_nils,
     374             :                                            0, TYPE_int, BATgroupsum, NULL,
     375             :                                            NULL, NULL, "aggr.subsum");
     376             : }
     377             : 
     378             : static str
     379        3467 : AGGRsubsum_lng(bat *retval, const bat *bid, const bat *gid, const bat *eid,
     380             :                            const bit *skip_nils)
     381             : {
     382        3467 :         return AGGRgrouped(retval, NULL, bid, gid, eid, NULL, *skip_nils,
     383             :                                            0, TYPE_lng, BATgroupsum, NULL,
     384             :                                            NULL, NULL, "aggr.subsum");
     385             : }
     386             : 
     387             : #ifdef HAVE_HGE
     388             : static str
     389        1448 : AGGRsubsum_hge(bat *retval, const bat *bid, const bat *gid, const bat *eid,
     390             :                            bit *skip_nils)
     391             : {
     392        1448 :         return AGGRgrouped(retval, NULL, bid, gid, eid, NULL, *skip_nils,
     393             :                                            0, TYPE_hge, BATgroupsum, NULL,
     394             :                                            NULL, NULL, "aggr.subsum");
     395             : }
     396             : #endif
     397             : 
     398             : static str
     399           0 : AGGRsubsum_flt(bat *retval, const bat *bid, const bat *gid, const bat *eid,
     400             :                            const bit *skip_nils)
     401             : {
     402           0 :         return AGGRgrouped(retval, NULL, bid, gid, eid, NULL, *skip_nils,
     403             :                                            0, TYPE_flt, BATgroupsum, NULL,
     404             :                                            NULL, NULL, "aggr.subsum");
     405             : }
     406             : 
     407             : static str
     408          47 : AGGRsubsum_dbl(bat *retval, const bat *bid, const bat *gid, const bat *eid,
     409             :                            const bit *skip_nils)
     410             : {
     411          47 :         return AGGRgrouped(retval, NULL, bid, gid, eid, NULL, *skip_nils,
     412             :                                            0, TYPE_dbl, BATgroupsum, NULL,
     413             :                                            NULL, NULL, "aggr.subsum");
     414             : }
     415             : 
     416             : static str
     417           0 : AGGRsubsumcand_bte(bat *retval, const bat *bid, const bat *gid, const bat *eid,
     418             :                                    const bat *sid, const bit *skip_nils)
     419             : {
     420           0 :         return AGGRgrouped(retval, NULL, bid, gid, eid, sid, *skip_nils,
     421             :                                            0, TYPE_bte, BATgroupsum, NULL,
     422             :                                            NULL, NULL, "aggr.subsum");
     423             : }
     424             : 
     425             : static str
     426           0 : AGGRsubsumcand_sht(bat *retval, const bat *bid, const bat *gid, const bat *eid,
     427             :                                    const bat *sid, const bit *skip_nils)
     428             : {
     429           0 :         return AGGRgrouped(retval, NULL, bid, gid, eid, sid, *skip_nils,
     430             :                                            0, TYPE_sht, BATgroupsum, NULL,
     431             :                                            NULL, NULL, "aggr.subsum");
     432             : }
     433             : 
     434             : static str
     435           0 : AGGRsubsumcand_int(bat *retval, const bat *bid, const bat *gid, const bat *eid,
     436             :                                    const bat *sid, const bit *skip_nils)
     437             : {
     438           0 :         return AGGRgrouped(retval, NULL, bid, gid, eid, sid, *skip_nils,
     439             :                                            0, TYPE_int, BATgroupsum, NULL,
     440             :                                            NULL, NULL, "aggr.subsum");
     441             : }
     442             : 
     443             : static str
     444           0 : AGGRsubsumcand_lng(bat *retval, const bat *bid, const bat *gid, const bat *eid,
     445             :                                    const bat *sid, const bit *skip_nils)
     446             : {
     447           0 :         return AGGRgrouped(retval, NULL, bid, gid, eid, sid, *skip_nils,
     448             :                                            0, TYPE_lng, BATgroupsum, NULL,
     449             :                                            NULL, NULL, "aggr.subsum");
     450             : }
     451             : 
     452             : #ifdef HAVE_HGE
     453             : static str
     454           0 : AGGRsubsumcand_hge(bat *retval, const bat *bid, const bat *gid, const bat *eid,
     455             :                                    const bat *sid, const bit *skip_nils)
     456             : {
     457           0 :         return AGGRgrouped(retval, NULL, bid, gid, eid, sid, *skip_nils,
     458             :                                            0, TYPE_hge, BATgroupsum, NULL,
     459             :                                            NULL, NULL, "aggr.subsum");
     460             : }
     461             : #endif
     462             : 
     463             : static str
     464           0 : AGGRsubsumcand_flt(bat *retval, const bat *bid, const bat *gid, const bat *eid,
     465             :                                    const bat *sid, const bit *skip_nils)
     466             : {
     467           0 :         return AGGRgrouped(retval, NULL, bid, gid, eid, sid, *skip_nils,
     468             :                                            0, TYPE_flt, BATgroupsum, NULL,
     469             :                                            NULL, NULL, "aggr.subsum");
     470             : }
     471             : 
     472             : static str
     473           0 : AGGRsubsumcand_dbl(bat *retval, const bat *bid, const bat *gid, const bat *eid,
     474             :                                    const bat *sid, const bit *skip_nils)
     475             : {
     476           0 :         return AGGRgrouped(retval, NULL, bid, gid, eid, sid, *skip_nils,
     477             :                                            0, TYPE_dbl, BATgroupsum, NULL,
     478             :                                            NULL, NULL, "aggr.subsum");
     479             : }
     480             : 
     481             : static str
     482           0 : AGGRsubprod_bte(bat *retval, const bat *bid, const bat *gid, const bat *eid,
     483             :                                 const bit *skip_nils)
     484             : {
     485           0 :         return AGGRgrouped(retval, NULL, bid, gid, eid, NULL, *skip_nils,
     486             :                                            0, TYPE_bte, BATgroupprod, NULL,
     487             :                                            NULL, NULL, "aggr.subprod");
     488             : }
     489             : 
     490             : static str
     491           0 : AGGRsubprod_sht(bat *retval, const bat *bid, const bat *gid, const bat *eid,
     492             :                                 const bit *skip_nils)
     493             : {
     494           0 :         return AGGRgrouped(retval, NULL, bid, gid, eid, NULL, *skip_nils,
     495             :                                            0, TYPE_sht, BATgroupprod, NULL,
     496             :                                            NULL, NULL, "aggr.subprod");
     497             : }
     498             : 
     499             : static str
     500           0 : AGGRsubprod_int(bat *retval, const bat *bid, const bat *gid, const bat *eid,
     501             :                                 const bit *skip_nils)
     502             : {
     503           0 :         return AGGRgrouped(retval, NULL, bid, gid, eid, NULL, *skip_nils,
     504             :                                            0, TYPE_int, BATgroupprod, NULL,
     505             :                                            NULL, NULL, "aggr.subprod");
     506             : }
     507             : 
     508             : static str
     509           0 : AGGRsubprod_lng(bat *retval, const bat *bid, const bat *gid, const bat *eid,
     510             :                                 const bit *skip_nils)
     511             : {
     512           0 :         return AGGRgrouped(retval, NULL, bid, gid, eid, NULL, *skip_nils,
     513             :                                            0, TYPE_lng, BATgroupprod, NULL,
     514             :                                            NULL, NULL, "aggr.subprod");
     515             : }
     516             : 
     517             : #ifdef HAVE_HGE
     518             : static str
     519           0 : AGGRsubprod_hge(bat *retval, const bat *bid, const bat *gid, const bat *eid,
     520             :                                 const bit *skip_nils)
     521             : {
     522           0 :         return AGGRgrouped(retval, NULL, bid, gid, eid, NULL, *skip_nils,
     523             :                                            0, TYPE_hge, BATgroupprod, NULL,
     524             :                                            NULL, NULL, "aggr.subprod");
     525             : }
     526             : #endif
     527             : 
     528             : static str
     529           0 : AGGRsubprod_flt(bat *retval, const bat *bid, const bat *gid, const bat *eid,
     530             :                                 const bit *skip_nils)
     531             : {
     532           0 :         return AGGRgrouped(retval, NULL, bid, gid, eid, NULL, *skip_nils,
     533             :                                            0, TYPE_flt, BATgroupprod, NULL,
     534             :                                            NULL, NULL, "aggr.subprod");
     535             : }
     536             : 
     537             : static str
     538          12 : AGGRsubprod_dbl(bat *retval, const bat *bid, const bat *gid, const bat *eid,
     539             :                                 const bit *skip_nils)
     540             : {
     541          12 :         return AGGRgrouped(retval, NULL, bid, gid, eid, NULL, *skip_nils,
     542             :                                            0, TYPE_dbl, BATgroupprod, NULL,
     543             :                                            NULL, NULL, "aggr.subprod");
     544             : }
     545             : 
     546             : static str
     547           0 : AGGRsubprodcand_bte(bat *retval, const bat *bid, const bat *gid, const bat *eid,
     548             :                                         const bat *sid, const bit *skip_nils)
     549             : {
     550           0 :         return AGGRgrouped(retval, NULL, bid, gid, eid, sid, *skip_nils,
     551             :                                            0, TYPE_bte, BATgroupprod, NULL,
     552             :                                            NULL, NULL, "aggr.subprod");
     553             : }
     554             : 
     555             : static str
     556           0 : AGGRsubprodcand_sht(bat *retval, const bat *bid, const bat *gid, const bat *eid,
     557             :                                         const bat *sid, const bit *skip_nils)
     558             : {
     559           0 :         return AGGRgrouped(retval, NULL, bid, gid, eid, sid, *skip_nils,
     560             :                                            0, TYPE_sht, BATgroupprod, NULL,
     561             :                                            NULL, NULL, "aggr.subprod");
     562             : }
     563             : 
     564             : static str
     565           0 : AGGRsubprodcand_int(bat *retval, const bat *bid, const bat *gid, const bat *eid,
     566             :                                         const bat *sid, const bit *skip_nils)
     567             : {
     568           0 :         return AGGRgrouped(retval, NULL, bid, gid, eid, sid, *skip_nils,
     569             :                                            0, TYPE_int, BATgroupprod, NULL,
     570             :                                            NULL, NULL, "aggr.subprod");
     571             : }
     572             : 
     573             : static str
     574           0 : AGGRsubprodcand_lng(bat *retval, const bat *bid, const bat *gid, const bat *eid,
     575             :                                         const bat *sid, const bit *skip_nils)
     576             : {
     577           0 :         return AGGRgrouped(retval, NULL, bid, gid, eid, sid, *skip_nils,
     578             :                                            0, TYPE_lng, BATgroupprod, NULL,
     579             :                                            NULL, NULL, "aggr.subprod");
     580             : }
     581             : 
     582             : #ifdef HAVE_HGE
     583             : static str
     584           0 : AGGRsubprodcand_hge(bat *retval, const bat *bid, const bat *gid, const bat *eid,
     585             :                                         const bat *sid, const bit *skip_nils)
     586             : {
     587           0 :         return AGGRgrouped(retval, NULL, bid, gid, eid, sid, *skip_nils,
     588             :                                            0, TYPE_hge, BATgroupprod, NULL,
     589             :                                            NULL, NULL, "aggr.subprod");
     590             : }
     591             : #endif
     592             : 
     593             : static str
     594           0 : AGGRsubprodcand_flt(bat *retval, const bat *bid, const bat *gid, const bat *eid,
     595             :                                         const bat *sid, const bit *skip_nils)
     596             : {
     597           0 :         return AGGRgrouped(retval, NULL, bid, gid, eid, sid, *skip_nils,
     598             :                                            0, TYPE_flt, BATgroupprod, NULL,
     599             :                                            NULL, NULL, "aggr.subprod");
     600             : }
     601             : 
     602             : static str
     603           0 : AGGRsubprodcand_dbl(bat *retval, const bat *bid, const bat *gid, const bat *eid,
     604             :                                         const bat *sid, const bit *skip_nils)
     605             : {
     606           0 :         return AGGRgrouped(retval, NULL, bid, gid, eid, sid, *skip_nils,
     607             :                                            0, TYPE_dbl, BATgroupprod, NULL,
     608             :                                            NULL, NULL, "aggr.subprod");
     609             : }
     610             : 
     611             : static str
     612         130 : AGGRsubavg1_dbl(bat *retval, const bat *bid, const bat *gid, const bat *eid,
     613             :                                 const bit *skip_nils)
     614             : {
     615         130 :         return AGGRgrouped(retval, NULL, bid, gid, eid, NULL, *skip_nils,
     616             :                                            0, TYPE_dbl, NULL, BATgroupavg,
     617             :                                            NULL, NULL, "aggr.subavg");
     618             : }
     619             : 
     620             : static str
     621           0 : AGGRsubavg1cand_dbl(bat *retval, const bat *bid, const bat *gid, const bat *eid,
     622             :                                         const bat *sid, const bit *skip_nils)
     623             : {
     624           0 :         return AGGRgrouped(retval, NULL, bid, gid, eid, sid, *skip_nils,
     625             :                                            0, TYPE_dbl, NULL, BATgroupavg,
     626             :                                            NULL, NULL, "aggr.subavg");
     627             : }
     628             : 
     629             : static str
     630         117 : AGGRsubavg2_dbl(bat *retval1, bat *retval2, const bat *bid, const bat *gid,
     631             :                                 const bat *eid, const bit *skip_nils)
     632             : {
     633         117 :         return AGGRgrouped(retval1, retval2, bid, gid, eid, NULL, *skip_nils,
     634             :                                            0, TYPE_dbl, NULL, BATgroupavg,
     635             :                                            NULL, NULL, "aggr.subavg");
     636             : }
     637             : 
     638             : static str
     639           0 : AGGRsubavg2cand_dbl(bat *retval1, bat *retval2, const bat *bid, const bat *gid,
     640             :                                         const bat *eid, const bat *sid, const bit *skip_nils)
     641             : {
     642           0 :         return AGGRgrouped(retval1, retval2, bid, gid, eid, sid, *skip_nils,
     643             :                                            0, TYPE_dbl, NULL, BATgroupavg,
     644             :                                            NULL, NULL, "aggr.subavg");
     645             : }
     646             : 
     647             : static str
     648           0 : AGGRsubavg1s_dbl(bat *retval, const bat *bid, const bat *gid, const bat *eid,
     649             :                                  const bit *skip_nils, const int *scale)
     650             : {
     651           0 :         return AGGRgrouped(retval, NULL, bid, gid, eid, NULL, *skip_nils,
     652             :                                            *scale, TYPE_dbl, NULL, BATgroupavg,
     653             :                                            NULL, NULL, "aggr.subavg");
     654             : }
     655             : 
     656             : static str
     657           0 : AGGRsubavg1scand_dbl(bat *retval, const bat *bid, const bat *gid,
     658             :                                          const bat *eid, const bat *sid, const bit *skip_nils,
     659             :                                          const int *scale)
     660             : {
     661           0 :         return AGGRgrouped(retval, NULL, bid, gid, eid, sid, *skip_nils,
     662             :                                            *scale, TYPE_dbl, NULL, BATgroupavg,
     663             :                                            NULL, NULL, "aggr.subavg");
     664             : }
     665             : 
     666             : static str
     667           0 : AGGRsubavg2s_dbl(bat *retval1, bat *retval2, const bat *bid, const bat *gid,
     668             :                                  const bat *eid, const bit *skip_nils, const int *scale)
     669             : {
     670           0 :         return AGGRgrouped(retval1, retval2, bid, gid, eid, NULL, *skip_nils,
     671             :                                            *scale, TYPE_dbl, NULL, BATgroupavg,
     672             :                                            NULL, NULL, "aggr.subavg");
     673             : }
     674             : 
     675             : static str
     676           0 : AGGRsubavg2scand_dbl(bat *retval1, bat *retval2, const bat *bid, const bat *gid,
     677             :                                          const bat *eid, const bat *sid, const bit *skip_nils,
     678             :                                          const int *scale)
     679             : {
     680           0 :         return AGGRgrouped(retval1, retval2, bid, gid, eid, sid, *skip_nils,
     681             :                                            *scale, TYPE_dbl, NULL, BATgroupavg,
     682             :                                            NULL, NULL, "aggr.subavg");
     683             : }
     684             : 
     685             : static str
     686         145 : AGGRavg3(bat *retval1, bat *retval2, bat *retval3, const bat *bid,
     687             :                  const bat *gid, const bat *eid, const bat *sid, const bit *skip_nils)
     688             : {
     689         145 :         BAT *b, *g, *e, *s, *avgs, *cnts, *rems;
     690         145 :         gdk_return rc;
     691             : 
     692         145 :         b = BATdescriptor(*bid);
     693         145 :         g = gid != NULL && !is_bat_nil(*gid) ? BATdescriptor(*gid) : NULL;
     694         145 :         e = eid != NULL && !is_bat_nil(*eid) ? BATdescriptor(*eid) : NULL;
     695         145 :         s = sid != NULL && !is_bat_nil(*sid) ? BATdescriptor(*sid) : NULL;
     696             : 
     697         145 :         if (b == NULL ||
     698         145 :                 (gid != NULL && !is_bat_nil(*gid) && g == NULL) ||
     699         145 :                 (eid != NULL && !is_bat_nil(*eid) && e == NULL) ||
     700         145 :                 (sid != NULL && !is_bat_nil(*sid) && s == NULL)) {
     701           0 :                 BBPreclaim(b);
     702           0 :                 BBPreclaim(g);
     703           0 :                 BBPreclaim(e);
     704           0 :                 BBPreclaim(s);
     705           0 :                 throw(MAL, "aggr.subavg", SQLSTATE(HY002) RUNTIME_OBJECT_MISSING);
     706             :         }
     707             : 
     708         145 :         rc = BATgroupavg3(&avgs, &rems, &cnts, b, g, e, s, *skip_nils);
     709             : 
     710         145 :         BBPunfix(b->batCacheid);
     711         145 :         BBPreclaim(g);
     712         145 :         BBPreclaim(e);
     713         145 :         BBPreclaim(s);
     714         145 :         if (rc != GDK_SUCCEED)
     715           0 :                 throw(MAL, "aggr.subavg", GDK_EXCEPTION);
     716         145 :         *retval1 = avgs->batCacheid;
     717         145 :         BBPkeepref(avgs);
     718         145 :         *retval2 = rems->batCacheid;
     719         145 :         BBPkeepref(rems);
     720         145 :         *retval3 = cnts->batCacheid;
     721         145 :         BBPkeepref(cnts);
     722         145 :         return MAL_SUCCEED;
     723             : }
     724             : 
     725             : static str
     726          19 : AGGRavg3comb(bat *retval1, const bat *bid, const bat *rid, const bat *cid,
     727             :                          const bat *gid, const bat *eid, const bit *skip_nils)
     728             : {
     729          19 :         BAT *b, *r, *c, *g, *e, *bn;
     730             : 
     731          19 :         b = BATdescriptor(*bid);
     732          19 :         r = BATdescriptor(*rid);
     733          19 :         c = BATdescriptor(*cid);
     734          19 :         g = gid != NULL && !is_bat_nil(*gid) ? BATdescriptor(*gid) : NULL;
     735          19 :         e = eid != NULL && !is_bat_nil(*eid) ? BATdescriptor(*eid) : NULL;
     736             : 
     737          19 :         if (b == NULL ||
     738          19 :                 r == NULL ||
     739          19 :                 c == NULL ||
     740          19 :                 (gid != NULL && !is_bat_nil(*gid) && g == NULL) ||
     741          19 :                 (eid != NULL && !is_bat_nil(*eid) && e == NULL)) {
     742           0 :                 BBPreclaim(b);
     743           0 :                 BBPreclaim(r);
     744           0 :                 BBPreclaim(c);
     745           0 :                 BBPreclaim(g);
     746           0 :                 BBPreclaim(e);
     747           0 :                 throw(MAL, "aggr.subavg", SQLSTATE(HY002) RUNTIME_OBJECT_MISSING);
     748             :         }
     749             : 
     750          19 :         bn = BATgroupavg3combine(b, r, c, g, e, *skip_nils);
     751             : 
     752          19 :         BBPunfix(b->batCacheid);
     753          19 :         BBPunfix(r->batCacheid);
     754          19 :         BBPunfix(c->batCacheid);
     755          19 :         BBPreclaim(g);
     756          19 :         BBPreclaim(e);
     757          19 :         if (bn == NULL)
     758           0 :                 throw(MAL, "aggr.subavg", GDK_EXCEPTION);
     759          19 :         *retval1 = bn->batCacheid;
     760          19 :         BBPkeepref(bn);
     761          19 :         return MAL_SUCCEED;
     762             : }
     763             : 
     764             : static str
     765           7 : AGGRsubstdev_dbl(bat *retval, const bat *bid, const bat *gid, const bat *eid,
     766             :                                  const bit *skip_nils)
     767             : {
     768           7 :         return AGGRgrouped(retval, NULL, bid, gid, eid, NULL, *skip_nils,
     769             :                                            0, TYPE_dbl, BATgroupstdev_sample,
     770             :                                            NULL, NULL, NULL, "aggr.substdev");
     771             : }
     772             : 
     773             : static str
     774           0 : AGGRsubstdevcand_dbl(bat *retval, const bat *bid, const bat *gid,
     775             :                                          const bat *eid, const bat *sid, const bit *skip_nils)
     776             : {
     777           0 :         return AGGRgrouped(retval, NULL, bid, gid, eid, sid, *skip_nils,
     778             :                                            0, TYPE_dbl, BATgroupstdev_sample,
     779             :                                            NULL, NULL, NULL, "aggr.substdev");
     780             : }
     781             : 
     782             : static str
     783           5 : AGGRsubstdevp_dbl(bat *retval, const bat *bid, const bat *gid, const bat *eid,
     784             :                                   const bit *skip_nils)
     785             : {
     786           5 :         return AGGRgrouped(retval, NULL, bid, gid, eid, NULL, *skip_nils,
     787             :                                            0, TYPE_dbl,
     788             :                                            BATgroupstdev_population, NULL, NULL, NULL,
     789             :                                            "aggr.substdevp");
     790             : }
     791             : 
     792             : static str
     793           0 : AGGRsubstdevpcand_dbl(bat *retval, const bat *bid, const bat *gid,
     794             :                                           const bat *eid, const bat *sid, const bit *skip_nils)
     795             : {
     796           0 :         return AGGRgrouped(retval, NULL, bid, gid, eid, sid, *skip_nils,
     797             :                                            0, TYPE_dbl,
     798             :                                            BATgroupstdev_population,
     799             :                                            NULL, NULL, NULL, "aggr.substdevp");
     800             : }
     801             : 
     802             : static str
     803           1 : AGGRsubvariance_dbl(bat *retval, const bat *bid, const bat *gid, const bat *eid,
     804             :                                         const bit *skip_nils)
     805             : {
     806           1 :         return AGGRgrouped(retval, NULL, bid, gid, eid, NULL, *skip_nils,
     807             :                                            0, TYPE_dbl, BATgroupvariance_sample,
     808             :                                            NULL, NULL, NULL, "aggr.subvariance");
     809             : }
     810             : 
     811             : static str
     812           0 : AGGRsubvariancecand_dbl(bat *retval, const bat *bid, const bat *gid,
     813             :                                                 const bat *eid, const bat *sid, const bit *skip_nils)
     814             : {
     815           0 :         return AGGRgrouped(retval, NULL, bid, gid, eid, sid, *skip_nils,
     816             :                                            0, TYPE_dbl, BATgroupvariance_sample,
     817             :                                            NULL, NULL, NULL, "aggr.subvariance");
     818             : }
     819             : 
     820             : static str
     821           4 : AGGRsubvariancep_dbl(bat *retval, const bat *bid, const bat *gid,
     822             :                                          const bat *eid, const bit *skip_nils)
     823             : {
     824           4 :         return AGGRgrouped(retval, NULL, bid, gid, eid, NULL, *skip_nils,
     825             :                                            0, TYPE_dbl,
     826             :                                            BATgroupvariance_population, NULL,
     827             :                                            NULL, NULL, "aggr.subvariancep");
     828             : }
     829             : 
     830             : static str
     831           0 : AGGRsubvariancepcand_dbl(bat *retval, const bat *bid, const bat *gid,
     832             :                                                  const bat *eid, const bat *sid, const bit *skip_nils)
     833             : {
     834           0 :         return AGGRgrouped(retval, NULL, bid, gid, eid, sid, *skip_nils,
     835             :                                            0, TYPE_dbl,
     836             :                                            BATgroupvariance_population, NULL,
     837             :                                            NULL, NULL, "aggr.subvariancep");
     838             : }
     839             : 
     840             : static str
     841       13530 : AGGRsubcount(bat *retval, const bat *bid, const bat *gid, const bat *eid,
     842             :                          const bit *skip_nils)
     843             : {
     844       13530 :         return AGGRgrouped(retval, NULL, bid, gid, eid, NULL, *skip_nils,
     845             :                                            0, TYPE_lng, BATgroupcount, NULL, NULL,
     846             :                                            NULL, "aggr.subcount");
     847             : }
     848             : 
     849             : static str
     850           0 : AGGRsubcountcand(bat *retval, const bat *bid, const bat *gid, const bat *eid,
     851             :                                  const bat *sid, const bit *skip_nils)
     852             : {
     853           0 :         return AGGRgrouped(retval, NULL, bid, gid, eid, sid, *skip_nils,
     854             :                                            0, TYPE_lng, BATgroupcount, NULL,
     855             :                                            NULL, NULL, "aggr.subcount");
     856             : }
     857             : 
     858             : static str
     859           0 : AGGRsubmin(bat *retval, const bat *bid, const bat *gid, const bat *eid,
     860             :                    const bit *skip_nils)
     861             : {
     862           0 :         return AGGRgrouped(retval, NULL, bid, gid, eid, NULL, *skip_nils,
     863             :                                            0, TYPE_oid, BATgroupmin, NULL,
     864             :                                            NULL, NULL, "aggr.submin");
     865             : }
     866             : 
     867             : static str
     868           0 : AGGRsubmincand(bat *retval, const bat *bid, const bat *gid, const bat *eid,
     869             :                            const bat *sid, const bit *skip_nils)
     870             : {
     871           0 :         return AGGRgrouped(retval, NULL, bid, gid, eid, sid, *skip_nils,
     872             :                                            0, TYPE_oid, BATgroupmin, NULL,
     873             :                                            NULL, NULL, "aggr.submin");
     874             : }
     875             : 
     876             : static str
     877           0 : AGGRsubmax(bat *retval, const bat *bid, const bat *gid, const bat *eid,
     878             :                    const bit *skip_nils)
     879             : {
     880           0 :         return AGGRgrouped(retval, NULL, bid, gid, eid, NULL, *skip_nils,
     881             :                                            0, TYPE_oid, BATgroupmax, NULL,
     882             :                                            NULL, NULL, "aggr.submax");
     883             : }
     884             : 
     885             : static str
     886           0 : AGGRsubmaxcand(bat *retval, const bat *bid, const bat *gid, const bat *eid,
     887             :                            const bat *sid, const bit *skip_nils)
     888             : {
     889           0 :         return AGGRgrouped(retval, NULL, bid, gid, eid, sid, *skip_nils,
     890             :                                            0, TYPE_oid, BATgroupmax, NULL,
     891             :                                            NULL, NULL, "aggr.submax");
     892             : }
     893             : 
     894             : static str
     895         428 : AGGRsubmincand_val(bat *retval, const bat *bid, const bat *gid, const bat *eid,
     896             :                                    const bat *sid, const bit *skip_nils)
     897             : {
     898         428 :         bat tmpid;
     899         428 :         str err;
     900             : 
     901         428 :         err = AGGRgrouped(&tmpid, NULL, bid, gid, eid, sid, *skip_nils,
     902             :                                           0, TYPE_oid, BATgroupmin, NULL, NULL, NULL,
     903             :                                           "aggr.submin");
     904         428 :         if (err == MAL_SUCCEED) {
     905         428 :                 err = ALGprojection(retval, &tmpid, bid);
     906         428 :                 BBPrelease(tmpid);
     907             :         }
     908         428 :         return err;
     909             : }
     910             : 
     911             : static str
     912         428 : AGGRsubmin_val(bat *retval, const bat *bid, const bat *gid, const bat *eid,
     913             :                            const bit *skip_nils)
     914             : {
     915         428 :         return AGGRsubmincand_val(retval, bid, gid, eid, NULL, skip_nils);
     916             : }
     917             : 
     918             : static str
     919         549 : AGGRsubmaxcand_val(bat *retval, const bat *bid, const bat *gid, const bat *eid,
     920             :                                    const bat *sid, const bit *skip_nils)
     921             : {
     922         549 :         bat tmpid;
     923         549 :         str err;
     924             : 
     925         549 :         err = AGGRgrouped(&tmpid, NULL, bid, gid, eid, sid, *skip_nils,
     926             :                                           0, TYPE_oid, BATgroupmax, NULL, NULL, NULL,
     927             :                                           "aggr.submax");
     928         548 :         if (err == MAL_SUCCEED) {
     929         548 :                 err = ALGprojection(retval, &tmpid, bid);
     930         549 :                 BBPrelease(tmpid);
     931             :         }
     932         549 :         return err;
     933             : }
     934             : 
     935             : static str
     936         549 : AGGRsubmax_val(bat *retval, const bat *bid, const bat *gid, const bat *eid,
     937             :                            const bit *skip_nils)
     938             : {
     939         549 :         return AGGRsubmaxcand_val(retval, bid, gid, eid, NULL, skip_nils);
     940             : }
     941             : 
     942             : static str
     943          22 : AGGRmedian(void *retval, const bat *bid)
     944             : {
     945          22 :         str err;
     946          22 :         bat rval;
     947          22 :         if ((err = AGGRgrouped(&rval, NULL, bid, NULL, NULL, NULL, true,
     948             :                                                    0, TYPE_any, BATgroupmedian, NULL,
     949             :                                                    NULL, NULL, "aggr.submedian")) == MAL_SUCCEED) {
     950          22 :                 oid pos = 0;
     951          22 :                 err = ALGfetchoid(retval, &rval, &pos);
     952          22 :                 BBPrelease(rval);
     953             :         }
     954          22 :         return err;
     955             : }
     956             : 
     957             : static str
     958           7 : AGGRsubmedian(bat *retval, const bat *bid, const bat *gid, const bat *eid,
     959             :                           const bit *skip_nils)
     960             : {
     961           7 :         return AGGRgrouped(retval, NULL, bid, gid, eid, NULL, *skip_nils,
     962             :                                            0, TYPE_any, BATgroupmedian, NULL,
     963             :                                            NULL, NULL, "aggr.submedian");
     964             : }
     965             : 
     966             : static str
     967           0 : AGGRsubmediancand(bat *retval, const bat *bid, const bat *gid, const bat *eid,
     968             :                                   const bat *sid, const bit *skip_nils)
     969             : {
     970           0 :         return AGGRgrouped(retval, NULL, bid, gid, eid, sid, *skip_nils,
     971             :                                            0, TYPE_any, BATgroupmedian, NULL,
     972             :                                            NULL, NULL, "aggr.submedian");
     973             : }
     974             : 
     975             : /* quantile functions, could make median functions obsolete completely */
     976             : static str
     977           8 : AGGRquantile(void *retval, const bat *bid, const bat *qid)
     978             : {
     979           8 :         str err;
     980           8 :         bat rval;
     981           8 :         if ((err = AGGRgrouped(&rval, NULL, bid, NULL, NULL, NULL, true,
     982             :                                                    0, TYPE_any, NULL, NULL, BATgroupquantile,
     983             :                                                    qid, "aggr.subquantile")) == MAL_SUCCEED) {
     984           6 :                 oid pos = 0;
     985           6 :                 err = ALGfetchoid(retval, &rval, &pos);
     986           6 :                 BBPrelease(rval);
     987             :         }
     988           8 :         return err;
     989             : }
     990             : 
     991             : static str
     992          16 : AGGRquantile_cst(void *retval, const bat *bid, const dbl *q)
     993             : {
     994          16 :         str err;
     995          16 :         bat rval;
     996          16 :         if ((err = AGGRgrouped_bat_or_val(&rval, NULL, bid, NULL, NULL, NULL, true,
     997             :                                                                           0, TYPE_any, NULL, NULL, BATgroupquantile,
     998             :                                                                           NULL, q,
     999             :                                                                           "aggr.subquantile")) == MAL_SUCCEED) {
    1000          14 :                 oid pos = 0;
    1001          14 :                 err = ALGfetchoid(retval, &rval, &pos);
    1002          14 :                 BBPrelease(rval);
    1003             :         }
    1004          16 :         return err;
    1005             : }
    1006             : 
    1007             : static str
    1008          13 : AGGRsubquantile(bat *retval, const bat *bid, const bat *quantile,
    1009             :                                 const bat *gid, const bat *eid, const bit *skip_nils)
    1010             : {
    1011          13 :         return AGGRgrouped(retval, NULL, bid, gid, eid, NULL, *skip_nils,
    1012             :                                            0, TYPE_any, NULL, NULL, BATgroupquantile,
    1013             :                                            quantile, "aggr.subquantile");
    1014             : }
    1015             : 
    1016             : static str
    1017           0 : AGGRsubquantilecand(bat *retval, const bat *bid, const bat *quantile,
    1018             :                                         const bat *gid, const bat *eid, const bat *sid,
    1019             :                                         const bit *skip_nils)
    1020             : {
    1021           0 :         return AGGRgrouped(retval, NULL, bid, gid, eid, sid, *skip_nils,
    1022             :                                            0, TYPE_any, NULL, NULL, BATgroupquantile,
    1023             :                                            quantile, "aggr.subquantile");
    1024             : }
    1025             : 
    1026             : static str
    1027           2 : AGGRmedian_avg(dbl *retval, const bat *bid)
    1028             : {
    1029           2 :         str err;
    1030           2 :         bat rval;
    1031           2 :         if ((err = AGGRgrouped(&rval, NULL, bid, NULL, NULL, NULL, true,
    1032             :                                                    0, TYPE_any, BATgroupmedian_avg, NULL,
    1033             :                                                    NULL, NULL, "aggr.submedian_avg")) == MAL_SUCCEED) {
    1034           2 :                 oid pos = 0;
    1035           2 :                 err = ALGfetchoid(retval, &rval, &pos);
    1036           2 :                 BBPrelease(rval);
    1037             :         }
    1038           2 :         return err;
    1039             : }
    1040             : 
    1041             : static str
    1042           1 : AGGRsubmedian_avg(bat *retval, const bat *bid, const bat *gid, const bat *eid,
    1043             :                                   const bit *skip_nils)
    1044             : {
    1045           1 :         return AGGRgrouped(retval, NULL, bid, gid, eid, NULL, *skip_nils,
    1046             :                                            0, TYPE_any, BATgroupmedian_avg, NULL,
    1047             :                                            NULL, NULL, "aggr.submedian_avg");
    1048             : }
    1049             : 
    1050             : static str
    1051           0 : AGGRsubmediancand_avg(bat *retval, const bat *bid, const bat *gid,
    1052             :                                           const bat *eid, const bat *sid, const bit *skip_nils)
    1053             : {
    1054           0 :         return AGGRgrouped(retval, NULL, bid, gid, eid, sid, *skip_nils,
    1055             :                                            0, TYPE_any, BATgroupmedian_avg, NULL,
    1056             :                                            NULL, NULL, "aggr.submedian_avg");
    1057             : }
    1058             : 
    1059             : /* quantile functions, could make median functions obsolete completely */
    1060             : static str
    1061           0 : AGGRquantile_avg(dbl *retval, const bat *bid, const bat *qid)
    1062             : {
    1063           0 :         str err;
    1064           0 :         bat rval;
    1065           0 :         if ((err = AGGRgrouped(&rval, NULL, bid, NULL, NULL, NULL, true,
    1066             :                                                    0, TYPE_any, NULL, NULL, BATgroupquantile_avg,
    1067             :                                                    qid, "aggr.subquantile_avg")) == MAL_SUCCEED) {
    1068           0 :                 oid pos = 0;
    1069           0 :                 err = ALGfetchoid(retval, &rval, &pos);
    1070           0 :                 BBPrelease(rval);
    1071             :         }
    1072           0 :         return err;
    1073             : }
    1074             : 
    1075             : static str
    1076           2 : AGGRquantile_avg_cst(dbl *retval, const bat *bid, const dbl *q)
    1077             : {
    1078           2 :         str err;
    1079           2 :         bat rval;
    1080           2 :         if ((err = AGGRgrouped_bat_or_val(&rval, NULL, bid, NULL, NULL, NULL, true,
    1081             :                                                                           0, TYPE_any, NULL, NULL,
    1082             :                                                                           BATgroupquantile_avg, NULL, q,
    1083             :                                                                           "aggr.subquantile_avg")) == MAL_SUCCEED) {
    1084           2 :                 oid pos = 0;
    1085           2 :                 err = ALGfetchoid(retval, &rval, &pos);
    1086           2 :                 BBPrelease(rval);
    1087             :         }
    1088           2 :         return err;
    1089             : }
    1090             : 
    1091             : static str
    1092           1 : AGGRsubquantile_avg(bat *retval, const bat *bid, const bat *quantile,
    1093             :                                         const bat *gid, const bat *eid, const bit *skip_nils)
    1094             : {
    1095           1 :         return AGGRgrouped(retval, NULL, bid, gid, eid, NULL, *skip_nils,
    1096             :                                            0, TYPE_any, NULL, NULL, BATgroupquantile_avg,
    1097             :                                            quantile, "aggr.subquantile_avg");
    1098             : }
    1099             : 
    1100             : static str
    1101           0 : AGGRsubquantilecand_avg(bat *retval, const bat *bid, const bat *quantile,
    1102             :                                                 const bat *gid, const bat *eid, const bat *sid,
    1103             :                                                 const bit *skip_nils)
    1104             : {
    1105           0 :         return AGGRgrouped(retval, NULL, bid, gid, eid, sid, *skip_nils,
    1106             :                                            0, TYPE_any, NULL, NULL, BATgroupquantile_avg,
    1107             :                                            quantile, "aggr.subquantile_avg");
    1108             : }
    1109             : 
    1110             : static str
    1111          54 : AGGRgroup_str_concat(bat *retval1, const bat *bid, const bat *gid,
    1112             :                                          const bat *eid, const bat *sid, bool skip_nils,
    1113             :                                          const bat *sepid, const char *separator,
    1114             :                                          const char *malfunc)
    1115             : {
    1116          54 :         BAT *b, *g, *e, *s, *sep, *bn = NULL;
    1117             : 
    1118          54 :         b = BATdescriptor(*bid);
    1119          54 :         g = gid ? BATdescriptor(*gid) : NULL;
    1120          54 :         e = eid ? BATdescriptor(*eid) : NULL;
    1121          54 :         s = sid ? BATdescriptor(*sid) : NULL;
    1122          54 :         sep = sepid ? BATdescriptor(*sepid) : NULL;
    1123             : 
    1124          54 :         if (b == NULL || (gid != NULL && g == NULL) || (eid != NULL && e == NULL) ||
    1125          54 :                 (sid != NULL && s == NULL) || (sepid != NULL && sep == NULL)) {
    1126           0 :                 BBPreclaim(b);
    1127           0 :                 BBPreclaim(g);
    1128           0 :                 BBPreclaim(e);
    1129           0 :                 BBPreclaim(s);
    1130           0 :                 BBPreclaim(sep);
    1131           0 :                 throw(MAL, malfunc, SQLSTATE(HY002) RUNTIME_OBJECT_MISSING);
    1132             :         }
    1133             : 
    1134          54 :         bn = BATgroupstr_group_concat(b, g, e, s, sep, skip_nils, separator);
    1135             : 
    1136          54 :         BBPunfix(b->batCacheid);
    1137          54 :         BBPreclaim(g);
    1138          54 :         BBPreclaim(e);
    1139          54 :         BBPreclaim(s);
    1140          54 :         BBPreclaim(sep);
    1141          54 :         if (bn == NULL)
    1142           0 :                 throw(MAL, malfunc, GDK_EXCEPTION);
    1143          54 :         *retval1 = bn->batCacheid;
    1144          54 :         BBPkeepref(bn);
    1145          54 :         return MAL_SUCCEED;
    1146             : }
    1147             : 
    1148             : #define DEFAULT_SEPARATOR ","
    1149             : 
    1150             : static str
    1151           0 : AGGRstr_group_concat(bat *retval, const bat *bid, const bat *gid,
    1152             :                                          const bat *eid)
    1153             : {
    1154           0 :         return AGGRgroup_str_concat(retval, bid, gid, eid, NULL, true, NULL,
    1155             :                                                                 DEFAULT_SEPARATOR, "aggr.str_group_concat");
    1156             : }
    1157             : 
    1158             : static str
    1159          20 : AGGRsubstr_group_concat(bat *retval, const bat *bid, const bat *gid,
    1160             :                                                 const bat *eid, const bit *skip_nils)
    1161             : {
    1162          20 :         return AGGRgroup_str_concat(retval, bid, gid, eid, NULL, *skip_nils, NULL,
    1163             :                                                                 DEFAULT_SEPARATOR, "aggr.substr_group_concat");
    1164             : }
    1165             : 
    1166             : static str
    1167           0 : AGGRsubstr_group_concatcand(bat *retval, const bat *bid, const bat *gid,
    1168             :                                                         const bat *eid, const bat *sid,
    1169             :                                                         const bit *skip_nils)
    1170             : {
    1171           0 :         return AGGRgroup_str_concat(retval, bid, gid, eid, sid, *skip_nils, NULL,
    1172             :                                                                 DEFAULT_SEPARATOR, "aggr.substr_group_concat");
    1173             : }
    1174             : 
    1175             : static str
    1176           0 : AGGRstr_group_concat_sep(bat *retval, const bat *bid, const bat *sep,
    1177             :                                                  const bat *gid, const bat *eid)
    1178             : {
    1179           0 :         return AGGRgroup_str_concat(retval, bid, gid, eid, NULL, true, sep, NULL,
    1180           0 :                                                                 "aggr.str_group_concat_sep");;
    1181             : }
    1182             : 
    1183             : static str
    1184          34 : AGGRsubstr_group_concat_sep(bat *retval, const bat *bid, const bat *sep,
    1185             :                                                         const bat *gid, const bat *eid,
    1186             :                                                         const bit *skip_nils)
    1187             : {
    1188          34 :         return AGGRgroup_str_concat(retval, bid, gid, eid, NULL, *skip_nils, sep,
    1189             :                                                                 NULL, "aggr.substr_group_concat_sep");
    1190             : }
    1191             : 
    1192             : static str
    1193           0 : AGGRsubstr_group_concatcand_sep(bat *retval, const bat *bid, const bat *sep,
    1194             :                                                                 const bat *gid, const bat *eid, const bat *sid,
    1195             :                                                                 const bit *skip_nils)
    1196             : {
    1197           0 :         return AGGRgroup_str_concat(retval, bid, gid, eid, sid, *skip_nils, sep,
    1198             :                                                                 NULL, "aggr.substr_group_concat_sep");
    1199             : }
    1200             : 
    1201             : static str
    1202         109 : AGGRgrouped2(bat *retval, const bat *bid1, const bat *bid2, const bat *gid,
    1203             :                          const bat *eid, const bat *sid, bool skip_nils, int tp,
    1204             :                          BAT *(*func)(BAT *, BAT *, BAT *, BAT *, BAT *, int tp,
    1205             :                                                   bool skip_nils), const char *malfunc)
    1206             : {
    1207         109 :         BAT *b1, *b2, *g, *e, *s, *bn = NULL;
    1208             : 
    1209         109 :         assert(func != NULL);
    1210             : 
    1211         109 :         b1 = BATdescriptor(*bid1);
    1212         109 :         b2 = BATdescriptor(*bid2);
    1213         109 :         g = gid ? BATdescriptor(*gid) : NULL;
    1214         109 :         e = eid ? BATdescriptor(*eid) : NULL;
    1215         109 :         s = sid ? BATdescriptor(*sid) : NULL;
    1216             : 
    1217         109 :         if (b1 == NULL || b2 == NULL || (gid != NULL && g == NULL)
    1218         109 :                 || (eid != NULL && e == NULL) || (sid != NULL && s == NULL)) {
    1219           0 :                 BBPreclaim(b1);
    1220           0 :                 BBPreclaim(b2);
    1221           0 :                 BBPreclaim(g);
    1222           0 :                 BBPreclaim(e);
    1223           0 :                 BBPreclaim(s);
    1224           0 :                 throw(MAL, malfunc, SQLSTATE(HY002) RUNTIME_OBJECT_MISSING);
    1225             :         }
    1226             : 
    1227         109 :         if (b1->ttype != b2->ttype) {
    1228           0 :                 BBPunfix(b1->batCacheid);
    1229           0 :                 BBPunfix(b2->batCacheid);
    1230           0 :                 BBPreclaim(g);
    1231           0 :                 BBPreclaim(e);
    1232           0 :                 BBPreclaim(s);
    1233           0 :                 throw(MAL, malfunc,
    1234             :                           SQLSTATE(42000) "%s requires both arguments of the same type",
    1235             :                           malfunc);
    1236             :         }
    1237             : 
    1238         109 :         bn = (*func) (b1, b2, g, e, s, tp, skip_nils);
    1239             : 
    1240         109 :         BBPunfix(b1->batCacheid);
    1241         109 :         BBPunfix(b2->batCacheid);
    1242         109 :         BBPreclaim(g);
    1243         109 :         BBPreclaim(e);
    1244         109 :         BBPreclaim(s);
    1245         109 :         if (bn == NULL)
    1246           1 :                 throw(MAL, malfunc, GDK_EXCEPTION);
    1247         108 :         *retval = bn->batCacheid;
    1248         108 :         BBPkeepref(bn);
    1249         108 :         return MAL_SUCCEED;
    1250             : }
    1251             : 
    1252             : static str
    1253           0 : AGGRcovariance(bat *retval, const bat *b1, const bat *b2, const bat *gid,
    1254             :                            const bat *eid)
    1255             : {
    1256           0 :         return AGGRgrouped2(retval, b1, b2, gid, eid, NULL, true, TYPE_dbl,
    1257             :                                                 BATgroupcovariance_sample, "aggr.covariance");
    1258             : }
    1259             : 
    1260             : static str
    1261          30 : AGGRsubcovariance(bat *retval, const bat *b1, const bat *b2, const bat *gid,
    1262             :                                   const bat *eid, const bit *skip_nils)
    1263             : {
    1264          30 :         return AGGRgrouped2(retval, b1, b2, gid, eid, NULL, *skip_nils, TYPE_dbl,
    1265             :                                                 BATgroupcovariance_sample, "aggr.subcovariance");
    1266             : }
    1267             : 
    1268             : static str
    1269           0 : AGGRsubcovariancecand(bat *retval, const bat *b1, const bat *b2, const bat *gid,
    1270             :                                           const bat *eid, const bat *sid, const bit *skip_nils)
    1271             : {
    1272           0 :         return AGGRgrouped2(retval, b1, b2, gid, eid, sid, *skip_nils, TYPE_dbl,
    1273             :                                                 BATgroupcovariance_sample, "aggr.subcovariance");
    1274             : }
    1275             : 
    1276             : static str
    1277           0 : AGGRcovariancep(bat *retval, const bat *b1, const bat *b2, const bat *gid,
    1278             :                                 const bat *eid)
    1279             : {
    1280           0 :         return AGGRgrouped2(retval, b1, b2, gid, eid, NULL, true, TYPE_dbl,
    1281             :                                                 BATgroupcovariance_population, "aggr.covariancep");
    1282             : }
    1283             : 
    1284             : static str
    1285          30 : AGGRsubcovariancep(bat *retval, const bat *b1, const bat *b2, const bat *gid,
    1286             :                                    const bat *eid, const bit *skip_nils)
    1287             : {
    1288          30 :         return AGGRgrouped2(retval, b1, b2, gid, eid, NULL, *skip_nils, TYPE_dbl,
    1289             :                                                 BATgroupcovariance_population, "aggr.subcovariancep");
    1290             : }
    1291             : 
    1292             : static str
    1293           0 : AGGRsubcovariancepcand(bat *retval, const bat *b1, const bat *b2,
    1294             :                                            const bat *gid, const bat *eid, const bat *sid,
    1295             :                                            const bit *skip_nils)
    1296             : {
    1297           0 :         return AGGRgrouped2(retval, b1, b2, gid, eid, sid, *skip_nils, TYPE_dbl,
    1298             :                                                 BATgroupcovariance_population, "aggr.subcovariancep");
    1299             : }
    1300             : 
    1301             : static str
    1302           0 : AGGRcorr(bat *retval, const bat *b1, const bat *b2, const bat *gid,
    1303             :                  const bat *eid)
    1304             : {
    1305           0 :         return AGGRgrouped2(retval, b1, b2, gid, eid, NULL, true, TYPE_dbl,
    1306             :                                                 BATgroupcorrelation, "aggr.corr");
    1307             : }
    1308             : 
    1309             : static str
    1310          49 : AGGRsubcorr(bat *retval, const bat *b1, const bat *b2, const bat *gid,
    1311             :                         const bat *eid, const bit *skip_nils)
    1312             : {
    1313          49 :         return AGGRgrouped2(retval, b1, b2, gid, eid, NULL, *skip_nils, TYPE_dbl,
    1314             :                                                 BATgroupcorrelation, "aggr.subcorr");
    1315             : }
    1316             : 
    1317             : static str
    1318           0 : AGGRsubcorrcand(bat *retval, const bat *b1, const bat *b2, const bat *gid,
    1319             :                                 const bat *eid, const bat *sid, const bit *skip_nils)
    1320             : {
    1321           0 :         return AGGRgrouped2(retval, b1, b2, gid, eid, sid, *skip_nils, TYPE_dbl,
    1322             :                                                 BATgroupcorrelation, "aggr.subcorr");
    1323             : }
    1324             : 
    1325             : #include "mel.h"
    1326             : mel_func aggr_init_funcs[] = {
    1327             :  command("aggr", "sum", AGGRsum3_dbl, false, "Grouped tail sum on bte", args(1,4, batarg("",dbl),batarg("b",bte),batarg("g",oid),batargany("e",1))),
    1328             :  command("aggr", "sum", AGGRsum3_bte, false, "Grouped tail sum on bte", args(1,4, batarg("",bte),batarg("b",bte),batarg("g",oid),batargany("e",1))),
    1329             :  command("aggr", "subsum", AGGRsubsum_bte, false, "Grouped sum aggregate", args(1,5, batarg("",bte),batarg("b",bte),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1330             :  command("aggr", "subsum", AGGRsubsumcand_bte, false, "Grouped sum aggregate with candidates list", args(1,6, batarg("",bte),batarg("b",bte),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1331             :  command("aggr", "prod", AGGRprod3_bte, false, "Grouped tail product on bte", args(1,4, batarg("",bte),batarg("b",bte),batarg("g",oid),batargany("e",1))),
    1332             :  command("aggr", "subprod", AGGRsubprod_bte, false, "Grouped product aggregate", args(1,5, batarg("",bte),batarg("b",bte),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1333             :  command("aggr", "subprod", AGGRsubprodcand_bte, false, "Grouped product aggregate with candidates list", args(1,6, batarg("",bte),batarg("b",bte),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1334             :  command("aggr", "sum", AGGRsum3_sht, false, "Grouped tail sum on bte", args(1,4, batarg("",sht),batarg("b",bte),batarg("g",oid),batargany("e",1))),
    1335             :  command("aggr", "subsum", AGGRsubsum_sht, false, "Grouped sum aggregate", args(1,5, batarg("",sht),batarg("b",bte),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1336             :  command("aggr", "subsum", AGGRsubsumcand_sht, false, "Grouped sum aggregate with candidates list", args(1,6, batarg("",sht),batarg("b",bte),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1337             :  command("aggr", "prod", AGGRprod3_sht, false, "Grouped tail product on bte", args(1,4, batarg("",sht),batarg("b",bte),batarg("g",oid),batargany("e",1))),
    1338             :  command("aggr", "subprod", AGGRsubprod_sht, false, "Grouped product aggregate", args(1,5, batarg("",sht),batarg("b",bte),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1339             :  command("aggr", "subprod", AGGRsubprodcand_sht, false, "Grouped product aggregate with candidates list", args(1,6, batarg("",sht),batarg("b",bte),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1340             :  command("aggr", "sum", AGGRsum3_int, false, "Grouped tail sum on bte", args(1,4, batarg("",int),batarg("b",bte),batarg("g",oid),batargany("e",1))),
    1341             :  command("aggr", "subsum", AGGRsubsum_int, false, "Grouped sum aggregate", args(1,5, batarg("",int),batarg("b",bte),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1342             :  command("aggr", "subsum", AGGRsubsumcand_int, false, "Grouped sum aggregate with candidates list", args(1,6, batarg("",int),batarg("b",bte),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1343             :  command("aggr", "prod", AGGRprod3_int, false, "Grouped tail product on bte", args(1,4, batarg("",int),batarg("b",bte),batarg("g",oid),batargany("e",1))),
    1344             :  command("aggr", "subprod", AGGRsubprod_int, false, "Grouped product aggregate", args(1,5, batarg("",int),batarg("b",bte),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1345             :  command("aggr", "subprod", AGGRsubprodcand_int, false, "Grouped product aggregate with candidates list", args(1,6, batarg("",int),batarg("b",bte),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1346             :  command("aggr", "sum", AGGRsum3_lng, false, "Grouped tail sum on bte", args(1,4, batarg("",lng),batarg("b",bte),batarg("g",oid),batargany("e",1))),
    1347             :  command("aggr", "subsum", AGGRsubsum_lng, false, "Grouped sum aggregate", args(1,5, batarg("",lng),batarg("b",bte),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1348             :  command("aggr", "subsum", AGGRsubsumcand_lng, false, "Grouped sum aggregate with candidates list", args(1,6, batarg("",lng),batarg("b",bte),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1349             :  command("aggr", "prod", AGGRprod3_lng, false, "Grouped tail product on bte", args(1,4, batarg("",lng),batarg("b",bte),batarg("g",oid),batargany("e",1))),
    1350             :  command("aggr", "subprod", AGGRsubprod_lng, false, "Grouped product aggregate", args(1,5, batarg("",lng),batarg("b",bte),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1351             :  command("aggr", "subprod", AGGRsubprodcand_lng, false, "Grouped product aggregate with candidates list", args(1,6, batarg("",lng),batarg("b",bte),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1352             :  command("aggr", "sum", AGGRsum3_dbl, false, "Grouped tail sum on sht", args(1,4, batarg("",dbl),batarg("b",sht),batarg("g",oid),batargany("e",1))),
    1353             :  command("aggr", "sum", AGGRsum3_sht, false, "Grouped tail sum on sht", args(1,4, batarg("",sht),batarg("b",sht),batarg("g",oid),batargany("e",1))),
    1354             :  command("aggr", "subsum", AGGRsubsum_sht, false, "Grouped sum aggregate", args(1,5, batarg("",sht),batarg("b",sht),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1355             :  command("aggr", "subsum", AGGRsubsumcand_sht, false, "Grouped sum aggregate with candidates list", args(1,6, batarg("",sht),batarg("b",sht),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1356             :  command("aggr", "prod", AGGRprod3_sht, false, "Grouped tail product on sht", args(1,4, batarg("",sht),batarg("b",sht),batarg("g",oid),batargany("e",1))),
    1357             :  command("aggr", "subprod", AGGRsubprod_sht, false, "Grouped product aggregate", args(1,5, batarg("",sht),batarg("b",sht),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1358             :  command("aggr", "subprod", AGGRsubprodcand_sht, false, "Grouped product aggregate with candidates list", args(1,6, batarg("",sht),batarg("b",sht),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1359             :  command("aggr", "sum", AGGRsum3_int, false, "Grouped tail sum on sht", args(1,4, batarg("",int),batarg("b",sht),batarg("g",oid),batargany("e",1))),
    1360             :  command("aggr", "subsum", AGGRsubsum_int, false, "Grouped sum aggregate", args(1,5, batarg("",int),batarg("b",sht),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1361             :  command("aggr", "subsum", AGGRsubsumcand_int, false, "Grouped sum aggregate with candidates list", args(1,6, batarg("",int),batarg("b",sht),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1362             :  command("aggr", "prod", AGGRprod3_int, false, "Grouped tail product on sht", args(1,4, batarg("",int),batarg("b",sht),batarg("g",oid),batargany("e",1))),
    1363             :  command("aggr", "subprod", AGGRsubprod_int, false, "Grouped product aggregate", args(1,5, batarg("",int),batarg("b",sht),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1364             :  command("aggr", "subprod", AGGRsubprodcand_int, false, "Grouped product aggregate with candidates list", args(1,6, batarg("",int),batarg("b",sht),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1365             :  command("aggr", "sum", AGGRsum3_lng, false, "Grouped tail sum on sht", args(1,4, batarg("",lng),batarg("b",sht),batarg("g",oid),batargany("e",1))),
    1366             :  command("aggr", "subsum", AGGRsubsum_lng, false, "Grouped sum aggregate", args(1,5, batarg("",lng),batarg("b",sht),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1367             :  command("aggr", "subsum", AGGRsubsumcand_lng, false, "Grouped sum aggregate with candidates list", args(1,6, batarg("",lng),batarg("b",sht),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1368             :  command("aggr", "prod", AGGRprod3_lng, false, "Grouped tail product on sht", args(1,4, batarg("",lng),batarg("b",sht),batarg("g",oid),batargany("e",1))),
    1369             :  command("aggr", "subprod", AGGRsubprod_lng, false, "Grouped product aggregate", args(1,5, batarg("",lng),batarg("b",sht),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1370             :  command("aggr", "subprod", AGGRsubprodcand_lng, false, "Grouped product aggregate with candidates list", args(1,6, batarg("",lng),batarg("b",sht),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1371             :  command("aggr", "sum", AGGRsum3_dbl, false, "Grouped tail sum on int", args(1,4, batarg("",dbl),batarg("b",int),batarg("g",oid),batargany("e",1))),
    1372             :  command("aggr", "sum", AGGRsum3_int, false, "Grouped tail sum on int", args(1,4, batarg("",int),batarg("b",int),batarg("g",oid),batargany("e",1))),
    1373             :  command("aggr", "subsum", AGGRsubsum_int, false, "Grouped sum aggregate", args(1,5, batarg("",int),batarg("b",int),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1374             :  command("aggr", "subsum", AGGRsubsumcand_int, false, "Grouped sum aggregate with candidates list", args(1,6, batarg("",int),batarg("b",int),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1375             :  command("aggr", "prod", AGGRprod3_int, false, "Grouped tail product on int", args(1,4, batarg("",int),batarg("b",int),batarg("g",oid),batargany("e",1))),
    1376             :  command("aggr", "subprod", AGGRsubprod_int, false, "Grouped product aggregate", args(1,5, batarg("",int),batarg("b",int),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1377             :  command("aggr", "subprod", AGGRsubprodcand_int, false, "Grouped product aggregate with candidates list", args(1,6, batarg("",int),batarg("b",int),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1378             :  command("aggr", "sum", AGGRsum3_lng, false, "Grouped tail sum on int", args(1,4, batarg("",lng),batarg("b",int),batarg("g",oid),batargany("e",1))),
    1379             :  command("aggr", "subsum", AGGRsubsum_lng, false, "Grouped sum aggregate", args(1,5, batarg("",lng),batarg("b",int),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1380             :  command("aggr", "subsum", AGGRsubsumcand_lng, false, "Grouped sum aggregate with candidates list", args(1,6, batarg("",lng),batarg("b",int),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1381             :  command("aggr", "prod", AGGRprod3_lng, false, "Grouped tail product on int", args(1,4, batarg("",lng),batarg("b",int),batarg("g",oid),batargany("e",1))),
    1382             :  command("aggr", "subprod", AGGRsubprod_lng, false, "Grouped product aggregate", args(1,5, batarg("",lng),batarg("b",int),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1383             :  command("aggr", "subprod", AGGRsubprodcand_lng, false, "Grouped product aggregate with candidates list", args(1,6, batarg("",lng),batarg("b",int),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1384             :  command("aggr", "sum", AGGRsum3_dbl, false, "Grouped tail sum on lng", args(1,4, batarg("",dbl),batarg("b",lng),batarg("g",oid),batargany("e",1))),
    1385             :  command("aggr", "sum", AGGRsum3_lng, false, "Grouped tail sum on lng", args(1,4, batarg("",lng),batarg("b",lng),batarg("g",oid),batargany("e",1))),
    1386             :  command("aggr", "subsum", AGGRsubsum_lng, false, "Grouped sum aggregate", args(1,5, batarg("",lng),batarg("b",lng),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1387             :  command("aggr", "subsum", AGGRsubsumcand_lng, false, "Grouped sum aggregate with candidates list", args(1,6, batarg("",lng),batarg("b",lng),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1388             :  command("aggr", "prod", AGGRprod3_lng, false, "Grouped tail product on lng", args(1,4, batarg("",lng),batarg("b",lng),batarg("g",oid),batargany("e",1))),
    1389             :  command("aggr", "subprod", AGGRsubprod_lng, false, "Grouped product aggregate", args(1,5, batarg("",lng),batarg("b",lng),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1390             :  command("aggr", "subprod", AGGRsubprodcand_lng, false, "Grouped product aggregate with candidates list", args(1,6, batarg("",lng),batarg("b",lng),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1391             :  command("aggr", "sum", AGGRsum3_flt, false, "Grouped tail sum on flt", args(1,4, batarg("",flt),batarg("b",flt),batarg("g",oid),batargany("e",1))),
    1392             :  command("aggr", "subsum", AGGRsubsum_flt, false, "Grouped sum aggregate", args(1,5, batarg("",flt),batarg("b",flt),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1393             :  command("aggr", "subsum", AGGRsubsumcand_flt, false, "Grouped sum aggregate with candidates list", args(1,6, batarg("",flt),batarg("b",flt),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1394             :  command("aggr", "prod", AGGRprod3_flt, false, "Grouped tail product on flt", args(1,4, batarg("",flt),batarg("b",flt),batarg("g",oid),batargany("e",1))),
    1395             :  command("aggr", "subprod", AGGRsubprod_flt, false, "Grouped product aggregate", args(1,5, batarg("",flt),batarg("b",flt),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1396             :  command("aggr", "subprod", AGGRsubprodcand_flt, false, "Grouped product aggregate with candidates list", args(1,6, batarg("",flt),batarg("b",flt),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1397             :  command("aggr", "sum", AGGRsum3_dbl, false, "Grouped tail sum on flt", args(1,4, batarg("",dbl),batarg("b",flt),batarg("g",oid),batargany("e",1))),
    1398             :  command("aggr", "subsum", AGGRsubsum_dbl, false, "Grouped sum aggregate", args(1,5, batarg("",dbl),batarg("b",flt),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1399             :  command("aggr", "subsum", AGGRsubsumcand_dbl, false, "Grouped sum aggregate with candidates list", args(1,6, batarg("",dbl),batarg("b",flt),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1400             :  command("aggr", "prod", AGGRprod3_dbl, false, "Grouped tail product on flt", args(1,4, batarg("",dbl),batarg("b",flt),batarg("g",oid),batargany("e",1))),
    1401             :  command("aggr", "subprod", AGGRsubprod_dbl, false, "Grouped product aggregate", args(1,5, batarg("",dbl),batarg("b",flt),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1402             :  command("aggr", "subprod", AGGRsubprodcand_dbl, false, "Grouped product aggregate with candidates list", args(1,6, batarg("",dbl),batarg("b",flt),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1403             :  command("aggr", "sum", AGGRsum3_dbl, false, "Grouped tail sum on dbl", args(1,4, batarg("",dbl),batarg("b",dbl),batarg("g",oid),batargany("e",1))),
    1404             :  command("aggr", "subsum", AGGRsubsum_dbl, false, "Grouped sum aggregate", args(1,5, batarg("",dbl),batarg("b",dbl),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1405             :  command("aggr", "subsum", AGGRsubsumcand_dbl, false, "Grouped sum aggregate with candidates list", args(1,6, batarg("",dbl),batarg("b",dbl),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1406             :  command("aggr", "prod", AGGRprod3_dbl, false, "Grouped tail product on dbl", args(1,4, batarg("",dbl),batarg("b",dbl),batarg("g",oid),batargany("e",1))),
    1407             :  command("aggr", "subprod", AGGRsubprod_dbl, false, "Grouped product aggregate", args(1,5, batarg("",dbl),batarg("b",dbl),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1408             :  command("aggr", "subprod", AGGRsubprodcand_dbl, false, "Grouped product aggregate with candidates list", args(1,6, batarg("",dbl),batarg("b",dbl),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1409             :  command("aggr", "avg", AGGRavg13_dbl, false, "Grouped tail average on bte", args(1,4, batarg("",dbl),batarg("b",bte),batarg("g",oid),batargany("e",1))),
    1410             :  command("aggr", "avg", AGGRavg23_dbl, false, "Grouped tail average on bte, also returns count", args(2,5, batarg("",dbl),batarg("",lng),batarg("b",bte),batarg("g",oid),batargany("e",1))),
    1411             :  command("aggr", "avg", AGGRavg14_dbl, false, "Grouped tail average on bte", args(1,5, batarg("",dbl),batarg("b",bte),batarg("g",oid),batargany("e",1),arg("scale",int))),
    1412             :  command("aggr", "avg", AGGRavg24_dbl, false, "Grouped tail average on bte, also returns count", args(2,6, batarg("",dbl),batarg("",lng),batarg("b",bte),batarg("g",oid),batargany("e",1),arg("scale",int))),
    1413             :  command("aggr", "subavg", AGGRsubavg1_dbl, false, "Grouped average aggregate", args(1,5, batarg("",dbl),batarg("b",bte),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1414             :  command("aggr", "subavg", AGGRsubavg1cand_dbl, false, "Grouped average aggregate with candidates list", args(1,6, batarg("",dbl),batarg("b",bte),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1415             :  command("aggr", "subavg", AGGRsubavg2_dbl, false, "Grouped average aggregate, also returns count", args(2,6, batarg("",dbl),batarg("",lng),batarg("b",bte),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1416             :  command("aggr", "subavg", AGGRsubavg2cand_dbl, false, "Grouped average aggregate with candidates list, also returns count", args(2,7, batarg("",dbl),batarg("",lng),batarg("b",bte),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1417             :  command("aggr", "subavg", AGGRsubavg1s_dbl, false, "Grouped average aggregate", args(1,6, batarg("",dbl),batarg("b",bte),batarg("g",oid),batargany("e",1),arg("skip_nils",bit),arg("scale",int))),
    1418             :  command("aggr", "subavg", AGGRsubavg1scand_dbl, false, "Grouped average aggregate with candidates list", args(1,7, batarg("",dbl),batarg("b",bte),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit),arg("scale",int))),
    1419             :  command("aggr", "subavg", AGGRsubavg2s_dbl, false, "Grouped average aggregate, also returns count", args(2,7, batarg("",dbl),batarg("",lng),batarg("b",bte),batarg("g",oid),batargany("e",1),arg("skip_nils",bit),arg("scale",int))),
    1420             :  command("aggr", "subavg", AGGRsubavg2scand_dbl, false, "Grouped average aggregate with candidates list, also returns count", args(2,8, batarg("",dbl),batarg("",lng),batarg("b",bte),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit),arg("scale",int))),
    1421             :  command("aggr", "stdev", AGGRstdev3_dbl, false, "Grouped tail standard deviation (sample/non-biased) on bte", args(1,4, batarg("",dbl),batarg("b",bte),batarg("g",oid),batargany("e",1))),
    1422             :  command("aggr", "substdev", AGGRsubstdev_dbl, false, "Grouped standard deviation (sample/non-biased) aggregate", args(1,5, batarg("",dbl),batarg("b",bte),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1423             :  command("aggr", "substdev", AGGRsubstdevcand_dbl, false, "Grouped standard deviation (sample/non-biased) aggregate with candidates list", args(1,6, batarg("",dbl),batarg("b",bte),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1424             :  command("aggr", "stdevp", AGGRstdevp3_dbl, false, "Grouped tail standard deviation (population/biased) on bte", args(1,4, batarg("",dbl),batarg("b",bte),batarg("g",oid),batargany("e",1))),
    1425             :  command("aggr", "substdevp", AGGRsubstdevp_dbl, false, "Grouped standard deviation (population/biased) aggregate", args(1,5, batarg("",dbl),batarg("b",bte),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1426             :  command("aggr", "substdevp", AGGRsubstdevpcand_dbl, false, "Grouped standard deviation (population/biased) aggregate with candidates list", args(1,6, batarg("",dbl),batarg("b",bte),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1427             :  command("aggr", "variance", AGGRvariance3_dbl, false, "Grouped tail variance (sample/non-biased) on bte", args(1,4, batarg("",dbl),batarg("b",bte),batarg("g",oid),batargany("e",1))),
    1428             :  command("aggr", "subvariance", AGGRsubvariance_dbl, false, "Grouped variance (sample/non-biased) aggregate", args(1,5, batarg("",dbl),batarg("b",bte),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1429             :  command("aggr", "subvariance", AGGRsubvariancecand_dbl, false, "Grouped variance (sample/non-biased) aggregate with candidates list", args(1,6, batarg("",dbl),batarg("b",bte),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1430             :  command("aggr", "variancep", AGGRvariancep3_dbl, false, "Grouped tail variance (population/biased) on bte", args(1,4, batarg("",dbl),batarg("b",bte),batarg("g",oid),batargany("e",1))),
    1431             :  command("aggr", "subvariancep", AGGRsubvariancep_dbl, false, "Grouped variance (population/biased) aggregate", args(1,5, batarg("",dbl),batarg("b",bte),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1432             :  command("aggr", "subvariancep", AGGRsubvariancepcand_dbl, false, "Grouped variance (population/biased) aggregate with candidates list", args(1,6, batarg("",dbl),batarg("b",bte),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1433             :  command("aggr", "covariance", AGGRcovariance, false, "Covariance sample aggregate", args(1,5, batarg("",dbl),batarg("b1",bte),batarg("b2",bte),batarg("g",oid),batargany("e",1))),
    1434             :  command("aggr", "subcovariance", AGGRsubcovariance, false, "Grouped covariance sample aggregate", args(1,6, batarg("",dbl),batarg("b1",bte),batarg("b2",bte),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1435             :  command("aggr", "subcovariance", AGGRsubcovariancecand, false, "Grouped covariance sample aggregate with candidate list", args(1,7, batarg("",dbl),batarg("b1",bte),batarg("b2",bte),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1436             :  command("aggr", "covariancep", AGGRcovariancep, false, "Covariance population aggregate", args(1,5, batarg("",dbl),batarg("b1",bte),batarg("b2",bte),batarg("g",oid),batargany("e",1))),
    1437             :  command("aggr", "subcovariancep", AGGRsubcovariancep, false, "Grouped covariance population aggregate", args(1,6, batarg("",dbl),batarg("b1",bte),batarg("b2",bte),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1438             :  command("aggr", "subcovariancep", AGGRsubcovariancepcand, false, "Grouped covariance population aggregate with candidate list", args(1,7, batarg("",dbl),batarg("b1",bte),batarg("b2",bte),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1439             :  command("aggr", "corr", AGGRcorr, false, "Correlation aggregate", args(1,5, batarg("",dbl),batarg("b1",bte),batarg("b2",bte),batarg("g",oid),batargany("e",1))),
    1440             :  command("aggr", "subcorr", AGGRsubcorr, false, "Grouped correlation aggregate", args(1,6, batarg("",dbl),batarg("b1",bte),batarg("b2",bte),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1441             :  command("aggr", "subcorr", AGGRsubcorrcand, false, "Grouped correlation aggregate with candidate list", args(1,7, batarg("",dbl),batarg("b1",bte),batarg("b2",bte),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1442             :  command("aggr", "avg", AGGRavg13_dbl, false, "Grouped tail average on sht", args(1,4, batarg("",dbl),batarg("b",sht),batarg("g",oid),batargany("e",1))),
    1443             :  command("aggr", "avg", AGGRavg23_dbl, false, "Grouped tail average on sht, also returns count", args(2,5, batarg("",dbl),batarg("",lng),batarg("b",sht),batarg("g",oid),batargany("e",1))),
    1444             :  command("aggr", "avg", AGGRavg14_dbl, false, "Grouped tail average on sht", args(1,5, batarg("",dbl),batarg("b",sht),batarg("g",oid),batargany("e",1),arg("scale",int))),
    1445             :  command("aggr", "avg", AGGRavg24_dbl, false, "Grouped tail average on sht, also returns count", args(2,6, batarg("",dbl),batarg("",lng),batarg("b",sht),batarg("g",oid),batargany("e",1),arg("scale",int))),
    1446             :  command("aggr", "subavg", AGGRsubavg1_dbl, false, "Grouped average aggregate", args(1,5, batarg("",dbl),batarg("b",sht),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1447             :  command("aggr", "subavg", AGGRsubavg1cand_dbl, false, "Grouped average aggregate with candidates list", args(1,6, batarg("",dbl),batarg("b",sht),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1448             :  command("aggr", "subavg", AGGRsubavg2_dbl, false, "Grouped average aggregate, also returns count", args(2,6, batarg("",dbl),batarg("",lng),batarg("b",sht),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1449             :  command("aggr", "subavg", AGGRsubavg2cand_dbl, false, "Grouped average aggregate with candidates list, also returns count", args(2,7, batarg("",dbl),batarg("",lng),batarg("b",sht),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1450             :  command("aggr", "subavg", AGGRsubavg1s_dbl, false, "Grouped average aggregate", args(1,6, batarg("",dbl),batarg("b",sht),batarg("g",oid),batargany("e",1),arg("skip_nils",bit),arg("scale",int))),
    1451             :  command("aggr", "subavg", AGGRsubavg1scand_dbl, false, "Grouped average aggregate with candidates list", args(1,7, batarg("",dbl),batarg("b",sht),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit),arg("scale",int))),
    1452             :  command("aggr", "subavg", AGGRsubavg2s_dbl, false, "Grouped average aggregate, also returns count", args(2,7, batarg("",dbl),batarg("",lng),batarg("b",sht),batarg("g",oid),batargany("e",1),arg("skip_nils",bit),arg("scale",int))),
    1453             :  command("aggr", "subavg", AGGRsubavg2scand_dbl, false, "Grouped average aggregate with candidates list, also returns count", args(2,8, batarg("",dbl),batarg("",lng),batarg("b",sht),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit),arg("scale",int))),
    1454             :  command("aggr", "stdev", AGGRstdev3_dbl, false, "Grouped tail standard deviation (sample/non-biased) on sht", args(1,4, batarg("",dbl),batarg("b",sht),batarg("g",oid),batargany("e",1))),
    1455             :  command("aggr", "substdev", AGGRsubstdev_dbl, false, "Grouped standard deviation (sample/non-biased) aggregate", args(1,5, batarg("",dbl),batarg("b",sht),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1456             :  command("aggr", "substdev", AGGRsubstdevcand_dbl, false, "Grouped standard deviation (sample/non-biased) aggregate with candidates list", args(1,6, batarg("",dbl),batarg("b",sht),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1457             :  command("aggr", "stdevp", AGGRstdevp3_dbl, false, "Grouped tail standard deviation (population/biased) on sht", args(1,4, batarg("",dbl),batarg("b",sht),batarg("g",oid),batargany("e",1))),
    1458             :  command("aggr", "substdevp", AGGRsubstdevp_dbl, false, "Grouped standard deviation (population/biased) aggregate", args(1,5, batarg("",dbl),batarg("b",sht),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1459             :  command("aggr", "substdevp", AGGRsubstdevpcand_dbl, false, "Grouped standard deviation (population/biased) aggregate with candidates list", args(1,6, batarg("",dbl),batarg("b",sht),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1460             :  command("aggr", "variance", AGGRvariance3_dbl, false, "Grouped tail variance (sample/non-biased) on sht", args(1,4, batarg("",dbl),batarg("b",sht),batarg("g",oid),batargany("e",1))),
    1461             :  command("aggr", "subvariance", AGGRsubvariance_dbl, false, "Grouped variance (sample/non-biased) aggregate", args(1,5, batarg("",dbl),batarg("b",sht),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1462             :  command("aggr", "subvariance", AGGRsubvariancecand_dbl, false, "Grouped variance (sample/non-biased) aggregate with candidates list", args(1,6, batarg("",dbl),batarg("b",sht),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1463             :  command("aggr", "variancep", AGGRvariancep3_dbl, false, "Grouped tail variance (population/biased) on sht", args(1,4, batarg("",dbl),batarg("b",sht),batarg("g",oid),batargany("e",1))),
    1464             :  command("aggr", "subvariancep", AGGRsubvariancep_dbl, false, "Grouped variance (population/biased) aggregate", args(1,5, batarg("",dbl),batarg("b",sht),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1465             :  command("aggr", "subvariancep", AGGRsubvariancepcand_dbl, false, "Grouped variance (population/biased) aggregate with candidates list", args(1,6, batarg("",dbl),batarg("b",sht),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1466             :  command("aggr", "covariance", AGGRcovariance, false, "Covariance sample aggregate", args(1,5, batarg("",dbl),batarg("b1",sht),batarg("b2",sht),batarg("g",oid),batargany("e",1))),
    1467             :  command("aggr", "subcovariance", AGGRsubcovariance, false, "Grouped covariance sample aggregate", args(1,6, batarg("",dbl),batarg("b1",sht),batarg("b2",sht),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1468             :  command("aggr", "subcovariance", AGGRsubcovariancecand, false, "Grouped covariance sample aggregate with candidate list", args(1,7, batarg("",dbl),batarg("b1",sht),batarg("b2",sht),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1469             :  command("aggr", "covariancep", AGGRcovariancep, false, "Covariance population aggregate", args(1,5, batarg("",dbl),batarg("b1",sht),batarg("b2",sht),batarg("g",oid),batargany("e",1))),
    1470             :  command("aggr", "subcovariancep", AGGRsubcovariancep, false, "Grouped covariance population aggregate", args(1,6, batarg("",dbl),batarg("b1",sht),batarg("b2",sht),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1471             :  command("aggr", "subcovariancep", AGGRsubcovariancepcand, false, "Grouped covariance population aggregate with candidate list", args(1,7, batarg("",dbl),batarg("b1",sht),batarg("b2",sht),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1472             :  command("aggr", "corr", AGGRcorr, false, "Correlation aggregate", args(1,5, batarg("",dbl),batarg("b1",sht),batarg("b2",sht),batarg("g",oid),batargany("e",1))),
    1473             :  command("aggr", "subcorr", AGGRsubcorr, false, "Grouped correlation aggregate", args(1,6, batarg("",dbl),batarg("b1",sht),batarg("b2",sht),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1474             :  command("aggr", "subcorr", AGGRsubcorrcand, false, "Grouped correlation aggregate with candidate list", args(1,7, batarg("",dbl),batarg("b1",sht),batarg("b2",sht),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1475             :  command("aggr", "avg", AGGRavg13_dbl, false, "Grouped tail average on int", args(1,4, batarg("",dbl),batarg("b",int),batarg("g",oid),batargany("e",1))),
    1476             :  command("aggr", "avg", AGGRavg23_dbl, false, "Grouped tail average on int, also returns count", args(2,5, batarg("",dbl),batarg("",lng),batarg("b",int),batarg("g",oid),batargany("e",1))),
    1477             :  command("aggr", "avg", AGGRavg14_dbl, false, "Grouped tail average on int", args(1,5, batarg("",dbl),batarg("b",int),batarg("g",oid),batargany("e",1),arg("scale",int))),
    1478             :  command("aggr", "avg", AGGRavg24_dbl, false, "Grouped tail average on int, also returns count", args(2,6, batarg("",dbl),batarg("",lng),batarg("b",int),batarg("g",oid),batargany("e",1),arg("scale",int))),
    1479             :  command("aggr", "subavg", AGGRsubavg1_dbl, false, "Grouped average aggregate", args(1,5, batarg("",dbl),batarg("b",int),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1480             :  command("aggr", "subavg", AGGRsubavg1cand_dbl, false, "Grouped average aggregate with candidates list", args(1,6, batarg("",dbl),batarg("b",int),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1481             :  command("aggr", "subavg", AGGRsubavg2_dbl, false, "Grouped average aggregate, also returns count", args(2,6, batarg("",dbl),batarg("",lng),batarg("b",int),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1482             :  command("aggr", "subavg", AGGRsubavg2cand_dbl, false, "Grouped average aggregate with candidates list, also returns count", args(2,7, batarg("",dbl),batarg("",lng),batarg("b",int),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1483             :  command("aggr", "subavg", AGGRsubavg1s_dbl, false, "Grouped average aggregate", args(1,6, batarg("",dbl),batarg("b",int),batarg("g",oid),batargany("e",1),arg("skip_nils",bit),arg("scale",int))),
    1484             :  command("aggr", "subavg", AGGRsubavg1scand_dbl, false, "Grouped average aggregate with candidates list", args(1,7, batarg("",dbl),batarg("b",int),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit),arg("scale",int))),
    1485             :  command("aggr", "subavg", AGGRsubavg2s_dbl, false, "Grouped average aggregate, also returns count", args(2,7, batarg("",dbl),batarg("",lng),batarg("b",int),batarg("g",oid),batargany("e",1),arg("skip_nils",bit),arg("scale",int))),
    1486             :  command("aggr", "subavg", AGGRsubavg2scand_dbl, false, "Grouped average aggregate with candidates list, also returns count", args(2,8, batarg("",dbl),batarg("",lng),batarg("b",int),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit),arg("scale",int))),
    1487             :  command("aggr", "stdev", AGGRstdev3_dbl, false, "Grouped tail standard deviation (sample/non-biased) on int", args(1,4, batarg("",dbl),batarg("b",int),batarg("g",oid),batargany("e",1))),
    1488             :  command("aggr", "substdev", AGGRsubstdev_dbl, false, "Grouped standard deviation (sample/non-biased) aggregate", args(1,5, batarg("",dbl),batarg("b",int),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1489             :  command("aggr", "substdev", AGGRsubstdevcand_dbl, false, "Grouped standard deviation (sample/non-biased) aggregate with candidates list", args(1,6, batarg("",dbl),batarg("b",int),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1490             :  command("aggr", "stdevp", AGGRstdevp3_dbl, false, "Grouped tail standard deviation (population/biased) on int", args(1,4, batarg("",dbl),batarg("b",int),batarg("g",oid),batargany("e",1))),
    1491             :  command("aggr", "substdevp", AGGRsubstdevp_dbl, false, "Grouped standard deviation (population/biased) aggregate", args(1,5, batarg("",dbl),batarg("b",int),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1492             :  command("aggr", "substdevp", AGGRsubstdevpcand_dbl, false, "Grouped standard deviation (population/biased) aggregate with candidates list", args(1,6, batarg("",dbl),batarg("b",int),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1493             :  command("aggr", "variance", AGGRvariance3_dbl, false, "Grouped tail variance (sample/non-biased) on int", args(1,4, batarg("",dbl),batarg("b",int),batarg("g",oid),batargany("e",1))),
    1494             :  command("aggr", "subvariance", AGGRsubvariance_dbl, false, "Grouped variance (sample/non-biased) aggregate", args(1,5, batarg("",dbl),batarg("b",int),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1495             :  command("aggr", "subvariance", AGGRsubvariancecand_dbl, false, "Grouped variance (sample/non-biased) aggregate with candidates list", args(1,6, batarg("",dbl),batarg("b",int),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1496             :  command("aggr", "variancep", AGGRvariancep3_dbl, false, "Grouped tail variance (population/biased) on int", args(1,4, batarg("",dbl),batarg("b",int),batarg("g",oid),batargany("e",1))),
    1497             :  command("aggr", "subvariancep", AGGRsubvariancep_dbl, false, "Grouped variance (population/biased) aggregate", args(1,5, batarg("",dbl),batarg("b",int),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1498             :  command("aggr", "subvariancep", AGGRsubvariancepcand_dbl, false, "Grouped variance (population/biased) aggregate with candidates list", args(1,6, batarg("",dbl),batarg("b",int),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1499             :  command("aggr", "covariance", AGGRcovariance, false, "Covariance sample aggregate", args(1,5, batarg("",dbl),batarg("b1",int),batarg("b2",int),batarg("g",oid),batargany("e",1))),
    1500             :  command("aggr", "subcovariance", AGGRsubcovariance, false, "Grouped covariance sample aggregate", args(1,6, batarg("",dbl),batarg("b1",int),batarg("b2",int),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1501             :  command("aggr", "subcovariance", AGGRsubcovariancecand, false, "Grouped covariance sample aggregate with candidate list", args(1,7, batarg("",dbl),batarg("b1",int),batarg("b2",int),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1502             :  command("aggr", "covariancep", AGGRcovariancep, false, "Covariance population aggregate", args(1,5, batarg("",dbl),batarg("b1",int),batarg("b2",int),batarg("g",oid),batargany("e",1))),
    1503             :  command("aggr", "subcovariancep", AGGRsubcovariancep, false, "Grouped covariance population aggregate", args(1,6, batarg("",dbl),batarg("b1",int),batarg("b2",int),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1504             :  command("aggr", "subcovariancep", AGGRsubcovariancepcand, false, "Grouped covariance population aggregate with candidate list", args(1,7, batarg("",dbl),batarg("b1",int),batarg("b2",int),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1505             :  command("aggr", "corr", AGGRcorr, false, "Correlation aggregate", args(1,5, batarg("",dbl),batarg("b1",int),batarg("b2",int),batarg("g",oid),batargany("e",1))),
    1506             :  command("aggr", "subcorr", AGGRsubcorr, false, "Grouped correlation aggregate", args(1,6, batarg("",dbl),batarg("b1",int),batarg("b2",int),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1507             :  command("aggr", "subcorr", AGGRsubcorrcand, false, "Grouped correlation aggregate with candidate list", args(1,7, batarg("",dbl),batarg("b1",int),batarg("b2",int),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1508             :  command("aggr", "avg", AGGRavg13_dbl, false, "Grouped tail average on lng", args(1,4, batarg("",dbl),batarg("b",lng),batarg("g",oid),batargany("e",1))),
    1509             :  command("aggr", "avg", AGGRavg23_dbl, false, "Grouped tail average on lng, also returns count", args(2,5, batarg("",dbl),batarg("",lng),batarg("b",lng),batarg("g",oid),batargany("e",1))),
    1510             :  command("aggr", "avg", AGGRavg14_dbl, false, "Grouped tail average on lng", args(1,5, batarg("",dbl),batarg("b",lng),batarg("g",oid),batargany("e",1),arg("scale",int))),
    1511             :  command("aggr", "avg", AGGRavg24_dbl, false, "Grouped tail average on lng, also returns count", args(2,6, batarg("",dbl),batarg("",lng),batarg("b",lng),batarg("g",oid),batargany("e",1),arg("scale",int))),
    1512             :  command("aggr", "subavg", AGGRsubavg1_dbl, false, "Grouped average aggregate", args(1,5, batarg("",dbl),batarg("b",lng),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1513             :  command("aggr", "subavg", AGGRsubavg1cand_dbl, false, "Grouped average aggregate with candidates list", args(1,6, batarg("",dbl),batarg("b",lng),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1514             :  command("aggr", "subavg", AGGRsubavg2_dbl, false, "Grouped average aggregate, also returns count", args(2,6, batarg("",dbl),batarg("",lng),batarg("b",lng),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1515             :  command("aggr", "subavg", AGGRsubavg2cand_dbl, false, "Grouped average aggregate with candidates list, also returns count", args(2,7, batarg("",dbl),batarg("",lng),batarg("b",lng),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1516             :  command("aggr", "subavg", AGGRsubavg1s_dbl, false, "Grouped average aggregate", args(1,6, batarg("",dbl),batarg("b",lng),batarg("g",oid),batargany("e",1),arg("skip_nils",bit),arg("scale",int))),
    1517             :  command("aggr", "subavg", AGGRsubavg1scand_dbl, false, "Grouped average aggregate with candidates list", args(1,7, batarg("",dbl),batarg("b",lng),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit),arg("scale",int))),
    1518             :  command("aggr", "subavg", AGGRsubavg2s_dbl, false, "Grouped average aggregate, also returns count", args(2,7, batarg("",dbl),batarg("",lng),batarg("b",lng),batarg("g",oid),batargany("e",1),arg("skip_nils",bit),arg("scale",int))),
    1519             :  command("aggr", "subavg", AGGRsubavg2scand_dbl, false, "Grouped average aggregate with candidates list, also returns count", args(2,8, batarg("",dbl),batarg("",lng),batarg("b",lng),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit),arg("scale",int))),
    1520             :  command("aggr", "stdev", AGGRstdev3_dbl, false, "Grouped tail standard deviation (sample/non-biased) on lng", args(1,4, batarg("",dbl),batarg("b",lng),batarg("g",oid),batargany("e",1))),
    1521             :  command("aggr", "substdev", AGGRsubstdev_dbl, false, "Grouped standard deviation (sample/non-biased) aggregate", args(1,5, batarg("",dbl),batarg("b",lng),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1522             :  command("aggr", "substdev", AGGRsubstdevcand_dbl, false, "Grouped standard deviation (sample/non-biased) aggregate with candidates list", args(1,6, batarg("",dbl),batarg("b",lng),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1523             :  command("aggr", "stdevp", AGGRstdevp3_dbl, false, "Grouped tail standard deviation (population/biased) on lng", args(1,4, batarg("",dbl),batarg("b",lng),batarg("g",oid),batargany("e",1))),
    1524             :  command("aggr", "substdevp", AGGRsubstdevp_dbl, false, "Grouped standard deviation (population/biased) aggregate", args(1,5, batarg("",dbl),batarg("b",lng),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1525             :  command("aggr", "substdevp", AGGRsubstdevpcand_dbl, false, "Grouped standard deviation (population/biased) aggregate with candidates list", args(1,6, batarg("",dbl),batarg("b",lng),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1526             :  command("aggr", "variance", AGGRvariance3_dbl, false, "Grouped tail variance (sample/non-biased) on lng", args(1,4, batarg("",dbl),batarg("b",lng),batarg("g",oid),batargany("e",1))),
    1527             :  command("aggr", "subvariance", AGGRsubvariance_dbl, false, "Grouped variance (sample/non-biased) aggregate", args(1,5, batarg("",dbl),batarg("b",lng),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1528             :  command("aggr", "subvariance", AGGRsubvariancecand_dbl, false, "Grouped variance (sample/non-biased) aggregate with candidates list", args(1,6, batarg("",dbl),batarg("b",lng),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1529             :  command("aggr", "variancep", AGGRvariancep3_dbl, false, "Grouped tail variance (population/biased) on lng", args(1,4, batarg("",dbl),batarg("b",lng),batarg("g",oid),batargany("e",1))),
    1530             :  command("aggr", "subvariancep", AGGRsubvariancep_dbl, false, "Grouped variance (population/biased) aggregate", args(1,5, batarg("",dbl),batarg("b",lng),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1531             :  command("aggr", "subvariancep", AGGRsubvariancepcand_dbl, false, "Grouped variance (population/biased) aggregate with candidates list", args(1,6, batarg("",dbl),batarg("b",lng),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1532             :  command("aggr", "covariance", AGGRcovariance, false, "Covariance sample aggregate", args(1,5, batarg("",dbl),batarg("b1",lng),batarg("b2",lng),batarg("g",oid),batargany("e",1))),
    1533             :  command("aggr", "subcovariance", AGGRsubcovariance, false, "Grouped covariance sample aggregate", args(1,6, batarg("",dbl),batarg("b1",lng),batarg("b2",lng),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1534             :  command("aggr", "subcovariance", AGGRsubcovariancecand, false, "Grouped covariance sample aggregate with candidate list", args(1,7, batarg("",dbl),batarg("b1",lng),batarg("b2",lng),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1535             :  command("aggr", "covariancep", AGGRcovariancep, false, "Covariance population aggregate", args(1,5, batarg("",dbl),batarg("b1",lng),batarg("b2",lng),batarg("g",oid),batargany("e",1))),
    1536             :  command("aggr", "subcovariancep", AGGRsubcovariancep, false, "Grouped covariance population aggregate", args(1,6, batarg("",dbl),batarg("b1",lng),batarg("b2",lng),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1537             :  command("aggr", "subcovariancep", AGGRsubcovariancepcand, false, "Grouped covariance population aggregate with candidate list", args(1,7, batarg("",dbl),batarg("b1",lng),batarg("b2",lng),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1538             :  command("aggr", "corr", AGGRcorr, false, "Correlation aggregate", args(1,5, batarg("",dbl),batarg("b1",lng),batarg("b2",lng),batarg("g",oid),batargany("e",1))),
    1539             :  command("aggr", "subcorr", AGGRsubcorr, false, "Grouped correlation aggregate", args(1,6, batarg("",dbl),batarg("b1",lng),batarg("b2",lng),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1540             :  command("aggr", "subcorr", AGGRsubcorrcand, false, "Grouped correlation aggregate with candidate list", args(1,7, batarg("",dbl),batarg("b1",lng),batarg("b2",lng),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1541             :  command("aggr", "avg", AGGRavg13_dbl, false, "Grouped tail average on flt", args(1,4, batarg("",dbl),batarg("b",flt),batarg("g",oid),batargany("e",1))),
    1542             :  command("aggr", "avg", AGGRavg23_dbl, false, "Grouped tail average on flt, also returns count", args(2,5, batarg("",dbl),batarg("",lng),batarg("b",flt),batarg("g",oid),batargany("e",1))),
    1543             :  command("aggr", "avg", AGGRavg14_dbl, false, "Grouped tail average on flt", args(1,5, batarg("",dbl),batarg("b",flt),batarg("g",oid),batargany("e",1),arg("scale",int))),
    1544             :  command("aggr", "avg", AGGRavg24_dbl, false, "Grouped tail average on flt, also returns count", args(2,6, batarg("",dbl),batarg("",lng),batarg("b",flt),batarg("g",oid),batargany("e",1),arg("scale",int))),
    1545             :  command("aggr", "subavg", AGGRsubavg1_dbl, false, "Grouped average aggregate", args(1,5, batarg("",dbl),batarg("b",flt),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1546             :  command("aggr", "subavg", AGGRsubavg1cand_dbl, false, "Grouped average aggregate with candidates list", args(1,6, batarg("",dbl),batarg("b",flt),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1547             :  command("aggr", "subavg", AGGRsubavg2_dbl, false, "Grouped average aggregate, also returns count", args(2,6, batarg("",dbl),batarg("",lng),batarg("b",flt),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1548             :  command("aggr", "subavg", AGGRsubavg2cand_dbl, false, "Grouped average aggregate with candidates list, also returns count", args(2,7, batarg("",dbl),batarg("",lng),batarg("b",flt),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1549             :  command("aggr", "subavg", AGGRsubavg1s_dbl, false, "Grouped average aggregate", args(1,6, batarg("",dbl),batarg("b",flt),batarg("g",oid),batargany("e",1),arg("skip_nils",bit),arg("scale",int))),
    1550             :  command("aggr", "subavg", AGGRsubavg1scand_dbl, false, "Grouped average aggregate with candidates list", args(1,7, batarg("",dbl),batarg("b",flt),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit),arg("scale",int))),
    1551             :  command("aggr", "subavg", AGGRsubavg2s_dbl, false, "Grouped average aggregate, also returns count", args(2,7, batarg("",dbl),batarg("",lng),batarg("b",flt),batarg("g",oid),batargany("e",1),arg("skip_nils",bit),arg("scale",int))),
    1552             :  command("aggr", "subavg", AGGRsubavg2scand_dbl, false, "Grouped average aggregate with candidates list, also returns count", args(2,8, batarg("",dbl),batarg("",lng),batarg("b",flt),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit),arg("scale",int))),
    1553             :  command("aggr", "stdev", AGGRstdev3_dbl, false, "Grouped tail standard deviation (sample/non-biased) on flt", args(1,4, batarg("",dbl),batarg("b",flt),batarg("g",oid),batargany("e",1))),
    1554             :  command("aggr", "substdev", AGGRsubstdev_dbl, false, "Grouped standard deviation (sample/non-biased) aggregate", args(1,5, batarg("",dbl),batarg("b",flt),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1555             :  command("aggr", "substdev", AGGRsubstdevcand_dbl, false, "Grouped standard deviation (sample/non-biased) aggregate with candidates list", args(1,6, batarg("",dbl),batarg("b",flt),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1556             :  command("aggr", "stdevp", AGGRstdevp3_dbl, false, "Grouped tail standard deviation (population/biased) on flt", args(1,4, batarg("",dbl),batarg("b",flt),batarg("g",oid),batargany("e",1))),
    1557             :  command("aggr", "substdevp", AGGRsubstdevp_dbl, false, "Grouped standard deviation (population/biased) aggregate", args(1,5, batarg("",dbl),batarg("b",flt),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1558             :  command("aggr", "substdevp", AGGRsubstdevpcand_dbl, false, "Grouped standard deviation (population/biased) aggregate with candidates list", args(1,6, batarg("",dbl),batarg("b",flt),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1559             :  command("aggr", "variance", AGGRvariance3_dbl, false, "Grouped tail variance (sample/non-biased) on flt", args(1,4, batarg("",dbl),batarg("b",flt),batarg("g",oid),batargany("e",1))),
    1560             :  command("aggr", "subvariance", AGGRsubvariance_dbl, false, "Grouped variance (sample/non-biased) aggregate", args(1,5, batarg("",dbl),batarg("b",flt),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1561             :  command("aggr", "subvariance", AGGRsubvariancecand_dbl, false, "Grouped variance (sample/non-biased) aggregate with candidates list", args(1,6, batarg("",dbl),batarg("b",flt),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1562             :  command("aggr", "variancep", AGGRvariancep3_dbl, false, "Grouped tail variance (population/biased) on flt", args(1,4, batarg("",dbl),batarg("b",flt),batarg("g",oid),batargany("e",1))),
    1563             :  command("aggr", "subvariancep", AGGRsubvariancep_dbl, false, "Grouped variance (population/biased) aggregate", args(1,5, batarg("",dbl),batarg("b",flt),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1564             :  command("aggr", "subvariancep", AGGRsubvariancepcand_dbl, false, "Grouped variance (population/biased) aggregate with candidates list", args(1,6, batarg("",dbl),batarg("b",flt),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1565             :  command("aggr", "covariance", AGGRcovariance, false, "Covariance sample aggregate", args(1,5, batarg("",dbl),batarg("b1",flt),batarg("b2",flt),batarg("g",oid),batargany("e",1))),
    1566             :  command("aggr", "subcovariance", AGGRsubcovariance, false, "Grouped covariance sample aggregate", args(1,6, batarg("",dbl),batarg("b1",flt),batarg("b2",flt),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1567             :  command("aggr", "subcovariance", AGGRsubcovariancecand, false, "Grouped covariance sample aggregate with candidate list", args(1,7, batarg("",dbl),batarg("b1",flt),batarg("b2",flt),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1568             :  command("aggr", "covariancep", AGGRcovariancep, false, "Covariance population aggregate", args(1,5, batarg("",dbl),batarg("b1",flt),batarg("b2",flt),batarg("g",oid),batargany("e",1))),
    1569             :  command("aggr", "subcovariancep", AGGRsubcovariancep, false, "Grouped covariance population aggregate", args(1,6, batarg("",dbl),batarg("b1",flt),batarg("b2",flt),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1570             :  command("aggr", "subcovariancep", AGGRsubcovariancepcand, false, "Grouped covariance population aggregate with candidate list", args(1,7, batarg("",dbl),batarg("b1",flt),batarg("b2",flt),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1571             :  command("aggr", "corr", AGGRcorr, false, "Correlation aggregate", args(1,5, batarg("",dbl),batarg("b1",flt),batarg("b2",flt),batarg("g",oid),batargany("e",1))),
    1572             :  command("aggr", "subcorr", AGGRsubcorr, false, "Grouped correlation aggregate", args(1,6, batarg("",dbl),batarg("b1",flt),batarg("b2",flt),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1573             :  command("aggr", "subcorr", AGGRsubcorrcand, false, "Grouped correlation aggregate with candidate list", args(1,7, batarg("",dbl),batarg("b1",flt),batarg("b2",flt),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1574             :  command("aggr", "avg", AGGRavg13_dbl, false, "Grouped tail average on dbl", args(1,4, batarg("",dbl),batarg("b",dbl),batarg("g",oid),batargany("e",1))),
    1575             :  command("aggr", "avg", AGGRavg23_dbl, false, "Grouped tail average on dbl, also returns count", args(2,5, batarg("",dbl),batarg("",lng),batarg("b",dbl),batarg("g",oid),batargany("e",1))),
    1576             :  command("aggr", "avg", AGGRavg14_dbl, false, "Grouped tail average on dbl", args(1,5, batarg("",dbl),batarg("b",dbl),batarg("g",oid),batargany("e",1),arg("scale",int))),
    1577             :  command("aggr", "avg", AGGRavg24_dbl, false, "Grouped tail average on dbl, also returns count", args(2,6, batarg("",dbl),batarg("",lng),batarg("b",dbl),batarg("g",oid),batargany("e",1),arg("scale",int))),
    1578             :  command("aggr", "subavg", AGGRsubavg1_dbl, false, "Grouped average aggregate", args(1,5, batarg("",dbl),batarg("b",dbl),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1579             :  command("aggr", "subavg", AGGRsubavg1cand_dbl, false, "Grouped average aggregate with candidates list", args(1,6, batarg("",dbl),batarg("b",dbl),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1580             :  command("aggr", "subavg", AGGRsubavg2_dbl, false, "Grouped average aggregate, also returns count", args(2,6, batarg("",dbl),batarg("",lng),batarg("b",dbl),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1581             :  command("aggr", "subavg", AGGRsubavg2cand_dbl, false, "Grouped average aggregate with candidates list, also returns count", args(2,7, batarg("",dbl),batarg("",lng),batarg("b",dbl),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1582             :  command("aggr", "subavg", AGGRsubavg1s_dbl, false, "Grouped average aggregate", args(1,6, batarg("",dbl),batarg("b",dbl),batarg("g",oid),batargany("e",1),arg("skip_nils",bit),arg("scale",int))),
    1583             :  command("aggr", "subavg", AGGRsubavg1scand_dbl, false, "Grouped average aggregate with candidates list", args(1,7, batarg("",dbl),batarg("b",dbl),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit),arg("scale",int))),
    1584             :  command("aggr", "subavg", AGGRsubavg2s_dbl, false, "Grouped average aggregate, also returns count", args(2,7, batarg("",dbl),batarg("",lng),batarg("b",dbl),batarg("g",oid),batargany("e",1),arg("skip_nils",bit),arg("scale",int))),
    1585             :  command("aggr", "subavg", AGGRsubavg2scand_dbl, false, "Grouped average aggregate with candidates list, also returns count", args(2,8, batarg("",dbl),batarg("",lng),batarg("b",dbl),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit),arg("scale",int))),
    1586             :  command("aggr", "stdev", AGGRstdev3_dbl, false, "Grouped tail standard deviation (sample/non-biased) on dbl", args(1,4, batarg("",dbl),batarg("b",dbl),batarg("g",oid),batargany("e",1))),
    1587             :  command("aggr", "substdev", AGGRsubstdev_dbl, false, "Grouped standard deviation (sample/non-biased) aggregate", args(1,5, batarg("",dbl),batarg("b",dbl),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1588             :  command("aggr", "substdev", AGGRsubstdevcand_dbl, false, "Grouped standard deviation (sample/non-biased) aggregate with candidates list", args(1,6, batarg("",dbl),batarg("b",dbl),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1589             :  command("aggr", "stdevp", AGGRstdevp3_dbl, false, "Grouped tail standard deviation (population/biased) on dbl", args(1,4, batarg("",dbl),batarg("b",dbl),batarg("g",oid),batargany("e",1))),
    1590             :  command("aggr", "substdevp", AGGRsubstdevp_dbl, false, "Grouped standard deviation (population/biased) aggregate", args(1,5, batarg("",dbl),batarg("b",dbl),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1591             :  command("aggr", "substdevp", AGGRsubstdevpcand_dbl, false, "Grouped standard deviation (population/biased) aggregate with candidates list", args(1,6, batarg("",dbl),batarg("b",dbl),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1592             :  command("aggr", "variance", AGGRvariance3_dbl, false, "Grouped tail variance (sample/non-biased) on dbl", args(1,4, batarg("",dbl),batarg("b",dbl),batarg("g",oid),batargany("e",1))),
    1593             :  command("aggr", "subvariance", AGGRsubvariance_dbl, false, "Grouped variance (sample/non-biased) aggregate", args(1,5, batarg("",dbl),batarg("b",dbl),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1594             :  command("aggr", "subvariance", AGGRsubvariancecand_dbl, false, "Grouped variance (sample/non-biased) aggregate with candidates list", args(1,6, batarg("",dbl),batarg("b",dbl),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1595             :  command("aggr", "variancep", AGGRvariancep3_dbl, false, "Grouped tail variance (population/biased) on dbl", args(1,4, batarg("",dbl),batarg("b",dbl),batarg("g",oid),batargany("e",1))),
    1596             :  command("aggr", "subvariancep", AGGRsubvariancep_dbl, false, "Grouped variance (population/biased) aggregate", args(1,5, batarg("",dbl),batarg("b",dbl),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1597             :  command("aggr", "subvariancep", AGGRsubvariancepcand_dbl, false, "Grouped variance (population/biased) aggregate with candidates list", args(1,6, batarg("",dbl),batarg("b",dbl),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1598             :  command("aggr", "covariance", AGGRcovariance, false, "Covariance sample aggregate", args(1,5, batarg("",dbl),batarg("b1",dbl),batarg("b2",dbl),batarg("g",oid),batargany("e",1))),
    1599             :  command("aggr", "subcovariance", AGGRsubcovariance, false, "Grouped covariance sample aggregate", args(1,6, batarg("",dbl),batarg("b1",dbl),batarg("b2",dbl),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1600             :  command("aggr", "subcovariance", AGGRsubcovariancecand, false, "Grouped covariance sample aggregate with candidate list", args(1,7, batarg("",dbl),batarg("b1",dbl),batarg("b2",dbl),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1601             :  command("aggr", "covariancep", AGGRcovariancep, false, "Covariance population aggregate", args(1,5, batarg("",dbl),batarg("b1",dbl),batarg("b2",dbl),batarg("g",oid),batargany("e",1))),
    1602             :  command("aggr", "subcovariancep", AGGRsubcovariancep, false, "Grouped covariance population aggregate", args(1,6, batarg("",dbl),batarg("b1",dbl),batarg("b2",dbl),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1603             :  command("aggr", "subcovariancep", AGGRsubcovariancepcand, false, "Grouped covariance population aggregate with candidate list", args(1,7, batarg("",dbl),batarg("b1",dbl),batarg("b2",dbl),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1604             :  command("aggr", "corr", AGGRcorr, false, "Correlation aggregate", args(1,5, batarg("",dbl),batarg("b1",dbl),batarg("b2",dbl),batarg("g",oid),batargany("e",1))),
    1605             :  command("aggr", "subcorr", AGGRsubcorr, false, "Grouped correlation aggregate", args(1,6, batarg("",dbl),batarg("b1",dbl),batarg("b2",dbl),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1606             :  command("aggr", "subcorr", AGGRsubcorrcand, false, "Grouped correlation aggregate with candidate list", args(1,7, batarg("",dbl),batarg("b1",dbl),batarg("b2",dbl),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1607             :  command("aggr", "min", AGGRmin3, false, "", args(1,4, batargany("",1),batargany("b",1),batarg("g",oid),batargany("e",2))),
    1608             :  command("aggr", "max", AGGRmax3, false, "", args(1,4, batargany("",1),batargany("b",1),batarg("g",oid),batargany("e",2))),
    1609             :  command("aggr", "submin", AGGRsubmin, false, "Grouped minimum aggregate", args(1,5, batarg("",oid),batargany("b",1),batarg("g",oid),batargany("e",2),arg("skip_nils",bit))),
    1610             :  command("aggr", "submin", AGGRsubmincand, false, "Grouped minimum aggregate with candidates list", args(1,6, batarg("",oid),batargany("b",1),batarg("g",oid),batargany("e",2),batarg("s",oid),arg("skip_nils",bit))),
    1611             :  command("aggr", "submax", AGGRsubmax, false, "Grouped maximum aggregate", args(1,5, batarg("",oid),batargany("b",1),batarg("g",oid),batargany("e",2),arg("skip_nils",bit))),
    1612             :  command("aggr", "submax", AGGRsubmaxcand, false, "Grouped maximum aggregate with candidates list", args(1,6, batarg("",oid),batargany("b",1),batarg("g",oid),batargany("e",2),batarg("s",oid),arg("skip_nils",bit))),
    1613             :  command("aggr", "submin", AGGRsubmin_val, false, "Grouped minimum aggregate", args(1,5, batargany("",1),batargany("b",1),batarg("g",oid),batargany("e",2),arg("skip_nils",bit))),
    1614             :  command("aggr", "submin", AGGRsubmincand_val, false, "Grouped minimum aggregate with candidates list", args(1,6, batargany("",1),batargany("b",1),batarg("g",oid),batargany("e",2),batarg("s",oid),arg("skip_nils",bit))),
    1615             :  command("aggr", "submax", AGGRsubmax_val, false, "Grouped maximum aggregate", args(1,5, batargany("",1),batargany("b",1),batarg("g",oid),batargany("e",2),arg("skip_nils",bit))),
    1616             :  command("aggr", "submax", AGGRsubmaxcand_val, false, "Grouped maximum aggregate with candidates list", args(1,6, batargany("",1),batargany("b",1),batarg("g",oid),batargany("e",2),batarg("s",oid),arg("skip_nils",bit))),
    1617             :  command("aggr", "count", AGGRcount3, false, "", args(1,5, batarg("",lng),batargany("b",1),batarg("g",oid),batargany("e",2),arg("ignorenils",bit))),
    1618             :  command("aggr", "count", AGGRcount3nils, false, "Grouped count", args(1,4, batarg("",lng),batargany("b",1),batarg("g",oid),batargany("e",2))),
    1619             :  command("aggr", "count_no_nil", AGGRcount3nonils, false, "", args(1,4, batarg("",lng),batargany("b",1),batarg("g",oid),batargany("e",2))),
    1620             :  command("aggr", "subcount", AGGRsubcount, false, "Grouped count aggregate", args(1,5, batarg("",lng),batargany("b",1),batarg("g",oid),batargany("e",2),arg("skip_nils",bit))),
    1621             :  command("aggr", "subcount", AGGRsubcountcand, false, "Grouped count aggregate with candidates list", args(1,6, batarg("",lng),batargany("b",1),batarg("g",oid),batargany("e",2),batarg("s",oid),arg("skip_nils",bit))),
    1622             :  command("aggr", "median", AGGRmedian, false, "Median aggregate", args(1,2, argany("",1),batargany("b",1))),
    1623             :  command("aggr", "submedian", AGGRsubmedian, false, "Grouped median aggregate", args(1,5, batargany("",1),batargany("b",1),batarg("g",oid),batargany("e",2),arg("skip_nils",bit))),
    1624             :  command("aggr", "submedian", AGGRsubmediancand, false, "Grouped median aggregate with candidate list", args(1,6, batargany("",1),batargany("b",1),batarg("g",oid),batargany("e",2),batarg("s",oid),arg("skip_nils",bit))),
    1625             :  command("aggr", "quantile", AGGRquantile, false, "Quantile aggregate", args(1,3, argany("",1),batargany("b",1),batarg("q",dbl))),
    1626             :  command("aggr", "quantile", AGGRquantile_cst, false, "Quantile aggregate", args(1,3, argany("",1),batargany("b",1),arg("q",dbl))),
    1627             :  command("aggr", "subquantile", AGGRsubquantile, false, "Grouped quantile aggregate", args(1,6, batargany("",1),batargany("b",1),batarg("q",dbl),batarg("g",oid),batargany("e",2),arg("skip_nils",bit))),
    1628             :  command("aggr", "subquantile", AGGRsubquantilecand, false, "Grouped quantile aggregate with candidate list", args(1,7, batargany("",1),batargany("b",1),batarg("q",dbl),batarg("g",oid),batargany("e",2),batarg("s",oid),arg("skip_nils",bit))),
    1629             :  command("aggr", "median_avg", AGGRmedian_avg, false, "Median aggregate", args(1,2, arg("",dbl),batargany("b",1))),
    1630             :  command("aggr", "submedian_avg", AGGRsubmedian_avg, false, "Grouped median aggregate", args(1,5, batarg("",dbl),batargany("b",1),batarg("g",oid),batargany("e",2),arg("skip_nils",bit))),
    1631             :  command("aggr", "submedian_avg", AGGRsubmediancand_avg, false, "Grouped median aggregate with candidate list", args(1,6, batarg("",dbl),batargany("b",1),batarg("g",oid),batargany("e",2),batarg("s",oid),arg("skip_nils",bit))),
    1632             :  command("aggr", "quantile_avg", AGGRquantile_avg, false, "Quantile aggregate", args(1,3, arg("",dbl),batargany("b",1),batarg("q",dbl))),
    1633             :  command("aggr", "quantile_avg", AGGRquantile_avg_cst, false, "Quantile aggregate", args(1,3, arg("",dbl),batargany("b",1),arg("q",dbl))),
    1634             :  command("aggr", "subquantile_avg", AGGRsubquantile_avg, false, "Grouped quantile aggregate", args(1,6, batarg("",dbl),batargany("b",1),batarg("q",dbl),batarg("g",oid),batargany("e",2),arg("skip_nils",bit))),
    1635             :  command("aggr", "subquantile_avg", AGGRsubquantilecand_avg, false, "Grouped quantile aggregate with candidate list", args(1,7, batarg("",dbl),batargany("b",1),batarg("q",dbl),batarg("g",oid),batargany("e",2),batarg("s",oid),arg("skip_nils",bit))),
    1636             :  command("aggr", "str_group_concat", AGGRstr_group_concat, false, "Grouped string tail concat", args(1,4, batarg("",str),batarg("b",str),batarg("g",oid),batargany("e",1))),
    1637             :  command("aggr", "substr_group_concat", AGGRsubstr_group_concat, false, "Grouped string concat", args(1,5, batarg("",str),batarg("b",str),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1638             :  command("aggr", "substr_group_concat", AGGRsubstr_group_concatcand, false, "Grouped string concat with candidates list", args(1,6, batarg("",str),batarg("b",str),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1639             :  command("aggr", "str_group_concat", AGGRstr_group_concat_sep, false, "Grouped string tail concat with custom separator", args(1,5, batarg("",str),batarg("b",str),batarg("sep",str),batarg("g",oid),batargany("e",1))),
    1640             :  command("aggr", "substr_group_concat", AGGRsubstr_group_concat_sep, false, "Grouped string concat with custom separator", args(1,6, batarg("",str),batarg("b",str),batarg("sep",str),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1641             :  command("aggr", "substr_group_concat", AGGRsubstr_group_concatcand_sep, false, "Grouped string concat with candidates list with custom separator", args(1,7, batarg("",str),batarg("b",str),batarg("sep",str),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1642             : 
    1643             :  command("aggr", "subavg", AGGRavg3, false, "Grouped average aggregation", args(3,8, batarg("",bte),batarg("",lng),batarg("",lng),batarg("b",bte),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1644             :  command("aggr", "subavg", AGGRavg3, false, "Grouped average aggregation", args(3,8, batarg("",sht),batarg("",lng),batarg("",lng),batarg("b",sht),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1645             :  command("aggr", "subavg", AGGRavg3, false, "Grouped average aggregation", args(3,8, batarg("",int),batarg("",lng),batarg("",lng),batarg("b",int),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1646             :  command("aggr", "subavg", AGGRavg3, false, "Grouped average aggregation", args(3,8, batarg("",lng),batarg("",lng),batarg("",lng),batarg("b",lng),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1647             : #ifdef HAVE_HGE
    1648             :  command("aggr", "subavg", AGGRavg3, false, "Grouped average aggregation", args(3,8, batarg("",hge),batarg("",lng),batarg("",lng),batarg("b",hge),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1649             : #endif
    1650             :  command("aggr", "subavg", AGGRavg3comb, false, "Grouped average aggregation combiner", args(1,7, batarg("",bte),batarg("b",bte),batarg("r",lng),batarg("c",lng),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1651             :  command("aggr", "subavg", AGGRavg3comb, false, "Grouped average aggregation combiner", args(1,7, batarg("",sht),batarg("b",sht),batarg("r",lng),batarg("c",lng),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1652             :  command("aggr", "subavg", AGGRavg3comb, false, "Grouped average aggregation combiner", args(1,7, batarg("",int),batarg("b",int),batarg("r",lng),batarg("c",lng),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1653             :  command("aggr", "subavg", AGGRavg3comb, false, "Grouped average aggregation combiner", args(1,7, batarg("",lng),batarg("b",lng),batarg("r",lng),batarg("c",lng),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1654             : #ifdef HAVE_HGE
    1655             :  command("aggr", "subavg", AGGRavg3comb, false, "Grouped average aggregation combiner", args(1,7, batarg("",hge),batarg("b",hge),batarg("r",lng),batarg("c",lng),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1656             : #endif
    1657             : 
    1658             : #ifdef HAVE_HGE
    1659             :  command("aggr", "sum", AGGRsum3_hge, false, "Grouped tail sum on bte", args(1,4, batarg("",hge),batarg("b",bte),batarg("g",oid),batargany("e",1))),
    1660             :  command("aggr", "subsum", AGGRsubsum_hge, false, "Grouped sum aggregate", args(1,5, batarg("",hge),batarg("b",bte),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1661             :  command("aggr", "subsum", AGGRsubsumcand_hge, false, "Grouped sum aggregate with candidates list", args(1,6, batarg("",hge),batarg("b",bte),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1662             :  command("aggr", "prod", AGGRprod3_hge, false, "Grouped tail product on bte", args(1,4, batarg("",hge),batarg("b",bte),batarg("g",oid),batargany("e",1))),
    1663             :  command("aggr", "subprod", AGGRsubprod_hge, false, "Grouped product aggregate", args(1,5, batarg("",hge),batarg("b",bte),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1664             :  command("aggr", "subprod", AGGRsubprodcand_hge, false, "Grouped product aggregate with candidates list", args(1,6, batarg("",hge),batarg("b",bte),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1665             :  command("aggr", "sum", AGGRsum3_hge, false, "Grouped tail sum on sht", args(1,4, batarg("",hge),batarg("b",sht),batarg("g",oid),batargany("e",1))),
    1666             :  command("aggr", "subsum", AGGRsubsum_hge, false, "Grouped sum aggregate", args(1,5, batarg("",hge),batarg("b",sht),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1667             :  command("aggr", "subsum", AGGRsubsumcand_hge, false, "Grouped sum aggregate with candidates list", args(1,6, batarg("",hge),batarg("b",sht),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1668             :  command("aggr", "prod", AGGRprod3_hge, false, "Grouped tail product on sht", args(1,4, batarg("",hge),batarg("b",sht),batarg("g",oid),batargany("e",1))),
    1669             :  command("aggr", "subprod", AGGRsubprod_hge, false, "Grouped product aggregate", args(1,5, batarg("",hge),batarg("b",sht),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1670             :  command("aggr", "subprod", AGGRsubprodcand_hge, false, "Grouped product aggregate with candidates list", args(1,6, batarg("",hge),batarg("b",sht),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1671             :  command("aggr", "sum", AGGRsum3_hge, false, "Grouped tail sum on int", args(1,4, batarg("",hge),batarg("b",int),batarg("g",oid),batargany("e",1))),
    1672             :  command("aggr", "subsum", AGGRsubsum_hge, false, "Grouped sum aggregate", args(1,5, batarg("",hge),batarg("b",int),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1673             :  command("aggr", "subsum", AGGRsubsumcand_hge, false, "Grouped sum aggregate with candidates list", args(1,6, batarg("",hge),batarg("b",int),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1674             :  command("aggr", "prod", AGGRprod3_hge, false, "Grouped tail product on int", args(1,4, batarg("",hge),batarg("b",int),batarg("g",oid),batargany("e",1))),
    1675             :  command("aggr", "subprod", AGGRsubprod_hge, false, "Grouped product aggregate", args(1,5, batarg("",hge),batarg("b",int),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1676             :  command("aggr", "subprod", AGGRsubprodcand_hge, false, "Grouped product aggregate with candidates list", args(1,6, batarg("",hge),batarg("b",int),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1677             :  command("aggr", "sum", AGGRsum3_hge, false, "Grouped tail sum on lng", args(1,4, batarg("",hge),batarg("b",lng),batarg("g",oid),batargany("e",1))),
    1678             :  command("aggr", "subsum", AGGRsubsum_hge, false, "Grouped sum aggregate", args(1,5, batarg("",hge),batarg("b",lng),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1679             :  command("aggr", "subsum", AGGRsubsumcand_hge, false, "Grouped sum aggregate with candidates list", args(1,6, batarg("",hge),batarg("b",lng),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1680             :  command("aggr", "prod", AGGRprod3_hge, false, "Grouped tail product on lng", args(1,4, batarg("",hge),batarg("b",lng),batarg("g",oid),batargany("e",1))),
    1681             :  command("aggr", "subprod", AGGRsubprod_hge, false, "Grouped product aggregate", args(1,5, batarg("",hge),batarg("b",lng),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1682             :  command("aggr", "subprod", AGGRsubprodcand_hge, false, "Grouped product aggregate with candidates list", args(1,6, batarg("",hge),batarg("b",lng),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1683             :  command("aggr", "sum", AGGRsum3_hge, false, "Grouped tail sum on hge", args(1,4, batarg("",hge),batarg("b",hge),batarg("g",oid),batargany("e",1))),
    1684             :  command("aggr", "subsum", AGGRsubsum_hge, false, "Grouped sum aggregate", args(1,5, batarg("",hge),batarg("b",hge),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1685             :  command("aggr", "subsum", AGGRsubsumcand_hge, false, "Grouped sum aggregate with candidates list", args(1,6, batarg("",hge),batarg("b",hge),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1686             :  command("aggr", "prod", AGGRprod3_hge, false, "Grouped tail product on hge", args(1,4, batarg("",hge),batarg("b",hge),batarg("g",oid),batargany("e",1))),
    1687             :  command("aggr", "subprod", AGGRsubprod_hge, false, "Grouped product aggregate", args(1,5, batarg("",hge),batarg("b",hge),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1688             :  command("aggr", "subprod", AGGRsubprodcand_hge, false, "Grouped product aggregate with candidates list", args(1,6, batarg("",hge),batarg("b",hge),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1689             :  command("aggr", "avg", AGGRavg13_dbl, false, "Grouped tail average on hge", args(1,4, batarg("",dbl),batarg("b",hge),batarg("g",oid),batargany("e",1))),
    1690             :  command("aggr", "avg", AGGRavg23_dbl, false, "Grouped tail average on hge, also returns count", args(2,5, batarg("",dbl),batarg("",lng),batarg("b",hge),batarg("g",oid),batargany("e",1))),
    1691             :  command("aggr", "subavg", AGGRsubavg1_dbl, false, "Grouped average aggregate", args(1,5, batarg("",dbl),batarg("b",hge),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1692             :  command("aggr", "subavg", AGGRsubavg1cand_dbl, false, "Grouped average aggregate with candidates list", args(1,6, batarg("",dbl),batarg("b",hge),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1693             :  command("aggr", "subavg", AGGRsubavg2_dbl, false, "Grouped average aggregate, also returns count", args(2,6, batarg("",dbl),batarg("",lng),batarg("b",hge),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1694             :  command("aggr", "subavg", AGGRsubavg2cand_dbl, false, "Grouped average aggregate with candidates list, also returns count", args(2,7, batarg("",dbl),batarg("",lng),batarg("b",hge),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1695             :  command("aggr", "stdev", AGGRstdev3_dbl, false, "Grouped tail standard deviation (sample/non-biased) on hge", args(1,4, batarg("",dbl),batarg("b",hge),batarg("g",oid),batargany("e",1))),
    1696             :  command("aggr", "substdev", AGGRsubstdev_dbl, false, "Grouped standard deviation (sample/non-biased) aggregate", args(1,5, batarg("",dbl),batarg("b",hge),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1697             :  command("aggr", "substdev", AGGRsubstdevcand_dbl, false, "Grouped standard deviation (sample/non-biased) aggregate with candidates list", args(1,6, batarg("",dbl),batarg("b",hge),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1698             :  command("aggr", "stdevp", AGGRstdevp3_dbl, false, "Grouped tail standard deviation (population/biased) on hge", args(1,4, batarg("",dbl),batarg("b",hge),batarg("g",oid),batargany("e",1))),
    1699             :  command("aggr", "substdevp", AGGRsubstdevp_dbl, false, "Grouped standard deviation (population/biased) aggregate", args(1,5, batarg("",dbl),batarg("b",hge),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1700             :  command("aggr", "substdevp", AGGRsubstdevpcand_dbl, false, "Grouped standard deviation (population/biased) aggregate with candidates list", args(1,6, batarg("",dbl),batarg("b",hge),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1701             :  command("aggr", "variance", AGGRvariance3_dbl, false, "Grouped tail variance (sample/non-biased) on hge", args(1,4, batarg("",dbl),batarg("b",hge),batarg("g",oid),batargany("e",1))),
    1702             :  command("aggr", "subvariance", AGGRsubvariance_dbl, false, "Grouped variance (sample/non-biased) aggregate", args(1,5, batarg("",dbl),batarg("b",hge),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1703             :  command("aggr", "subvariance", AGGRsubvariancecand_dbl, false, "Grouped variance (sample/non-biased) aggregate with candidates list", args(1,6, batarg("",dbl),batarg("b",hge),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1704             :  command("aggr", "variancep", AGGRvariancep3_dbl, false, "Grouped tail variance (population/biased) on hge", args(1,4, batarg("",dbl),batarg("b",hge),batarg("g",oid),batargany("e",1))),
    1705             :  command("aggr", "subvariancep", AGGRsubvariancep_dbl, false, "Grouped variance (population/biased) aggregate", args(1,5, batarg("",dbl),batarg("b",hge),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1706             :  command("aggr", "subvariancep", AGGRsubvariancepcand_dbl, false, "Grouped variance (population/biased) aggregate with candidates list", args(1,6, batarg("",dbl),batarg("b",hge),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1707             :  command("aggr", "covariance", AGGRcovariance, false, "Covariance sample aggregate", args(1,5, batarg("",dbl),batarg("b1",hge),batarg("b2",hge),batarg("g",oid),batargany("e",1))),
    1708             :  command("aggr", "subcovariance", AGGRsubcovariance, false, "Grouped covariance sample aggregate", args(1,6, batarg("",dbl),batarg("b1",hge),batarg("b2",hge),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1709             :  command("aggr", "subcovariance", AGGRsubcovariancecand, false, "Grouped covariance sample aggregate with candidate list", args(1,7, batarg("",dbl),batarg("b1",hge),batarg("b2",hge),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1710             :  command("aggr", "covariancep", AGGRcovariancep, false, "Covariance population aggregate", args(1,5, batarg("",dbl),batarg("b1",hge),batarg("b2",hge),batarg("g",oid),batargany("e",1))),
    1711             :  command("aggr", "subcovariancep", AGGRsubcovariancep, false, "Grouped covariance population aggregate", args(1,6, batarg("",dbl),batarg("b1",hge),batarg("b2",hge),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1712             :  command("aggr", "subcovariancep", AGGRsubcovariancepcand, false, "Grouped covariance population aggregate with candidate list", args(1,7, batarg("",dbl),batarg("b1",hge),batarg("b2",hge),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1713             :  command("aggr", "corr", AGGRcorr, false, "Correlation aggregate", args(1,5, batarg("",dbl),batarg("b1",hge),batarg("b2",hge),batarg("g",oid),batargany("e",1))),
    1714             :  command("aggr", "subcorr", AGGRsubcorr, false, "Grouped correlation aggregate", args(1,6, batarg("",dbl),batarg("b1",hge),batarg("b2",hge),batarg("g",oid),batargany("e",1),arg("skip_nils",bit))),
    1715             :  command("aggr", "subcorr", AGGRsubcorrcand, false, "Grouped correlation aggregate with candidate list", args(1,7, batarg("",dbl),batarg("b1",hge),batarg("b2",hge),batarg("g",oid),batargany("e",1),batarg("s",oid),arg("skip_nils",bit))),
    1716             : #endif
    1717             :  { .imp=NULL }
    1718             : };
    1719             : #include "mal_import.h"
    1720             : #ifdef _MSC_VER
    1721             : #undef read
    1722             : #pragma section(".CRT$XCU",read)
    1723             : #endif
    1724         323 : LIB_STARTUP_FUNC(init_aggr_mal)
    1725         323 : { mal_module("aggr", NULL, aggr_init_funcs); }

Generated by: LCOV version 1.14