Changeset: 2f7e7c3c8591 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/2f7e7c3c8591
Modified Files:
        monetdb5/modules/kernel/aggr.c
        monetdb5/modules/mal/calc.c
Branch: resource_management
Log Message:

Merge with default branch.


diffs (truncated from 404 to 300 lines):

diff --git a/clients/Tests/MAL-signatures-hge.test 
b/clients/Tests/MAL-signatures-hge.test
--- a/clients/Tests/MAL-signatures-hge.test
+++ b/clients/Tests/MAL-signatures-hge.test
@@ -1125,54 +1125,14 @@ ALGstdevp
 Gives the standard deviation of all tail values
 aggr
 str_group_concat
-command aggr.str_group_concat(X_0:bat[:str], X_1:bat[:oid], 
X_2:bat[:any_1]):bat[:str]
+command aggr.str_group_concat(X_0:bat[:str]):str
 AGGRstr_group_concat
-Grouped string tail concat
-aggr
-str_group_concat
-command aggr.str_group_concat(X_0:bat[:str], X_1:bat[:str], X_2:bat[:oid], 
X_3:bat[:any_1]):bat[:str]
-AGGRstr_group_concat_sep
-Grouped string tail concat with custom separator
-aggr
-str_group_concat
-pattern aggr.str_group_concat(X_0:bat[:str]):str
-CMDBATstr_group_concat
-Calculate aggregate string concatenate of B.
-aggr
-str_group_concat
-pattern aggr.str_group_concat(X_0:bat[:str], X_1:bat[:oid]):str
-CMDBATstr_group_concat
-Calculate aggregate string concatenate of B with candidate list.
+Ungrouped string tail concat
 aggr
 str_group_concat
