LCOV - code coverage report
Current view: top level - sql/backends/monet5 - sql_round.c (source / functions) Hit Total Coverage
Test: coverage.info Lines: 20 20 100.0 %
Date: 2021-10-13 02:24:04 Functions: 2 2 100.0 %

          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 "sql.h"
      11             : #include "mal_instruction.h"
      12             : 
      13             : #define CONCAT_2(a, b)          a##b
      14             : #define CONCAT_3(a, b, c)       a##b##c
      15             : 
      16             : #define NIL(t)                  CONCAT_2(t, _nil)
      17             : #define ISNIL(t)                CONCAT_3(is_, t, _nil)
      18             : #define TPE(t)                  CONCAT_2(TYPE_, t)
      19             : #define GDKmin(t)               CONCAT_3(GDK_, t, _min)
      20             : #define GDKmax(t)               CONCAT_3(GDK_, t, _max)
      21             : #define FUN(a, b)               CONCAT_3(a, _, b)
      22             : 
      23             : #define STRING(a)               #a
      24             : 
      25             : #define BIG lng                 /* a larger type */
      26             : 
      27             : static void
      28          75 : finalize_ouput_copy_sorted_property(bat *res, BAT *bn, BAT *b, str msg, bool nils, BUN q, bool try_copy_sorted)
      29             : {
      30          75 :         if (bn && !msg) {
      31          74 :                 BATsetcount(bn, q);
      32          74 :                 bn->tnil = nils;
      33          74 :                 bn->tnonil = !nils;
      34          74 :                 bn->tkey = BATcount(bn) <= 1;
      35          74 :                 bn->tsorted = ((try_copy_sorted && b && b->tsorted) || BATcount(bn) <= 1);
      36          74 :                 bn->trevsorted = ((try_copy_sorted && b && b->trevsorted) || BATcount(bn) <= 1);
      37          74 :                 BBPkeepref(*res = bn->batCacheid);
      38           1 :         } else if (bn)
      39           1 :                 BBPreclaim(bn);
      40          75 : }
      41             : 
      42             : static void
      43          75 : unfix_inputs(int nargs, ...)
      44             : {
      45             :         va_list valist;
      46             : 
      47          75 :         va_start(valist, nargs);
      48         227 :         for (int i = 0; i < nargs; i++) {
      49         152 :                 BAT *b = va_arg(valist, BAT *);
      50         152 :                 if (b)
      51          76 :                         BBPunfix(b->batCacheid);
      52             :         }
      53          75 :         va_end(valist);
      54          75 : }
      55             : 
      56             : #define TYPE bte
      57             : #include "sql_round_impl.h"
      58             : #undef TYPE
      59             : 
      60             : #define TYPE sht
      61             : #include "sql_round_impl.h"
      62             : #undef TYPE
      63             : 
      64             : #define TYPE int
      65             : #include "sql_round_impl.h"
      66             : #undef TYPE
      67             : 
      68             : #define TYPE lng
      69             : #include "sql_round_impl.h"
      70             : #undef TYPE
      71             : 
      72             : #ifdef HAVE_HGE
      73             : #undef BIG
      74             : #define BIG hge
      75             : #define TYPE hge
      76             : #include "sql_round_impl.h"
      77             : #undef TYPE
      78             : #endif

Generated by: LCOV version 1.14