Changeset: 746452020854 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/746452020854
Modified Files:
gdk/gdk_aggr.c
monetdb5/modules/kernel/aggr.c
Branch: Aug2024
Log Message:
Grouped quantiles (and medians) should also work if not all group ids are used.
diffs (52 lines):
diff --git a/gdk/gdk_aggr.c b/gdk/gdk_aggr.c
--- a/gdk/gdk_aggr.c
+++ b/gdk/gdk_aggr.c
@@ -4138,8 +4138,15 @@ doBATgroupquantile(BAT *b, BAT *g, BAT *
if (!skip_nils && !bi.nonil)
nils += (*atomcmp)(v, dnil) == 0;
}
+ while (min < prev) {
+ if (bunfastapp_nocheck(bn, dnil) != GDK_SUCCEED)
+ goto bunins_failed;
+ min++;
+ nils++;
+ }
if (bunfastapp_nocheck(bn, v) != GDK_SUCCEED)
goto bunins_failed;
+ min++;
}
bat_iterator_end(&bi);
nils += ngrp - BATcount(bn);
diff --git a/monetdb5/modules/kernel/aggr.c b/monetdb5/modules/kernel/aggr.c
--- a/monetdb5/modules/kernel/aggr.c
+++ b/monetdb5/modules/kernel/aggr.c
@@ -29,7 +29,7 @@ AGGRgrouped_bat_or_val(bat *retval1, bat
double, bool), const bat *quantile,
const double *quantile_val, const
char *malfunc)
{
- BAT *b, *g, *e, *s, *bn = NULL, *cnts = NULL, *q = NULL;
+ BAT *b, *g = NULL, *e = NULL, *s = NULL, *bn = NULL, *cnts = NULL, *q =
NULL;
double qvalue;
/* exactly one of grpfunc1, grpfunc2 and quantilefunc is non-NULL */
@@ -41,16 +41,11 @@ AGGRgrouped_bat_or_val(bat *retval1, bat
assert((quantilefunc == NULL) == (quantile == NULL && quantile_val ==
NULL));
b = BATdescriptor(*bid);
- g = gid ? BATdescriptor(*gid) : NULL;
- e = eid ? BATdescriptor(*eid) : NULL;
- s = sid ? BATdescriptor(*sid) : NULL;
- q = quantile ? BATdescriptor(*quantile) : NULL;
-
if (b == NULL ||
- (gid != NULL && g == NULL) ||
- (eid != NULL && e == NULL) ||
- (sid != NULL && s == NULL) ||
- ((quantile != NULL && quantile_val != NULL) && q == NULL)) {
+ (gid && !is_bat_nil(*gid) && (g = BATdescriptor(*gid)) == NULL)
||
+ (eid && !is_bat_nil(*eid) && (e = BATdescriptor(*eid)) == NULL)
||
+ (sid && !is_bat_nil(*sid) && (s = BATdescriptor(*sid)) == NULL)
||
+ (quantile && !is_bat_nil(*quantile) && (q =
BATdescriptor(*quantile)) == NULL)) {
BBPreclaim(b);
BBPreclaim(g);
BBPreclaim(e);
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]