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 - 2019 MonetDB B.V.
7 */
8
9/* included from gdk.h */
10
11gdk_export BAT *BATcalcnegate(BAT *b, BAT *s);
12gdk_export BAT *BATcalcabsolute(BAT *b, BAT *s);
13gdk_export BAT *BATcalcincr(BAT *b, BAT *s, bool abort_on_error);
14gdk_export BAT *BATcalcdecr(BAT *b, BAT *s, bool abort_on_error);
15gdk_export BAT *BATcalciszero(BAT *b, BAT *s);
16gdk_export BAT *BATcalcsign(BAT *b, BAT *s);
17gdk_export BAT *BATcalcisnil(BAT *b, BAT *s);
18gdk_export BAT *BATcalcisnotnil(BAT *b, BAT *s);
19gdk_export BAT *BATcalcnot(BAT *b, BAT *s);
20gdk_export BAT *BATcalcmin(BAT *b1, BAT *b2, BAT *s);
21gdk_export BAT *BATcalcmin_no_nil(BAT *b1, BAT *b2, BAT *s);
22gdk_export BAT *BATcalcmincst(BAT *b, const ValRecord *v, BAT *s);
23gdk_export BAT *BATcalcmincst_no_nil(BAT *b, const ValRecord *v, BAT *s);
24gdk_export BAT *BATcalccstmin(const ValRecord *v, BAT *b, BAT *s);
25gdk_export BAT *BATcalccstmin_no_nil(const ValRecord *v, BAT *b, BAT *s);
26gdk_export BAT *BATcalcmax(BAT *b1, BAT *b2, BAT *s);
27gdk_export BAT *BATcalcmax_no_nil(BAT *b1, BAT *b2, BAT *s);
28gdk_export BAT *BATcalcmaxcst(BAT *b, const ValRecord *v, BAT *s);
29gdk_export BAT *BATcalcmaxcst_no_nil(BAT *b, const ValRecord *v, BAT *s);
30gdk_export BAT *BATcalccstmax(const ValRecord *v, BAT *b, BAT *s);
31gdk_export BAT *BATcalccstmax_no_nil(const ValRecord *v, BAT *b, BAT *s);
32gdk_export BAT *BATcalcadd(BAT *b1, BAT *b2, BAT *s, int tp, bool abort_on_error);
33gdk_export BAT *BATcalcaddcst(BAT *b, const ValRecord *v, BAT *s, int tp, bool abort_on_error);
34gdk_export BAT *BATcalccstadd(const ValRecord *v, BAT *b, BAT *s, int tp, bool abort_on_error);
35gdk_export BAT *BATcalcsub(BAT *b1, BAT *b2, BAT *s, int tp, bool abort_on_error);
36gdk_export BAT *BATcalcsubcst(BAT *b, const ValRecord *v, BAT *s, int tp, bool abort_on_error);
37gdk_export BAT *BATcalccstsub(const ValRecord *v, BAT *b, BAT *s, int tp, bool abort_on_error);
38gdk_export BAT *BATcalcmul(BAT *b1, BAT *b2, BAT *s, int tp, bool abort_on_error);
39gdk_export BAT *BATcalcmulcst(BAT *b, const ValRecord *v, BAT *s, int tp, bool abort_on_error);
40gdk_export BAT *BATcalccstmul(const ValRecord *v, BAT *b, BAT *s, int tp, bool abort_on_error);
41gdk_export BAT *BATcalcdiv(BAT *b1, BAT *b2, BAT *s, int tp, bool abort_on_error);
42gdk_export BAT *BATcalcdivcst(BAT *b, const ValRecord *v, BAT *s, int tp, bool abort_on_error);
43gdk_export BAT *BATcalccstdiv(const ValRecord *v, BAT *b, BAT *s, int tp, bool abort_on_error);
44gdk_export BAT *BATcalcmod(BAT *b1, BAT *b2, BAT *s, int tp, bool abort_on_error);
45gdk_export BAT *BATcalcmodcst(BAT *b, const ValRecord *v, BAT *s, int tp, bool abort_on_error);
46gdk_export BAT *BATcalccstmod(const ValRecord *v, BAT *b, BAT *s, int tp, bool abort_on_error);
47gdk_export BAT *BATcalcxor(BAT *b1, BAT *b2, BAT *s);
48gdk_export BAT *BATcalcxorcst(BAT *b, const ValRecord *v, BAT *s);
49gdk_export BAT *BATcalccstxor(const ValRecord *v, BAT *b, BAT *s);
50gdk_export BAT *BATcalcor(BAT *b1, BAT *b2, BAT *s);
51gdk_export BAT *BATcalcorcst(BAT *b, const ValRecord *v, BAT *s);
52gdk_export BAT *BATcalccstor(const ValRecord *v, BAT *b, BAT *s);
53gdk_export BAT *BATcalcand(BAT *b1, BAT *b2, BAT *s);
54gdk_export BAT *BATcalcandcst(BAT *b, const ValRecord *v, BAT *s);
55gdk_export BAT *BATcalccstand(const ValRecord *v, BAT *b, BAT *s);
56gdk_export BAT *BATcalclsh(BAT *b1, BAT *b2, BAT *s, bool abort_on_error);
57gdk_export BAT *BATcalclshcst(BAT *b, const ValRecord *v, BAT *s, bool abort_on_error);
58gdk_export BAT *BATcalccstlsh(const ValRecord *v, BAT *b, BAT *s, bool abort_on_error);
59gdk_export BAT *BATcalcrsh(BAT *b1, BAT *b2, BAT *s, bool abort_on_error);
60gdk_export BAT *BATcalcrshcst(BAT *b, const ValRecord *v, BAT *s, bool abort_on_error);
61gdk_export BAT *BATcalccstrsh(const ValRecord *v, BAT *b, BAT *s, bool abort_on_error);
62gdk_export BAT *BATcalclt(BAT *b1, BAT *b2, BAT *s);
63gdk_export BAT *BATcalcltcst(BAT *b, const ValRecord *v, BAT *s);
64gdk_export BAT *BATcalccstlt(const ValRecord *v, BAT *b, BAT *s);
65gdk_export BAT *BATcalcle(BAT *b1, BAT *b2, BAT *s);
66gdk_export BAT *BATcalclecst(BAT *b, const ValRecord *v, BAT *s);
67gdk_export BAT *BATcalccstle(const ValRecord *v, BAT *b, BAT *s);
68gdk_export BAT *BATcalcgt(BAT *b1, BAT *b2, BAT *s);
69gdk_export BAT *BATcalcgtcst(BAT *b, const ValRecord *v, BAT *s);
70gdk_export BAT *BATcalccstgt(const ValRecord *v, BAT *b, BAT *s);
71gdk_export BAT *BATcalcge(BAT *b1, BAT *b2, BAT *s);
72gdk_export BAT *BATcalcgecst(BAT *b, const ValRecord *v, BAT *s);
73gdk_export BAT *BATcalccstge(const ValRecord *v, BAT *b, BAT *s);
74gdk_export BAT *BATcalceq(BAT *b1, BAT *b2, BAT *s, bool nil_matches);
75gdk_export BAT *BATcalceqcst(BAT *b, const ValRecord *v, BAT *s, bool nil_matches);
76gdk_export BAT *BATcalccsteq(const ValRecord *v, BAT *b, BAT *s, bool nil_matches);
77gdk_export BAT *BATcalcne(BAT *b1, BAT *b2, BAT *s, bool nil_matches);
78gdk_export BAT *BATcalcnecst(BAT *b, const ValRecord *v, BAT *s, bool nil_matches);
79gdk_export BAT *BATcalccstne(const ValRecord *v, BAT *b, BAT *s, bool nil_matches);
80gdk_export BAT *BATcalccmp(BAT *b1, BAT *b2, BAT *s);
81gdk_export BAT *BATcalccmpcst(BAT *b, const ValRecord *v, BAT *s);
82gdk_export BAT *BATcalccstcmp(const ValRecord *v, BAT *b, BAT *s);
83gdk_export BAT *BATcalcbetween(BAT *b, BAT *lo, BAT *hi, BAT *s, bool symmetric, bool linc, bool hinc, bool nils_false, bool anti);
84gdk_export BAT *BATcalcbetweencstcst(BAT *b, const ValRecord *lo, const ValRecord *hi, BAT *s, bool symmetric, bool linc, bool hinc, bool nils_false, bool anti);
85gdk_export BAT *BATcalcbetweenbatcst(BAT *b, BAT *lo, const ValRecord *hi, BAT *s, bool symmetric, bool linc, bool hinc, bool nils_false, bool anti);
86gdk_export BAT *BATcalcbetweencstbat(BAT *b, const ValRecord *lo, BAT *hi, BAT *s, bool symmetric, bool linc, bool hinc, bool nils_false, bool anti);
87gdk_export gdk_return VARcalcbetween(ValPtr ret, const ValRecord *v, const ValRecord *lo, const ValRecord *hi, bool symmetric, bool linc, bool hinc, bool nils_false, bool anti);
88gdk_export BAT *BATcalcifthenelse(BAT *b, BAT *b1, BAT *b2);
89gdk_export BAT *BATcalcifthenelsecst(BAT *b, BAT *b1, const ValRecord *c2);
90gdk_export BAT *BATcalcifthencstelse(BAT *b, const ValRecord *c1, BAT *b2);
91gdk_export BAT *BATcalcifthencstelsecst(BAT *b, const ValRecord *c1, const ValRecord *c2);
92
93gdk_export gdk_return VARcalcnot(ValPtr ret, const ValRecord *v);
94gdk_export gdk_return VARcalcnegate(ValPtr ret, const ValRecord *v);
95gdk_export gdk_return VARcalcabsolute(ValPtr ret, const ValRecord *v);
96gdk_export gdk_return VARcalcincr(ValPtr ret, const ValRecord *v, bool abort_on_error);
97gdk_export gdk_return VARcalcdecr(ValPtr ret, const ValRecord *v, bool abort_on_error);
98gdk_export gdk_return VARcalciszero(ValPtr ret, const ValRecord *v);
99gdk_export gdk_return VARcalcsign(ValPtr ret, const ValRecord *v);
100gdk_export gdk_return VARcalcisnil(ValPtr ret, const ValRecord *v);
101gdk_export gdk_return VARcalcisnotnil(ValPtr ret, const ValRecord *v);
102gdk_export gdk_return VARcalcadd(ValPtr ret, const ValRecord *lft, const ValRecord *rgt, bool abort_on_error);
103gdk_export gdk_return VARcalcsub(ValPtr ret, const ValRecord *lft, const ValRecord *rgt, bool abort_on_error);
104gdk_export gdk_return VARcalcmul(ValPtr ret, const ValRecord *lft, const ValRecord *rgt, bool abort_on_error);
105gdk_export gdk_return VARcalcdiv(ValPtr ret, const ValRecord *lft, const ValRecord *rgt, bool abort_on_error);
106gdk_export gdk_return VARcalcmod(ValPtr ret, const ValRecord *lft, const ValRecord *rgt, bool abort_on_error);
107gdk_export gdk_return VARcalcxor(ValPtr ret, const ValRecord *lft, const ValRecord *rgt);
108gdk_export gdk_return VARcalcor(ValPtr ret, const ValRecord *lft, const ValRecord *rgt);
109gdk_export gdk_return VARcalcand(ValPtr ret, const ValRecord *lft, const ValRecord *rgt);
110gdk_export gdk_return VARcalclsh(ValPtr ret, const ValRecord *lft, const ValRecord *rgt, bool abort_on_error);
111gdk_export gdk_return VARcalcrsh(ValPtr ret, const ValRecord *lft, const ValRecord *rgt, bool abort_on_error);
112gdk_export gdk_return VARcalclt(ValPtr ret, const ValRecord *lft, const ValRecord *rgt);
113gdk_export gdk_return VARcalcgt(ValPtr ret, const ValRecord *lft, const ValRecord *rgt);
114gdk_export gdk_return VARcalcle(ValPtr ret, const ValRecord *lft, const ValRecord *rgt);
115gdk_export gdk_return VARcalcge(ValPtr ret, const ValRecord *lft, const ValRecord *rgt);
116gdk_export gdk_return VARcalceq(ValPtr ret, const ValRecord *lft, const ValRecord *rgt, bool nil_matches);
117gdk_export gdk_return VARcalcne(ValPtr ret, const ValRecord *lft, const ValRecord *rgt, bool nil_matches);
118gdk_export gdk_return VARcalccmp(ValPtr ret, const ValRecord *lft, const ValRecord *rgt);
119gdk_export BAT *BATconvert(BAT *b, BAT *s, int tp, bool abort_on_error);
120gdk_export gdk_return VARconvert(ValPtr ret, const ValRecord *v, bool abort_on_error);
121gdk_export gdk_return BATcalcavg(BAT *b, BAT *s, dbl *avg, BUN *vals, int scale);
122
123gdk_export BAT *BATgroupsum(BAT *b, BAT *g, BAT *e, BAT *s, int tp, bool skip_nils, bool abort_on_error);
124gdk_export BAT *BATgroupprod(BAT *b, BAT *g, BAT *e, BAT *s, int tp, bool skip_nils, bool abort_on_error);
125gdk_export gdk_return BATgroupavg(BAT **bnp, BAT **cntsp, BAT *b, BAT *g, BAT *e, BAT *s, int tp, bool skip_nils, bool abort_on_error, int scale);
126gdk_export BAT *BATgroupcount(BAT *b, BAT *g, BAT *e, BAT *s, int tp, bool skip_nils, bool abort_on_error);
127gdk_export BAT *BATgroupsize(BAT *b, BAT *g, BAT *e, BAT *s, int tp, bool skip_nils, bool abort_on_error);
128gdk_export BAT *BATgroupmin(BAT *b, BAT *g, BAT *e, BAT *s, int tp, bool skip_nils, bool abort_on_error);
129gdk_export BAT *BATgroupmax(BAT *b, BAT *g, BAT *e, BAT *s, int tp, bool skip_nils, bool abort_on_error);
130gdk_export BAT *BATgroupmedian(BAT *b, BAT *g, BAT *e, BAT *s, int tp, bool skip_nils, bool abort_on_error);
131gdk_export BAT *BATgroupquantile(BAT *b, BAT *g, BAT *e, BAT *s, int tp, double quantile, bool skip_nils, bool abort_on_error);
132gdk_export BAT *BATgroupmedian_avg(BAT *b, BAT *g, BAT *e, BAT *s, int tp, bool skip_nils, bool abort_on_error);
133gdk_export BAT *BATgroupquantile_avg(BAT *b, BAT *g, BAT *e, BAT *s, int tp, double quantile, bool skip_nils, bool abort_on_error);
134
135/* helper function for grouped aggregates */
136gdk_export const char *BATgroupaggrinit(
137 BAT *b, BAT *g, BAT *e, BAT *s,
138 /* outputs: */
139 oid *minp, oid *maxp, BUN *ngrpp,
140 struct canditer *ci, BUN *ncand);
141
142gdk_export gdk_return BATsum(void *res, int tp, BAT *b, BAT *s, bool skip_nils, bool abort_on_error, bool nil_if_empty);
143gdk_export gdk_return BATprod(void *res, int tp, BAT *b, BAT *s, bool skip_nils, bool abort_on_error, bool nil_if_empty);
144gdk_export void *BATmax(BAT *b, void *aggr);
145gdk_export void *BATmin(BAT *b, void *aggr);
146gdk_export void *BATmax_skipnil(BAT *b, void *aggr, bit skipnil);
147gdk_export void *BATmin_skipnil(BAT *b, void *aggr, bit skipnil);
148
149gdk_export dbl BATcalcstdev_population(dbl *avgp, BAT *b);
150gdk_export dbl BATcalcstdev_sample(dbl *avgp, BAT *b);
151gdk_export BAT *BATgroupstdev_sample(BAT *b, BAT *g, BAT *e, BAT *s, int tp, bool skip_nils, bool abort_on_error);
152gdk_export BAT *BATgroupstdev_population(BAT *b, BAT *g, BAT *e, BAT *s, int tp, bool skip_nils, bool abort_on_error);
153gdk_export dbl BATcalcvariance_population(dbl *avgp, BAT *b);
154gdk_export dbl BATcalcvariance_sample(dbl *avgp, BAT *b);
155gdk_export BAT *BATgroupvariance_sample(BAT *b, BAT *g, BAT *e, BAT *s, int tp, bool skip_nils, bool abort_on_error);
156gdk_export BAT *BATgroupvariance_population(BAT *b, BAT *g, BAT *e, BAT *s, int tp, bool skip_nils, bool abort_on_error);
157
158gdk_export BAT *BATgroupstr_group_concat(BAT *b, BAT *g, BAT *e, BAT *s, bool skip_nils, bool abort_on_error, const char *separator);
159gdk_export gdk_return BATstr_group_concat(ValPtr res, BAT *b, BAT *s, bool skip_nils, bool abort_on_error, bool nil_if_empty, const char *separator);
160