-pattern aggr.str_group_concat(X_0:bat[:str], X_1:bat[:oid], X_2:bit):str
-CMDBATstr_group_concat
-Calculate aggregate string concatenate of B with candidate list.
-aggr
-str_group_concat
-pattern aggr.str_group_concat(X_0:bat[:str], X_1:bat[:str]):str
-CMDBATstr_group_concat
-Calculate aggregate string concatenate of B with separator SEP.
-aggr
-str_group_concat
-pattern aggr.str_group_concat(X_0:bat[:str], X_1:bat[:str], X_2:bat[:oid]):str
-CMDBATstr_group_concat
-Calculate aggregate string concatenate of B with candidate list and separator 
SEP.
-aggr
-str_group_concat
-pattern aggr.str_group_concat(X_0:bat[:str], X_1:bat[:str], X_2:bat[:oid], 
X_3:bit):str
-CMDBATstr_group_concat
-Calculate aggregate string concatenate of B with candidate list and separator 
SEP.
-aggr
-str_group_concat
-pattern aggr.str_group_concat(X_0:bat[:str], X_1:bat[:str], X_2:bit):str
-CMDBATstr_group_concat
-Calculate aggregate string concatenate of B with separator SEP.
-aggr
-str_group_concat
-pattern aggr.str_group_concat(X_0:bat[:str], X_1:bit):str
-CMDBATstr_group_concat
-Calculate aggregate string concatenate of B.
+command aggr.str_group_concat(X_0:bat[:str], X_1:bat[:str]):str
+AGGRstr_group_concat_sep
+Ungrouped string tail concat with custom separator
 aggr
 subCollect
 command aggr.subCollect(X_0:bat[:wkb], X_1:bat[:oid], X_2:bat[:oid], 
X_3:bit):bat[:wkb]
@@ -2224,16 +2184,6 @@ command aggr.substr_group_concat(X_0:bat
 AGGRsubstr_group_concat_sep
 Grouped string concat with custom separator
 aggr
-substr_group_concat
-command aggr.substr_group_concat(X_0:bat[:str], X_1:bat[:oid], 
X_2:bat[:any_1], X_3:bat[:oid], X_4:bit):bat[:str]
-AGGRsubstr_group_concatcand
-Grouped string concat with candidates list
-aggr
-substr_group_concat
-command aggr.substr_group_concat(X_0:bat[:str], X_1:bat[:str], X_2:bat[:oid], 
X_3:bat[:any_1], X_4:bat[:oid], X_5:bit):bat[:str]
-AGGRsubstr_group_concatcand_sep
-Grouped string concat with candidates list with custom separator
-aggr
 subsum
 command aggr.subsum(X_0:bat[:bte], X_1:bat[:oid], X_2:bat[:any_1], 
X_3:bit):bat[:bte]
 AGGRsubsum_bte
diff --git a/clients/Tests/MAL-signatures.test 
b/clients/Tests/MAL-signatures.test
--- a/clients/Tests/MAL-signatures.test
+++ b/clients/Tests/MAL-signatures.test
@@ -935,54 +935,14 @@ ALGstdevp
 Gives the standard deviation of all tail values
 aggr
 str_group_concat
-command aggr.str_group_concat(X_0:bat[:str], X_1:bat[:oid], 
X_2:bat[:any_1]):bat[:str]
+command aggr.str_group_concat(X_0:bat[:str]):str
 AGGRstr_group_concat
-Grouped string tail concat
-aggr
-str_group_concat
-command aggr.str_group_concat(X_0:bat[:str], X_1:bat[:str], X_2:bat[:oid], 
X_3:bat[:any_1]):bat[:str]
-AGGRstr_group_concat_sep
-Grouped string tail concat with custom separator
-aggr
-str_group_concat
-pattern aggr.str_group_concat(X_0:bat[:str]):str
-CMDBATstr_group_concat
-Calculate aggregate string concatenate of B.
-aggr
-str_group_concat
-pattern aggr.str_group_concat(X_0:bat[:str], X_1:bat[:oid]):str
-CMDBATstr_group_concat
-Calculate aggregate string concatenate of B with candidate list.
+Ungrouped string tail concat
 aggr
 str_group_concat
-pattern aggr.str_group_concat(X_0:bat[:str], X_1:bat[:oid], X_2:bit):str
-CMDBATstr_group_concat
-Calculate aggregate string concatenate of B with candidate list.
-aggr
-str_group_concat
-pattern aggr.str_group_concat(X_0:bat[:str], X_1:bat[:str]):str
-CMDBATstr_group_concat
-Calculate aggregate string concatenate of B with separator SEP.
-aggr
-str_group_concat
-pattern aggr.str_group_concat(X_0:bat[:str], X_1:bat[:str], X_2:bat[:oid]):str
-CMDBATstr_group_concat
-Calculate aggregate string concatenate of B with candidate list and separator 
SEP.
-aggr
-str_group_concat
-pattern aggr.str_group_concat(X_0:bat[:str], X_1:bat[:str], X_2:bat[:oid], 
X_3:bit):str
-CMDBATstr_group_concat
-Calculate aggregate string concatenate of B with candidate list and separator 
SEP.
-aggr
-str_group_concat
-pattern aggr.str_group_concat(X_0:bat[:str], X_1:bat[:str], X_2:bit):str
-CMDBATstr_group_concat
-Calculate aggregate string concatenate of B with separator SEP.
-aggr
-str_group_concat
-pattern aggr.str_group_concat(X_0:bat[:str], X_1:bit):str
-CMDBATstr_group_concat
-Calculate aggregate string concatenate of B.
+command aggr.str_group_concat(X_0:bat[:str], X_1:bat[:str]):str
+AGGRstr_group_concat_sep
+Ungrouped string tail concat with custom separator
 aggr
 subCollect
 command aggr.subCollect(X_0:bat[:wkb], X_1:bat[:oid], X_2:bat[:oid], 
X_3:bit):bat[:wkb]
@@ -1904,16 +1864,6 @@ command aggr.substr_group_concat(X_0:bat
 AGGRsubstr_group_concat_sep
 Grouped string concat with custom separator
 aggr
-substr_group_concat
-command aggr.substr_group_concat(X_0:bat[:str], X_1:bat[:oid], 
X_2:bat[:any_1], X_3:bat[:oid], X_4:bit):bat[:str]
-AGGRsubstr_group_concatcand
-Grouped string concat with candidates list
-aggr
-substr_group_concat
-command aggr.substr_group_concat(X_0:bat[:str], X_1:bat[:str], X_2:bat[:oid], 
X_3:bat[:any_1], X_4:bat[:oid], X_5:bit):bat[:str]
-AGGRsubstr_group_concatcand_sep
-Grouped string concat with candidates list with custom separator
-aggr
 subsum
 command aggr.subsum(X_0:bat[:bte], X_1:bat[:oid], X_2:bat[:any_1], 
X_3:bit):bat[:bte]
 AGGRsubsum_bte
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
@@ -1186,51 +1186,62 @@ AGGRsubquantilecand_avg(Client ctx, bat 
 }
 
 static str
-AGGRgroup_str_concat(bat *retval1, const bat *bid, const bat *gid,
-                                        const bat *eid, const bat *sid, bool 
skip_nils,
+AGGRgroup_str_concat(Client ctx,
+                                        bat *retval1, str *retval2, /* one or 
the other! */
+                                        const bat *bid, const bat *gid,
+                                        const bat *eid, bool skip_nils,
                                         const bat *sepid, const char 
*separator,
                                         const char *malfunc)
 {
-       BAT *b, *g, *e, *s, *sep, *bn = NULL;
+       BAT *b, *g, *e, *sep, *bn = NULL;
 
        b = BATdescriptor(*bid);
        g = gid ? BATdescriptor(*gid) : NULL;
        e = eid ? BATdescriptor(*eid) : NULL;
-       s = sid ? BATdescriptor(*sid) : NULL;
        sep = sepid ? BATdescriptor(*sepid) : NULL;
 
        if (b == NULL || (gid != NULL && g == NULL) || (eid != NULL && e == 
NULL) ||
-               (sid != NULL && s == NULL) || (sepid != NULL && sep == NULL)) {
+               (sepid != NULL && sep == NULL)) {
                BBPreclaim(b);
                BBPreclaim(g);
                BBPreclaim(e);
-               BBPreclaim(s);
                BBPreclaim(sep);
                throw(MAL, malfunc, SQLSTATE(HY002) RUNTIME_OBJECT_MISSING);
        }
 
-       bn = BATgroupstr_group_concat(b, g, e, s, sep, skip_nils, separator);
+       if (retval1) {
+               bn = BATgroupstr_group_concat(b, g, e, NULL, sep, skip_nils, 
separator);
+       } else {
+               ValRecord res;
+               if (BATstr_group_concat(ctx->curprg->def->ma, &res, b, NULL, 
sep,
+                                                               true, true, 
separator) == GDK_SUCCEED)
+                       *retval2 = res.val.sval;
+               else
+                       *retval2 = NULL;
+       }
 
        BBPunfix(b->batCacheid);
        BBPreclaim(g);
        BBPreclaim(e);
-       BBPreclaim(s);
        BBPreclaim(sep);
-       if (bn == NULL)
-               throw(MAL, malfunc, GDK_EXCEPTION);
-       *retval1 = bn->batCacheid;
-       BBPkeepref(bn);
+       if (retval1) {
+               if (bn == NULL)
+                       throw(MAL, malfunc, GDK_EXCEPTION);
+               *retval1 = bn->batCacheid;
+               BBPkeepref(bn);
+       } else {
+               if (*retval2 == NULL)
+                       throw(MAL, malfunc, GDK_EXCEPTION);
+       }
        return MAL_SUCCEED;
 }
 
 #define DEFAULT_SEPARATOR ","
 
 static str
-AGGRstr_group_concat(Client ctx, bat *retval, const bat *bid, const bat *gid,
-                                        const bat *eid)
+AGGRstr_group_concat(Client ctx, str *retval, const bat *bid)
 {
-       (void) ctx;
-       return AGGRgroup_str_concat(retval, bid, gid, eid, NULL, true, NULL,
+       return AGGRgroup_str_concat(ctx, NULL, retval, bid, NULL, NULL, true, 
NULL,
                                                                
DEFAULT_SEPARATOR, "aggr.str_group_concat");
 }
 
@@ -1238,28 +1249,16 @@ static str
 AGGRsubstr_group_concat(Client ctx, bat *retval, const bat *bid, const bat 
*gid,
                                                const bat *eid, const bit 
*skip_nils)
 {
-       (void) ctx;
-       return AGGRgroup_str_concat(retval, bid, gid, eid, NULL, *skip_nils, 
NULL,
-                                                               
DEFAULT_SEPARATOR, "aggr.substr_group_concat");
+       return AGGRgroup_str_concat(ctx, retval, NULL, bid, gid, eid, 
*skip_nils,
+                                                               NULL, 
DEFAULT_SEPARATOR,
+                                                               
"aggr.substr_group_concat");
 }
 
 static str
-AGGRsubstr_group_concatcand(Client ctx, bat *retval, const bat *bid, const bat 
*gid,
-                                                       const bat *eid, const 
bat *sid,
-                                                       const bit *skip_nils)
+AGGRstr_group_concat_sep(Client ctx, str *retval, const bat *bid, const bat 
*sep)
 {
-       (void) ctx;
-       return AGGRgroup_str_concat(retval, bid, gid, eid, sid, *skip_nils, 
NULL,
-                                                               
DEFAULT_SEPARATOR, "aggr.substr_group_concat");
-}
-
-static str
-AGGRstr_group_concat_sep(Client ctx, bat *retval, const bat *bid, const bat 
*sep,
-                                                const bat *gid, const bat *eid)
-{
-       (void) ctx;
-       return AGGRgroup_str_concat(retval, bid, gid, eid, NULL, true, sep, 
NULL,
-                                                               
"aggr.str_group_concat_sep");
+       return AGGRgroup_str_concat(ctx, NULL, retval, bid, NULL, NULL, true, 
sep,
+                                                               NULL, 
"aggr.str_group_concat_sep");;
 }
 
 static str
@@ -1267,19 +1266,8 @@ AGGRsubstr_group_concat_sep(Client ctx, 
                                                        const bat *gid, const 
bat *eid,
                                                        const bit *skip_nils)
 {
-       (void) ctx;
-       return AGGRgroup_str_concat(retval, bid, gid, eid, NULL, *skip_nils, 
sep,
-                                                               NULL, 
"aggr.substr_group_concat_sep");
-}
-
-static str
-AGGRsubstr_group_concatcand_sep(Client ctx, bat *retval, const bat *bid, const 
bat *sep,
-                                                               const bat *gid, 
const bat *eid, const bat *sid,
-                                                               const bit 
*skip_nils)
-{
-       (void) ctx;
-       return AGGRgroup_str_concat(retval, bid, gid, eid, sid, *skip_nils, sep,
-                                                               NULL, 
"aggr.substr_group_concat_sep");
+       return AGGRgroup_str_concat(ctx, retval, NULL, bid, gid, eid, 
*skip_nils,
+                                                               sep, NULL, 
"aggr.substr_group_concat_sep");
 }
 
 static str
@@ -1726,12 +1714,10 @@ mel_func aggr_init_funcs[] = {
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to