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 "sql.h" 15 : #include "mal_instruction.h" 16 : 17 : #define CONCAT_2(a, b) a##b 18 : #define CONCAT_3(a, b, c) a##b##c 19 : 20 : #define NIL(t) CONCAT_2(t, _nil) 21 : #define ISNIL(t) CONCAT_3(is_, t, _nil) 22 : #define TPE(t) CONCAT_2(TYPE_, t) 23 : #define GDKmin(t) CONCAT_3(GDK_, t, _min) 24 : #define GDKmax(t) CONCAT_3(GDK_, t, _max) 25 : #define FUN(a, b) CONCAT_3(a, _, b) 26 : 27 : #define STRING(a) #a 28 : 29 : static void 30 6 : finalize_ouput_copy_sorted_property(bat *res, BAT *bn, str msg, bool nils, BUN q, bool istsorted, bool istrevsorted) 31 : { 32 6 : if (bn && !msg) { 33 5 : BATsetcount(bn, q); 34 5 : bn->tnil = nils; 35 5 : bn->tnonil = !nils; 36 5 : bn->tkey = BATcount(bn) <= 1; 37 5 : bn->tsorted = istsorted || BATcount(bn) <= 1; 38 5 : bn->trevsorted = istrevsorted || BATcount(bn) <= 1; 39 5 : *res = bn->batCacheid; 40 5 : BBPkeepref(bn); 41 1 : } else if (bn) 42 0 : BBPreclaim(bn); 43 6 : } 44 : 45 : static void 46 6 : unfix_inputs(int nargs, ...) 47 : { 48 6 : va_list valist; 49 : 50 6 : va_start(valist, nargs); 51 18 : for (int i = 0; i < nargs; i++) { 52 12 : BAT *b = va_arg(valist, BAT *); 53 17 : BBPreclaim(b); 54 : } 55 6 : va_end(valist); 56 6 : } 57 : 58 : #define TYPE flt 59 : #include "sql_fround_impl.h" 60 : #undef TYPE 61 : 62 : #define TYPE dbl 63 : #include "sql_fround_impl.h" 64 : #undef TYPE