Changeset: be4e4b9b0ef4 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=be4e4b9b0ef4
Modified Files:
        clients/Tests/exports.stable.out
        monetdb5/modules/kernel/group.mx
Branch: Feb2013
Log Message:

Make group.subgroup with 4 args available.
The implementation was there, just make it available for use.  In
fact, it can be beneficial to have the extent and histo arguments when
calling subgroup, so give the opportunity to provide them.


diffs (99 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
@@ -1440,6 +1440,7 @@ str GRPslidingsum_sht(int *retval, int *
 str GRPslidingsum_wrd(int *retval, int *bid, int *size, int *shift);
 str GRPsubgroup1(bat *ngid, bat *next, bat *nhis, bat *bid);
 str GRPsubgroup2(bat *ngid, bat *next, bat *nhis, bat *bid, bat *gid);
+str GRPsubgroup4(bat *ngid, bat *next, bat *nhis, bat *bid, bat *gid, bat 
*eid, bat *hid);
 str GRPsum_bte_bte(int *retval, int *bid, int *eid, bit *ignore_nils);
 str GRPsum_bte_int(int *retval, int *bid, int *eid, bit *ignore_nils);
 str GRPsum_bte_lng(int *retval, int *bid, int *eid, bit *ignore_nils);
diff --git a/monetdb5/modules/kernel/group.mx b/monetdb5/modules/kernel/group.mx
--- a/monetdb5/modules/kernel/group.mx
+++ b/monetdb5/modules/kernel/group.mx
@@ -90,11 +90,15 @@ command subgroup(b:bat[:oid,:any_1]) (gr
 address GRPsubgroup1;
 command subgroup(b:bat[:oid,:any_1],g:bat[:oid,:oid]) 
(groups:bat[:oid,:oid],extents:bat[:oid,:oid],histo:bat[:oid,:wrd])
 address GRPsubgroup2;
+command 
subgroup(b:bat[:oid,:any_1],g:bat[:oid,:oid],e:bat[:oid,:oid],h:bat[:oid,:wrd]) 
(groups:bat[:oid,:oid],extents:bat[:oid,:oid],histo:bat[:oid,:wrd])
+address GRPsubgroup4;
 
 command subgroupdone(b:bat[:oid,:any_1]) 
(groups:bat[:oid,:oid],extents:bat[:oid,:oid],histo:bat[:oid,:wrd])
 address GRPsubgroup1;
 command subgroupdone(b:bat[:oid,:any_1],g:bat[:oid,:oid]) 
(groups:bat[:oid,:oid],extents:bat[:oid,:oid],histo:bat[:oid,:wrd])
 address GRPsubgroup2;
+command 
subgroupdone(b:bat[:oid,:any_1],g:bat[:oid,:oid],e:bat[:oid,:oid],h:bat[:oid,:wrd])
 (groups:bat[:oid,:oid],extents:bat[:oid,:oid],histo:bat[:oid,:wrd])
+address GRPsubgroup4;
 
 command new(attr:bat[:any_1,:any_2] )
        (histo:bat[:any_1,:wrd], grp:bat[:any_1,:void]) 
@@ -237,7 +241,10 @@ comment "Grouped count of true values";
 #endif
 
 group_export str GRPsubgroup1(bat *ngid, bat *next, bat *nhis, bat *bid);
-group_export str GRPsubgroup2(bat *ngid, bat *next, bat *nhis, bat *bid, bat 
*gid);
+group_export str GRPsubgroup2(bat *ngid, bat *next, bat *nhis,
+                                                         bat *bid, bat *gid);
+group_export str GRPsubgroup4(bat *ngid, bat *next, bat *nhis,
+                                                         bat *bid, bat *gid, 
bat *eid, bat *hid);
 group_export str GRPgroup(int *rethisto, int *retbid, int *bid);
 group_export str GRPderive(int *hid, int *mid, int *ct_histoid, int *ct_mapid, 
int *bid);
 group_export str GRPrefine(int *retid, int *bid, int *aid);
@@ -534,14 +541,28 @@ CTrefine_rev(BAT **res, BAT *b, BAT *a)
 
 
 str
-GRPsubgroup2(bat *ngid, bat *next, bat *nhis, bat *bid, bat *gid)
+GRPsubgroup4(bat *ngid, bat *next, bat *nhis, bat *bid, bat *gid, bat *eid, 
bat *hid)
 {
-       BAT *b, *g, *gn, *en, *hn;
+       BAT *b, *g, *e, *h, *gn, *en, *hn;
        gdk_return r;
 
        b = BATdescriptor(*bid);
        g = gid ? BATdescriptor(*gid) : NULL;
-       if ((r = BATgroup(&gn, &en, &hn, b, g, NULL, NULL)) == GDK_SUCCEED) {
+       e = eid ? BATdescriptor(*eid) : NULL;
+       h = hid ? BATdescriptor(*hid) : NULL;
+       if (b == NULL ||
+               (gid != NULL && g == NULL) ||
+               (eid != NULL && e == NULL) ||
+               (hid != NULL && h == NULL)) {
+               if (g)
+                       BBPreleaseref(g->batCacheid);
+               if (e)
+                       BBPreleaseref(e->batCacheid);
+               if (h)
+                       BBPreleaseref(h->batCacheid);
+               throw(MAL, "group.subgroup", RUNTIME_OBJECT_MISSING);
+       }
+       if ((r = BATgroup(&gn, &en, &hn, b, g, e, h)) == GDK_SUCCEED) {
                *ngid = gn->batCacheid;
                *next = en->batCacheid;
                *nhis = hn->batCacheid;
@@ -552,13 +573,23 @@ GRPsubgroup2(bat *ngid, bat *next, bat *
        BBPreleaseref(b->batCacheid);
        if (g)
                BBPreleaseref(g->batCacheid);
+       if (e)
+               BBPreleaseref(e->batCacheid);
+       if (h)
+               BBPreleaseref(h->batCacheid);
        return r == GDK_SUCCEED ? MAL_SUCCEED : createException(MAL, 
"group.subgroup", GDK_EXCEPTION);
 }
 
 str
+GRPsubgroup2(bat *ngid, bat *next, bat *nhis, bat *bid, bat *gid)
+{
+       return GRPsubgroup4(ngid, next, nhis, bid, gid, NULL, NULL);
+}
+
+str
 GRPsubgroup1(bat *ngid, bat *next, bat *nhis, bat *bid)
 {
-       return GRPsubgroup2(ngid, next, nhis, bid, NULL);
+       return GRPsubgroup4(ngid, next, nhis, bid, NULL, NULL, NULL);
 }
 
 str
_______________________________________________
checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to