Changeset: 68e0939218bd for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=68e0939218bd Modified Files: clients/Tests/exports.stable.out gdk/ChangeLog gdk/gdk.h gdk/gdk_aggr.c gdk/gdk_batop.c gdk/gdk_group.c gdk/gdk_imprints.c monetdb5/modules/atoms/batxml.c monetdb5/modules/atoms/json.c monetdb5/modules/kernel/algebra.c monetdb5/modules/kernel/bat5.c sql/backends/monet5/sql.c sql/storage/bat/bat_table.c Branch: default Log Message:
Renamed BATsubsort to BATsort. diffs (268 lines): diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out --- a/clients/Tests/exports.stable.out +++ b/clients/Tests/exports.stable.out @@ -173,8 +173,8 @@ void BATsetcapacity(BAT *b, BUN cnt); void BATsetcount(BAT *b, BUN cnt); void BATsetprop(BAT *b, int idx, int type, void *v); BAT *BATslice(BAT *b, BUN low, BUN high); +gdk_return BATsort(BAT **sorted, BAT **order, BAT **groups, BAT *b, BAT *o, BAT *g, int reverse, int stable); gdk_return BATsubcross(BAT **r1p, BAT **r2p, BAT *l, BAT *r, BAT *sl, BAT *sr); -gdk_return BATsubsort(BAT **sorted, BAT **order, BAT **groups, BAT *b, BAT *o, BAT *g, int reverse, int stable); gdk_return BATsum(void *res, int tp, BAT *b, BAT *s, int skip_nils, int abort_on_error, int nil_if_empty); gdk_return BATthetajoin(BAT **r1p, BAT **r2p, BAT *l, BAT *r, BAT *sl, BAT *sr, int op, int nil_matches, BUN estimate); BAT *BATthetaselect(BAT *b, BAT *s, const void *val, const char *op); diff --git a/gdk/ChangeLog b/gdk/ChangeLog --- a/gdk/ChangeLog +++ b/gdk/ChangeLog @@ -1,6 +1,9 @@ # ChangeLog file for MonetDB # This file is updated with Maddlog +* Fri Dec 11 2015 Sjoerd Mullender <[email protected]> +- Renamed BATsubsort to BATsort. + * Thu Dec 3 2015 Sjoerd Mullender <[email protected]> - Removed "sub" from the names of the function BATsubselect, BATthetasubselect, BATsubcross, BATsubleftjoin, BATsubouterjoin, diff --git a/gdk/gdk.h b/gdk/gdk.h --- a/gdk/gdk.h +++ b/gdk/gdk.h @@ -1573,7 +1573,7 @@ gdk_export gdk_return BATprintf(stream * */ gdk_export int BATordered(BAT *b); gdk_export int BATordered_rev(BAT *b); -gdk_export gdk_return BATsubsort(BAT **sorted, BAT **order, BAT **groups, BAT *b, BAT *o, BAT *g, int reverse, int stable); +gdk_export gdk_return BATsort(BAT **sorted, BAT **order, BAT **groups, BAT *b, BAT *o, BAT *g, int reverse, int stable); gdk_export void GDKqsort(void *h, void *t, const void *base, size_t n, int hs, int ts, int tpe); diff --git a/gdk/gdk_aggr.c b/gdk/gdk_aggr.c --- a/gdk/gdk_aggr.c +++ b/gdk/gdk_aggr.c @@ -2539,7 +2539,7 @@ BATgroupquantile(BAT *b, BAT *g, BAT *e, BBPunfix(g->batCacheid); return bn; } - BATsubsort(&t1, &t2, NULL, g, NULL, NULL, 0, 0); + BATsort(&t1, &t2, NULL, g, NULL, NULL, 0, 0); if (freeg) BBPunfix(g->batCacheid); g = t1; @@ -2547,7 +2547,7 @@ BATgroupquantile(BAT *b, BAT *g, BAT *e, } else { t2 = NULL; } - BATsubsort(&t1, NULL, NULL, b, t2, g, 0, 0); + BATsort(&t1, NULL, NULL, b, t2, g, 0, 0); if (freeb) BBPunfix(b->batCacheid); b = t1; diff --git a/gdk/gdk_batop.c b/gdk/gdk_batop.c --- a/gdk/gdk_batop.c +++ b/gdk/gdk_batop.c @@ -1119,10 +1119,10 @@ do_sort(void *h, void *t, const void *ba return GDK_SUCCEED; } -/* subsort the bat b according to both o and g. The stable and - * reverse parameters indicate whether the sort should be stable or - * descending respectively. The parameter b is required, o and g are - * optional (i.e., they may be NULL). +/* Sort the bat b according to both o and g. The stable and reverse + * parameters indicate whether the sort should be stable or descending + * respectively. The parameter b is required, o and g are optional + * (i.e., they may be NULL). * * A sorted copy is returned through the sorted parameter, the new * ordering is returned through the order parameter, group information @@ -1148,9 +1148,16 @@ do_sort(void *h, void *t, const void *ba * the order and groups bat from the previous call. In this case, the * sorted BATs are not of much use, so the sorted output parameter * does not need to be specified. + * Apart from error checking and maintaining reference counts, sorting + * three columns (col1, col2, col3) could look like this with the + * sorted results in (col1s, col2s, col3s): + * BATsort(&col1s, &ord1, &grp1, col1, NULL, NULL, 0, 0); + * BATsort(&col2s, &ord2, &grp2, col2, ord1, grp1, 0, 0); + * BATsort(&col3s, NULL, NULL, col3, ord2, grp2, 0, 0); + * Note that the "reverse" parameter can be different for each call. */ gdk_return -BATsubsort(BAT **sorted, BAT **order, BAT **groups, +BATsort(BAT **sorted, BAT **order, BAT **groups, BAT *b, BAT *o, BAT *g, int reverse, int stable) { BAT *bn = NULL, *on = NULL, *gn; @@ -1158,7 +1165,7 @@ BATsubsort(BAT **sorted, BAT **order, BA BUN p, q, r; if (b == NULL || !BAThdense(b)) { - GDKerror("BATsubsort: b must be dense-headed\n"); + GDKerror("BATsort: b must be dense-headed\n"); return GDK_FAIL; } if (o != NULL && @@ -1168,7 +1175,7 @@ BATsubsort(BAT **sorted, BAT **order, BA (o->ttype == TYPE_void && /* no nil tail */ BATcount(o) != 0 && o->tseqbase == oid_nil))) { - GDKerror("BATsubsort: o must be [dense,oid] and same size as b\n"); + GDKerror("BATsort: o must be [dense,oid] and same size as b\n"); return GDK_FAIL; } if (g != NULL && @@ -1179,7 +1186,7 @@ BATsubsort(BAT **sorted, BAT **order, BA (g->ttype == TYPE_void && /* no nil tail */ BATcount(g) != 0 && g->tseqbase == oid_nil))) { - GDKerror("BATsubsort: g must be [dense,oid], sorted on the tail, and same size as b\n"); + GDKerror("BATsort: g must be [dense,oid], sorted on the tail, and same size as b\n"); return GDK_FAIL; } assert(reverse == 0 || reverse == 1); diff --git a/gdk/gdk_group.c b/gdk/gdk_group.c --- a/gdk/gdk_group.c +++ b/gdk/gdk_group.c @@ -42,7 +42,7 @@ * sorted), we produce a single group or copy the input group. * * If the input bats b and g are sorted, or if the subsorted flag is - * set (only used by BATsubsort), we only need to compare consecutive + * set (only used by BATsort), we only need to compare consecutive * values. * * If the input bat b is sorted, but g is not, we can compare diff --git a/gdk/gdk_imprints.c b/gdk/gdk_imprints.c --- a/gdk/gdk_imprints.c +++ b/gdk/gdk_imprints.c @@ -746,7 +746,7 @@ BATimprints(BAT *b) return GDK_FAIL; } s->tkey = 1; /* we know is unique on tail now */ - if (BATsubsort(&smp, NULL, NULL, s, NULL, NULL, 0, 0) != GDK_SUCCEED) { + if (BATsort(&smp, NULL, NULL, s, NULL, NULL, 0, 0) != GDK_SUCCEED) { MT_lock_unset(&GDKimprintsLock(abs(b->batCacheid))); BBPunfix(s->batCacheid); GDKfree(imprints); diff --git a/monetdb5/modules/atoms/batxml.c b/monetdb5/modules/atoms/batxml.c --- a/monetdb5/modules/atoms/batxml.c +++ b/monetdb5/modules/atoms/batxml.c @@ -1247,7 +1247,7 @@ BATxmlaggr(BAT **bnp, BAT *b, BAT *g, BA bi = bat_iterator(b); if (g) { /* stable sort g */ - if (BATsubsort(&t1, &t2, NULL, g, NULL, NULL, 0, 1) != GDK_SUCCEED) { + if (BATsort(&t1, &t2, NULL, g, NULL, NULL, 0, 1) != GDK_SUCCEED) { BBPreclaim(bn); bn = NULL; err = "internal sort failed"; diff --git a/monetdb5/modules/atoms/json.c b/monetdb5/modules/atoms/json.c --- a/monetdb5/modules/atoms/json.c +++ b/monetdb5/modules/atoms/json.c @@ -1899,7 +1899,7 @@ JSONjsonaggr(BAT **bnp, BAT *b, BAT *g, bi = bat_iterator(b); if (g) { /* stable sort g */ - if (BATsubsort(&t1, &t2, NULL, g, NULL, NULL, 0, 1) != GDK_SUCCEED) { + if (BATsort(&t1, &t2, NULL, g, NULL, NULL, 0, 1) != GDK_SUCCEED) { BBPreclaim(bn); bn = NULL; err = "internal sort failed"; diff --git a/monetdb5/modules/kernel/algebra.c b/monetdb5/modules/kernel/algebra.c --- a/monetdb5/modules/kernel/algebra.c +++ b/monetdb5/modules/kernel/algebra.c @@ -715,7 +715,7 @@ ALGsubsort33(bat *result, bat *norder, b BBPunfix(b->batCacheid); throw(MAL, "algebra.subsort", RUNTIME_OBJECT_MISSING); } - if (BATsubsort(result ? &bn : NULL, + if (BATsort(result ? &bn : NULL, norder ? &on : NULL, ngroup ? &gn : NULL, b, o, g, *reverse, *stable) != GDK_SUCCEED) { diff --git a/monetdb5/modules/kernel/bat5.c b/monetdb5/modules/kernel/bat5.c --- a/monetdb5/modules/kernel/bat5.c +++ b/monetdb5/modules/kernel/bat5.c @@ -1268,7 +1268,7 @@ BKCshrinkBAT(bat *ret, const bat *bid, c BBPunfix(d->batCacheid); throw(MAL, "bat.shrink", MAL_MALLOC_FAIL ); } - res = BATsubsort(&bs, NULL, NULL, d, NULL, NULL, 0, 0); + res = BATsort(&bs, NULL, NULL, d, NULL, NULL, 0, 0); BBPunfix(d->batCacheid); if (res != GDK_SUCCEED) { BBPunfix(b->batCacheid); @@ -1359,7 +1359,7 @@ BKCshrinkBATmap(bat *ret, const bat *bid BBPunfix(d->batCacheid); throw(MAL, "bat.shrinkMap", MAL_MALLOC_FAIL ); } - res = BATsubsort(&bs, NULL, NULL, d, NULL, NULL, 0, 0); + res = BATsort(&bs, NULL, NULL, d, NULL, NULL, 0, 0); BBPunfix(d->batCacheid); if (res != GDK_SUCCEED) { BBPunfix(b->batCacheid); @@ -1437,7 +1437,7 @@ BKCreuseBAT(bat *ret, const bat *bid, co BBPunfix(d->batCacheid); throw(MAL, "bat.reuse", MAL_MALLOC_FAIL ); } - res = BATsubsort(&bs, NULL, NULL, d, NULL, NULL, 0, 0); + res = BATsort(&bs, NULL, NULL, d, NULL, NULL, 0, 0); BBPunfix(d->batCacheid); if (res != GDK_SUCCEED) { BBPunfix(b->batCacheid); @@ -1533,7 +1533,7 @@ BKCreuseBATmap(bat *ret, const bat *bid, BBPunfix(d->batCacheid); throw(MAL, "bat.shrinkMap", MAL_MALLOC_FAIL ); } - res = BATsubsort(&bs, NULL, NULL, d, NULL, NULL, 0, 0); + res = BATsort(&bs, NULL, NULL, d, NULL, NULL, 0, 0); BBPunfix(d->batCacheid); if (res != GDK_SUCCEED) { BBPunfix(b->batCacheid); diff --git a/sql/backends/monet5/sql.c b/sql/backends/monet5/sql.c --- a/sql/backends/monet5/sql.c +++ b/sql/backends/monet5/sql.c @@ -2313,7 +2313,7 @@ DELTAsub(bat *result, const bat *col, co BATappend(res, u, TRUE); BBPunfix(u->batCacheid); - ret = BATsubsort(&u, NULL, NULL, res, NULL, NULL, 0, 0); + ret = BATsort(&u, NULL, NULL, res, NULL, NULL, 0, 0); BBPunfix(res->batCacheid); if (ret != GDK_SUCCEED) { BBPunfix(c->batCacheid); @@ -2351,7 +2351,7 @@ DELTAsub(bat *result, const bat *col, co BATappend(res, i, TRUE); BBPunfix(i->batCacheid); - ret = BATsubsort(&u, NULL, NULL, res, NULL, NULL, 0, 0); + ret = BATsort(&u, NULL, NULL, res, NULL, NULL, 0, 0); BBPunfix(res->batCacheid); if (ret != GDK_SUCCEED) throw(MAL, "sql.delta", RUNTIME_OBJECT_MISSING); diff --git a/sql/storage/bat/bat_table.c b/sql/storage/bat/bat_table.c --- a/sql/storage/bat/bat_table.c +++ b/sql/storage/bat/bat_table.c @@ -312,7 +312,7 @@ rids_orderby(sql_trans *tr, rids *r, sql b = full_column(tr, orderby_col); s = BATproject(r->data, b); full_destroy(orderby_col, b); - BATsubsort(NULL, &o, NULL, s, NULL, NULL, 0, 0); + BATsort(NULL, &o, NULL, s, NULL, NULL, 0, 0); bat_destroy(s); s = BATproject(o, r->data); bat_destroy(r->data); @@ -391,11 +391,11 @@ subrids_create(sql_trans *tr, rids *t1, /* need id, obc */ ids = o = g = NULL; - BATsubsort(&ids, &o, &g, lcb, NULL, NULL, 0, 0); + BATsort(&ids, &o, &g, lcb, NULL, NULL, 0, 0); bat_destroy(lcb); s = NULL; - BATsubsort(NULL, &s, NULL, obb, o, g, 0, 0); + BATsort(NULL, &s, NULL, obb, o, g, 0, 0); bat_destroy(obb); bat_destroy(o); bat_destroy(g); _______________________________________________ checkin-list mailing list [email protected] https://www.monetdb.org/mailman/listinfo/checkin-list
