LCOV - code coverage report
Current view: top level - monetdb5/modules/kernel - group.c (source / functions) Hit Total Coverage
Test: coverage.info Lines: 39 69 56.5 %
Date: 2024-04-25 23:25:41 Functions: 7 19 36.8 %

          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 "group.h"
      17             : 
      18             : str
      19       55898 : GRPsubgroup5(bat *ngid, bat *next, bat *nhis, const bat *bid, const bat *sid,
      20             :                          const bat *gid, const bat *eid, const bat *hid)
      21             : {
      22       55898 :         BAT *b, *s, *g, *e, *h, *gn, *en, *hn;
      23       55898 :         gdk_return r;
      24             : 
      25       55898 :         b = BATdescriptor(*bid);
      26       55897 :         s = sid ? BATdescriptor(*sid) : NULL;
      27       55898 :         g = gid ? BATdescriptor(*gid) : NULL;
      28       55893 :         e = eid ? BATdescriptor(*eid) : NULL;
      29       55892 :         h = hid ? BATdescriptor(*hid) : NULL;
      30       55890 :         if (b == NULL ||
      31       55890 :                 (sid != NULL && s == NULL) ||
      32       55890 :                 (gid != NULL && g == NULL) ||
      33       55890 :                 (eid != NULL && e == NULL) || (hid != NULL && h == NULL)) {
      34           0 :                 BBPreclaim(b);
      35           0 :                 BBPreclaim(s);
      36           0 :                 BBPreclaim(g);
      37           0 :                 BBPreclaim(e);
      38           0 :                 BBPreclaim(h);
      39           0 :                 throw(MAL, gid ? "group.subgroup" : "group.group",
      40             :                           SQLSTATE(HY002) RUNTIME_OBJECT_MISSING);
      41             :         }
      42      101981 :         if ((r = BATgroup(&gn, next ? &en : NULL, nhis ? &hn : NULL, b, s, g, e, h)) == GDK_SUCCEED) {
      43       55894 :                 *ngid = gn->batCacheid;
      44       55894 :                 BBPkeepref(gn);
      45       55891 :                 if (next) {
      46       55891 :                         *next = en->batCacheid;
      47       55891 :                         BBPkeepref(en);
      48             :                 }
      49       55889 :                 if (nhis) {
      50        9801 :                         *nhis = hn->batCacheid;
      51        9801 :                         BBPkeepref(hn);
      52             :                 }
      53             :         }
      54       55889 :         BBPunfix(b->batCacheid);
      55       55890 :         BBPreclaim(s);
      56       55892 :         BBPreclaim(g);
      57       55892 :         BBPreclaim(e);
      58       55892 :         BBPreclaim(h);
      59       55891 :         return r == GDK_SUCCEED ? MAL_SUCCEED : createException(MAL,
      60             :                                                                                                                         gid ?
      61             :                                                                                                                         "group.subgroup" :
      62             :                                                                                                                         "group.group",
      63             :                                                                                                                         GDK_EXCEPTION);
      64             : }
      65             : 
      66             : static str
      67           0 : GRPsubgroup9(bat *ngid, bat *next, const bat *bid, const bat *sid,
      68             :                          const bat *gid, const bat *eid, const bat *hid)
      69             : {
      70           0 :         return GRPsubgroup5(ngid, next, NULL, bid, sid, gid, eid, hid);
      71             : }
      72             : 
      73             : static str
      74           0 : GRPsubgroup8(bat *ngid, bat *next, const bat *bid, const bat *gid,
      75             :                          const bat *eid, const bat *hid)
      76             : {
      77           0 :         return GRPsubgroup5(ngid, next, NULL, bid, NULL, gid, eid, hid);
      78             : }
      79             : 
      80             : static str
      81           0 : GRPsubgroup7(bat *ngid, bat *next, const bat *bid, const bat *sid,
      82             :                          const bat *gid)
      83             : {
      84           0 :         return GRPsubgroup5(ngid, next, NULL, bid, sid, gid, NULL, NULL);
      85             : }
      86             : 
      87             : static str
      88       15147 : GRPsubgroup6(bat *ngid, bat *next, const bat *bid, const bat *gid)
      89             : {
      90       15147 :         return GRPsubgroup5(ngid, next, NULL, bid, NULL, gid, NULL, NULL);
      91             : }
      92             : 
      93             : static str
      94           1 : GRPsubgroup4(bat *ngid, bat *next, bat *nhis, const bat *bid, const bat *gid,
      95             :                          const bat *eid, const bat *hid)
      96             : {
      97           1 :         return GRPsubgroup5(ngid, next, nhis, bid, NULL, gid, eid, hid);
      98             : }
      99             : 
     100             : static str
     101           0 : GRPsubgroup3(bat *ngid, bat *next, bat *nhis, const bat *bid, const bat *sid,
     102             :                          const bat *gid)
     103             : {
     104           0 :         return GRPsubgroup5(ngid, next, nhis, bid, sid, gid, NULL, NULL);
     105             : }
     106             : 
     107             : str
     108         292 : GRPsubgroup2(bat *ngid, bat *next, bat *nhis, const bat *bid, const bat *gid)
     109             : {
     110         292 :         return GRPsubgroup5(ngid, next, nhis, bid, NULL, gid, NULL, NULL);
     111             : }
     112             : 
     113             : static str
     114           0 : GRPgroup4(bat *ngid, bat *next, const bat *bid, const bat *sid)
     115             : {
     116           0 :         return GRPsubgroup5(ngid, next, NULL, bid, sid, NULL, NULL, NULL);
     117             : }
     118             : 
     119             : str
     120       30949 : GRPgroup3(bat *ngid, bat *next, const bat *bid)
     121             : {
     122       30949 :         return GRPsubgroup5(ngid, next, NULL, bid, NULL, NULL, NULL, NULL);
     123             : }
     124             : 
     125             : static str
     126           0 : GRPgroup2(bat *ngid, bat *next, bat *nhis, const bat *bid, const bat *sid)
     127             : {
     128           0 :         return GRPsubgroup5(ngid, next, nhis, bid, sid, NULL, NULL, NULL);
     129             : }
     130             : 
     131             : str
     132        9497 : GRPgroup1(bat *ngid, bat *next, bat *nhis, const bat *bid)
     133             : {
     134        9497 :         return GRPsubgroup5(ngid, next, nhis, bid, NULL, NULL, NULL, NULL);
     135             : }
     136             : 
     137             : static str
     138           0 : GRPgroup11(bat *ngid, const bat *bid)
     139             : {
     140           0 :         return GRPsubgroup5(ngid, NULL, NULL, bid, NULL, NULL, NULL, NULL);
     141             : }
     142             : 
     143             : static str
     144           0 : GRPgroup21(bat *ngid, const bat *bid, const bat *sid)
     145             : {
     146           0 :         return GRPsubgroup5(ngid, NULL, NULL, bid, sid, NULL, NULL, NULL);
     147             : }
     148             : 
     149             : static str
     150           0 : GRPsubgroup51(bat *ngid, const bat *bid, const bat *sid, const bat *gid,
     151             :                           const bat *eid, const bat *hid)
     152             : {
     153           0 :         return GRPsubgroup5(ngid, NULL, NULL, bid, sid, gid, eid, hid);
     154             : }
     155             : 
     156             : static str
     157           0 : GRPsubgroup41(bat *ngid, const bat *bid, const bat *gid, const bat *eid,
     158             :                           const bat *hid)
     159             : {
     160           0 :         return GRPsubgroup5(ngid, NULL, NULL, bid, NULL, gid, eid, hid);
     161             : }
     162             : 
     163             : static str
     164           0 : GRPsubgroup31(bat *ngid, const bat *bid, const bat *sid, const bat *gid)
     165             : {
     166           0 :         return GRPsubgroup5(ngid, NULL, NULL, bid, sid, gid, NULL, NULL);
     167             : }
     168             : 
     169             : static str
     170           0 : GRPsubgroup21(bat *ngid, const bat *bid, const bat *gid)
     171             : {
     172           0 :         return GRPsubgroup5(ngid, NULL, NULL, bid, NULL, gid, NULL, NULL);
     173             : }
     174             : 
     175             : #include "mel.h"
     176             : mel_func group_init_funcs[] = {
     177             :  command("group", "group", GRPgroup1, false, "", args(3,4, batarg("groups",oid),batarg("extents",oid),batarg("histo",lng),batargany("b",1))),
     178             :  command("group", "group", GRPgroup2, false, "", args(3,5, batarg("groups",oid),batarg("extents",oid),batarg("histo",lng),batargany("b",1),batarg("s",oid))),
     179             :  command("group", "group", GRPgroup3, false, "", args(2,3, batarg("groups",oid),batarg("extents",oid),batargany("b",1))),
     180             :  command("group", "group", GRPgroup4, false, "", args(2,4, batarg("groups",oid),batarg("extents",oid),batargany("b",1),batarg("s",oid))),
     181             :  command("group", "group", GRPgroup11, false, "", args(1,2, batarg("",oid),batargany("b",1))),
     182             :  command("group", "group", GRPgroup21, false, "", args(1,3, batarg("",oid),batargany("b",1),batarg("s",oid))),
     183             :  command("group", "subgroup", GRPsubgroup2, false, "", args(3,5, batarg("groups",oid),batarg("extents",oid),batarg("histo",lng),batargany("b",1),batarg("g",oid))),
     184             :  command("group", "subgroup", GRPsubgroup3, false, "", args(3,6, batarg("groups",oid),batarg("extents",oid),batarg("histo",lng),batargany("b",1),batarg("s",oid),batarg("g",oid))),
     185             :  command("group", "subgroup", GRPsubgroup4, false, "", args(3,7, batarg("groups",oid),batarg("extents",oid),batarg("histo",lng),batargany("b",1),batarg("g",oid),batarg("e",oid),batarg("h",lng))),
     186             :  command("group", "subgroup", GRPsubgroup5, false, "", args(3,8, batarg("groups",oid),batarg("extents",oid),batarg("histo",lng),batargany("b",1),batarg("s",oid),batarg("g",oid),batarg("e",oid),batarg("h",lng))),
     187             :  command("group", "subgroup", GRPsubgroup6, false, "", args(2,4, batarg("groups",oid),batarg("extents",oid),batargany("b",1),batarg("g",oid))),
     188             :  command("group", "subgroup", GRPsubgroup7, false, "", args(2,5, batarg("groups",oid),batarg("extents",oid),batargany("b",1),batarg("s",oid),batarg("g",oid))),
     189             :  command("group", "subgroup", GRPsubgroup8, false, "", args(2,6, batarg("groups",oid),batarg("extents",oid),batargany("b",1),batarg("g",oid),batarg("e",oid),batarg("h",lng))),
     190             :  command("group", "subgroup", GRPsubgroup9, false, "", args(2,7, batarg("groups",oid),batarg("extents",oid),batargany("b",1),batarg("s",oid),batarg("g",oid),batarg("e",oid),batarg("h",lng))),
     191             :  command("group", "subgroup", GRPsubgroup21, false, "", args(1,3, batarg("",oid),batargany("b",1),batarg("g",oid))),
     192             :  command("group", "subgroup", GRPsubgroup31, false, "", args(1,4, batarg("",oid),batargany("b",1),batarg("s",oid),batarg("g",oid))),
     193             :  command("group", "subgroup", GRPsubgroup41, false, "", args(1,5, batarg("",oid),batargany("b",1),batarg("g",oid),batarg("e",oid),batarg("h",lng))),
     194             :  command("group", "subgroup", GRPsubgroup51, false, "", args(1,6, batarg("",oid),batargany("b",1),batarg("s",oid),batarg("g",oid),batarg("e",oid),batarg("h",lng))),
     195             :  command("group", "groupdone", GRPgroup1, false, "", args(3,4, batarg("groups",oid),batarg("extents",oid),batarg("histo",lng),batargany("b",1))),
     196             :  command("group", "groupdone", GRPgroup2, false, "", args(3,5, batarg("groups",oid),batarg("extents",oid),batarg("histo",lng),batargany("b",1),batarg("s",oid))),
     197             :  command("group", "groupdone", GRPgroup3, false, "", args(2,3, batarg("groups",oid),batarg("extents",oid),batargany("b",1))),
     198             :  command("group", "groupdone", GRPgroup4, false, "", args(2,4, batarg("groups",oid),batarg("extents",oid),batargany("b",1),batarg("s",oid))),
     199             :  command("group", "groupdone", GRPgroup11, false, "", args(1,2, batarg("",oid),batargany("b",1))),
     200             :  command("group", "groupdone", GRPgroup21, false, "", args(1,3, batarg("",oid),batargany("b",1),batarg("s",oid))),
     201             :  command("group", "subgroupdone", GRPsubgroup2, false, "", args(3,5, batarg("groups",oid),batarg("extents",oid),batarg("histo",lng),batargany("b",1),batarg("g",oid))),
     202             :  command("group", "subgroupdone", GRPsubgroup3, false, "", args(3,6, batarg("groups",oid),batarg("extents",oid),batarg("histo",lng),batargany("b",1),batarg("s",oid),batarg("g",oid))),
     203             :  command("group", "subgroupdone", GRPsubgroup4, false, "", args(3,7, batarg("groups",oid),batarg("extents",oid),batarg("histo",lng),batargany("b",1),batarg("g",oid),batarg("e",oid),batarg("h",lng))),
     204             :  command("group", "subgroupdone", GRPsubgroup5, false, "", args(3,8, batarg("groups",oid),batarg("extents",oid),batarg("histo",lng),batargany("b",1),batarg("s",oid),batarg("g",oid),batarg("e",oid),batarg("h",lng))),
     205             :  command("group", "subgroupdone", GRPsubgroup6, false, "", args(2,4, batarg("groups",oid),batarg("extents",oid),batargany("b",1),batarg("g",oid))),
     206             :  command("group", "subgroupdone", GRPsubgroup7, false, "", args(2,5, batarg("groups",oid),batarg("extents",oid),batargany("b",1),batarg("s",oid),batarg("g",oid))),
     207             :  command("group", "subgroupdone", GRPsubgroup8, false, "", args(2,6, batarg("groups",oid),batarg("extents",oid),batargany("b",1),batarg("g",oid),batarg("e",oid),batarg("h",lng))),
     208             :  command("group", "subgroupdone", GRPsubgroup9, false, "", args(2,7, batarg("groups",oid),batarg("extents",oid),batargany("b",1),batarg("s",oid),batarg("g",oid),batarg("e",oid),batarg("h",lng))),
     209             :  command("group", "subgroupdone", GRPsubgroup21, false, "", args(1,3, batarg("",oid),batargany("b",1),batarg("g",oid))),
     210             :  command("group", "subgroupdone", GRPsubgroup31, false, "", args(1,4, batarg("",oid),batargany("b",1),batarg("s",oid),batarg("g",oid))),
     211             :  command("group", "subgroupdone", GRPsubgroup41, false, "", args(1,5, batarg("",oid),batargany("b",1),batarg("g",oid),batarg("e",oid),batarg("h",lng))),
     212             :  command("group", "subgroupdone", GRPsubgroup51, false, "", args(1,6, batarg("",oid),batargany("b",1),batarg("s",oid),batarg("g",oid),batarg("e",oid),batarg("h",lng))),
     213             :  { .imp=NULL }
     214             : };
     215             : #include "mal_import.h"
     216             : #ifdef _MSC_VER
     217             : #undef read
     218             : #pragma section(".CRT$XCU",read)
     219             : #endif
     220         334 : LIB_STARTUP_FUNC(init_group_mal)
     221         334 : { mal_module("group", NULL, group_init_funcs); }

Generated by: LCOV version 1.14