LCOV - code coverage report
Current view: top level - monetdb5/modules/kernel - group.c (source / functions) Hit Total Coverage
Test: coverage.info Lines: 41 77 53.2 %
Date: 2021-10-13 02:24:04 Functions: 7 19 36.8 %

          Line data    Source code
       1             : /*
       2             :  * This Source Code Form is subject to the terms of the Mozilla Public
       3             :  * License, v. 2.0.  If a copy of the MPL was not distributed with this
       4             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       5             :  *
       6             :  * Copyright 1997 - July 2008 CWI, August 2008 - 2021 MonetDB B.V.
       7             :  */
       8             : 
       9             : #include "monetdb_config.h"
      10             : #include "mal.h"
      11             : #include "mal_exception.h"
      12             : #include "group.h"
      13             : 
      14             : str
      15       68166 : GRPsubgroup5(bat *ngid, bat *next, bat *nhis, const bat *bid, const bat *sid, const bat *gid, const bat *eid, const bat *hid)
      16             : {
      17             :         BAT *b, *s, *g, *e, *h, *gn, *en, *hn;
      18             :         gdk_return r;
      19             : 
      20       68166 :         b = BATdescriptor(*bid);
      21       68161 :         s = sid ? BATdescriptor(*sid) : NULL;
      22       68161 :         g = gid ? BATdescriptor(*gid) : NULL;
      23       68162 :         e = eid ? BATdescriptor(*eid) : NULL;
      24       68164 :         h = hid ? BATdescriptor(*hid) : NULL;
      25       68161 :         if (b == NULL ||
      26       68161 :                 (sid != NULL && s == NULL) ||
      27       68161 :                 (gid != NULL && g == NULL) ||
      28       68161 :                 (eid != NULL && e == NULL) ||
      29       68161 :                 (hid != NULL && h == NULL)) {
      30           0 :                 if (b)
      31           0 :                         BBPunfix(b->batCacheid);
      32           0 :                 if (s)
      33           0 :                         BBPunfix(s->batCacheid);
      34           0 :                 if (g)
      35           0 :                         BBPunfix(g->batCacheid);
      36           0 :                 if (e)
      37           0 :                         BBPunfix(e->batCacheid);
      38           0 :                 if (h)
      39           0 :                         BBPunfix(h->batCacheid);
      40           0 :                 throw(MAL, gid ? "group.subgroup" : "group.group", SQLSTATE(HY002) RUNTIME_OBJECT_MISSING);
      41             :         }
      42      127334 :         if ((r = BATgroup(&gn, next ? &en : NULL, nhis ? &hn : NULL, b, s, g, e, h)) == GDK_SUCCEED) {
      43       68161 :                 *ngid = gn->batCacheid;
      44       68161 :                 BBPkeepref(*ngid);
      45       68165 :                 if (next) {
      46       68165 :                         *next = en->batCacheid;
      47       68165 :                         BBPkeepref(*next);
      48             :                 }
      49       68163 :                 if (nhis){
      50        8991 :                         *nhis = hn->batCacheid;
      51        8991 :                         BBPkeepref(*nhis);
      52             :                 }
      53             :         }
      54       68164 :         BBPunfix(b->batCacheid);
      55       68159 :         if (s)
      56           0 :                 BBPunfix(s->batCacheid);
      57       68160 :         if (g)
      58       24183 :                 BBPunfix(g->batCacheid);
      59       68163 :         if (e)
      60          12 :                 BBPunfix(e->batCacheid);
      61       68163 :         if (h)
      62          12 :                 BBPunfix(h->batCacheid);
      63       68163 :         return r == GDK_SUCCEED ? MAL_SUCCEED : createException(MAL, gid ? "group.subgroup" : "group.group", GDK_EXCEPTION);
      64             : }
      65             : 
      66             : static str
      67           0 : GRPsubgroup9(bat *ngid, bat *next, const bat *bid, const bat *sid, const bat *gid, const bat *eid, const bat *hid)
      68             : {
      69           0 :         return GRPsubgroup5(ngid, next, NULL, bid, sid, gid, eid, hid);
      70             : }
      71             : 
      72             : static str
      73           0 : GRPsubgroup8(bat *ngid, bat *next, const bat *bid, const bat *gid, const bat *eid, const bat *hid)
      74             : {
      75           0 :         return GRPsubgroup5(ngid, next, NULL, bid, NULL, gid, eid, hid);
      76             : }
      77             : 
      78             : static str
      79           0 : GRPsubgroup7(bat *ngid, bat *next, const bat *bid, const bat *sid, const bat *gid)
      80             : {
      81           0 :         return GRPsubgroup5(ngid, next, NULL, bid, sid, gid, NULL, NULL);
      82             : }
      83             : 
      84             : static str
      85       23798 : GRPsubgroup6(bat *ngid, bat *next, const bat *bid, const bat *gid)
      86             : {
      87       23798 :         return GRPsubgroup5(ngid, next, NULL, bid, NULL, gid, NULL, NULL);
      88             : }
      89             : 
      90             : static str
      91           1 : GRPsubgroup4(bat *ngid, bat *next, bat *nhis, const bat *bid, const bat *gid, const bat *eid, const bat *hid)
      92             : {
      93           1 :         return GRPsubgroup5(ngid, next, nhis, bid, NULL, gid, eid, hid);
      94             : }
      95             : 
      96             : static str
      97           0 : GRPsubgroup3(bat *ngid, bat *next, bat *nhis, const bat *bid, const bat *sid, const bat *gid)
      98             : {
      99           0 :         return GRPsubgroup5(ngid, next, nhis, bid, sid, gid, NULL, NULL);
     100             : }
     101             : 
     102             : static str
     103         377 : GRPsubgroup2(bat *ngid, bat *next, bat *nhis, const bat *bid, const bat *gid)
     104             : {
     105         377 :         return GRPsubgroup5(ngid, next, nhis, bid, NULL, gid, NULL, NULL);
     106             : }
     107             : 
     108             : static str
     109           0 : GRPgroup4(bat *ngid, bat *next, const bat *bid, const bat *sid)
     110             : {
     111           0 :         return GRPsubgroup5(ngid, next, NULL, bid, sid, NULL, NULL, NULL);
     112             : }
     113             : 
     114             : static str
     115       35377 : GRPgroup3(bat *ngid, bat *next, const bat *bid)
     116             : {
     117       35377 :         return GRPsubgroup5(ngid, next, NULL, bid, NULL, NULL, NULL, NULL);
     118             : }
     119             : 
     120             : static str
     121           0 : GRPgroup2(bat *ngid, bat *next, bat *nhis, const bat *bid, const bat *sid)
     122             : {
     123           0 :         return GRPsubgroup5(ngid, next, nhis, bid, sid, NULL, NULL, NULL);
     124             : }
     125             : 
     126             : str
     127        8602 : GRPgroup1(bat *ngid, bat *next, bat *nhis, const bat *bid)
     128             : {
     129        8602 :         return GRPsubgroup5(ngid, next, nhis, bid, NULL, NULL, NULL, NULL);
     130             : }
     131             : 
     132             : static str
     133           0 : GRPgroup11(bat *ngid, const bat *bid)
     134             : {
     135           0 :         return GRPsubgroup5(ngid, NULL, NULL, bid, NULL, NULL, NULL, NULL);
     136             : }
     137             : 
     138             : static str
     139           0 : GRPgroup21(bat *ngid, const bat *bid, const bat *sid)
     140             : {
     141           0 :         return GRPsubgroup5(ngid, NULL, NULL, bid, sid, NULL, NULL, NULL);
     142             : }
     143             : 
     144             : static str
     145           0 : GRPsubgroup51(bat *ngid, const bat *bid, const bat *sid, const bat *gid, const bat *eid, const bat *hid)
     146             : {
     147           0 :         return GRPsubgroup5(ngid, NULL, NULL, bid, sid, gid, eid, hid);
     148             : }
     149             : 
     150             : static str
     151           0 : GRPsubgroup41(bat *ngid, const bat *bid, const bat *gid, const bat *eid, const bat *hid)
     152             : {
     153           0 :         return GRPsubgroup5(ngid, NULL, NULL, bid, NULL, gid, eid, hid);
     154             : }
     155             : 
     156             : static str
     157           0 : GRPsubgroup31(bat *ngid, const bat *bid, const bat *sid, const bat *gid)
     158             : {
     159           0 :         return GRPsubgroup5(ngid, NULL, NULL, bid, sid, gid, NULL, NULL);
     160             : }
     161             : 
     162             : static str
     163           0 : GRPsubgroup21(bat *ngid, const bat *bid, const bat *gid)
     164             : {
     165           0 :         return GRPsubgroup5(ngid, NULL, NULL, bid, NULL, gid, NULL, NULL);
     166             : }
     167             : 
     168             : #include "mel.h"
     169             : mel_func group_init_funcs[] = {
     170             :  command("group", "group", GRPgroup1, false, "", args(3,4, batarg("groups",oid),batarg("extents",oid),batarg("histo",lng),batargany("b",1))),
     171             :  command("group", "group", GRPgroup2, false, "", args(3,5, batarg("groups",oid),batarg("extents",oid),batarg("histo",lng),batargany("b",1),batarg("s",oid))),
     172             :  command("group", "group", GRPgroup3, false, "", args(2,3, batarg("groups",oid),batarg("extents",oid),batargany("b",1))),
     173             :  command("group", "group", GRPgroup4, false, "", args(2,4, batarg("groups",oid),batarg("extents",oid),batargany("b",1),batarg("s",oid))),
     174             :  command("group", "group", GRPgroup11, false, "", args(1,2, batarg("",oid),batargany("b",1))),
     175             :  command("group", "group", GRPgroup21, false, "", args(1,3, batarg("",oid),batargany("b",1),batarg("s",oid))),
     176             :  command("group", "subgroup", GRPsubgroup2, false, "", args(3,5, batarg("groups",oid),batarg("extents",oid),batarg("histo",lng),batargany("b",1),batarg("g",oid))),
     177             :  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))),
     178             :  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))),
     179             :  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))),
     180             :  command("group", "subgroup", GRPsubgroup6, false, "", args(2,4, batarg("groups",oid),batarg("extents",oid),batargany("b",1),batarg("g",oid))),
     181             :  command("group", "subgroup", GRPsubgroup7, false, "", args(2,5, batarg("groups",oid),batarg("extents",oid),batargany("b",1),batarg("s",oid),batarg("g",oid))),
     182             :  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))),
     183             :  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))),
     184             :  command("group", "subgroup", GRPsubgroup21, false, "", args(1,3, batarg("",oid),batargany("b",1),batarg("g",oid))),
     185             :  command("group", "subgroup", GRPsubgroup31, false, "", args(1,4, batarg("",oid),batargany("b",1),batarg("s",oid),batarg("g",oid))),
     186             :  command("group", "subgroup", GRPsubgroup41, false, "", args(1,5, batarg("",oid),batargany("b",1),batarg("g",oid),batarg("e",oid),batarg("h",lng))),
     187             :  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))),
     188             :  command("group", "groupdone", GRPgroup1, false, "", args(3,4, batarg("groups",oid),batarg("extents",oid),batarg("histo",lng),batargany("b",1))),
     189             :  command("group", "groupdone", GRPgroup2, false, "", args(3,5, batarg("groups",oid),batarg("extents",oid),batarg("histo",lng),batargany("b",1),batarg("s",oid))),
     190             :  command("group", "groupdone", GRPgroup3, false, "", args(2,3, batarg("groups",oid),batarg("extents",oid),batargany("b",1))),
     191             :  command("group", "groupdone", GRPgroup4, false, "", args(2,4, batarg("groups",oid),batarg("extents",oid),batargany("b",1),batarg("s",oid))),
     192             :  command("group", "groupdone", GRPgroup11, false, "", args(1,2, batarg("",oid),batargany("b",1))),
     193             :  command("group", "groupdone", GRPgroup21, false, "", args(1,3, batarg("",oid),batargany("b",1),batarg("s",oid))),
     194             :  command("group", "subgroupdone", GRPsubgroup2, false, "", args(3,5, batarg("groups",oid),batarg("extents",oid),batarg("histo",lng),batargany("b",1),batarg("g",oid))),
     195             :  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))),
     196             :  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))),
     197             :  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))),
     198             :  command("group", "subgroupdone", GRPsubgroup6, false, "", args(2,4, batarg("groups",oid),batarg("extents",oid),batargany("b",1),batarg("g",oid))),
     199             :  command("group", "subgroupdone", GRPsubgroup7, false, "", args(2,5, batarg("groups",oid),batarg("extents",oid),batargany("b",1),batarg("s",oid),batarg("g",oid))),
     200             :  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))),
     201             :  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))),
     202             :  command("group", "subgroupdone", GRPsubgroup21, false, "", args(1,3, batarg("",oid),batargany("b",1),batarg("g",oid))),
     203             :  command("group", "subgroupdone", GRPsubgroup31, false, "", args(1,4, batarg("",oid),batargany("b",1),batarg("s",oid),batarg("g",oid))),
     204             :  command("group", "subgroupdone", GRPsubgroup41, false, "", args(1,5, batarg("",oid),batargany("b",1),batarg("g",oid),batarg("e",oid),batarg("h",lng))),
     205             :  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))),
     206             :  { .imp=NULL }
     207             : };
     208             : #include "mal_import.h"
     209             : #ifdef _MSC_VER
     210             : #undef read
     211             : #pragma section(".CRT$XCU",read)
     212             : #endif
     213         259 : LIB_STARTUP_FUNC(init_group_mal)
     214         259 : { mal_module("group", NULL, group_init_funcs); }

Generated by: LCOV version 1.14