MobilityDB  1.0
temporal_aggfuncs.h
Go to the documentation of this file.
1 /*****************************************************************************
2  *
3  * This MobilityDB code is provided under The PostgreSQL License.
4  *
5  * Copyright (c) 2016-2021, Université libre de Bruxelles and MobilityDB
6  * contributors
7  *
8  * MobilityDB includes portions of PostGIS version 3 source code released
9  * under the GNU General Public License (GPLv2 or later).
10  * Copyright (c) 2001-2021, PostGIS contributors
11  *
12  * Permission to use, copy, modify, and distribute this software and its
13  * documentation for any purpose, without fee, and without a written
14  * agreement is hereby granted, provided that the above copyright notice and
15  * this paragraph and the following two paragraphs appear in all copies.
16  *
17  * IN NO EVENT SHALL UNIVERSITE LIBRE DE BRUXELLES BE LIABLE TO ANY PARTY FOR
18  * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING
19  * LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION,
20  * EVEN IF UNIVERSITE LIBRE DE BRUXELLES HAS BEEN ADVISED OF THE POSSIBILITY
21  * OF SUCH DAMAGE.
22  *
23  * UNIVERSITE LIBRE DE BRUXELLES SPECIFICALLY DISCLAIMS ANY WARRANTIES,
24  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
25  * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON
26  * AN "AS IS" BASIS, AND UNIVERSITE LIBRE DE BRUXELLES HAS NO OBLIGATIONS TO
27  * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 
28  *
29  *****************************************************************************/
30 
36 #ifndef __TEMPORAL_AGGFUNCS_H__
37 #define __TEMPORAL_AGGFUNCS_H__
38 
39 #include <postgres.h>
40 #include <catalog/pg_type.h>
41 
42 #include "skiplist.h"
43 #include "temporal.h"
44 #include "temporal_util.h"
45 
46 /*****************************************************************************/
47 
48 extern Datum datum_min_int32(Datum l, Datum r);
49 extern Datum datum_max_int32(Datum l, Datum r);
50 extern Datum datum_min_float8(Datum l, Datum r);
51 extern Datum datum_max_float8(Datum l, Datum r);
52 extern Datum datum_sum_float8(Datum l, Datum r);
53 extern Datum datum_min_text(Datum l, Datum r);
54 extern Datum datum_max_text(Datum l, Datum r);
55 extern Datum datum_sum_double2(Datum l, Datum r);
56 extern Datum datum_sum_double3(Datum l, Datum r);
57 extern Datum datum_sum_double4(Datum l, Datum r);
58 
59 extern void ensure_same_temp_subtype_skiplist(SkipList *state, int16 subtype,
60  Temporal *temp);
61 extern SkipList *tsequence_tagg_transfn(FunctionCallInfo fcinfo, SkipList *state,
62  TSequence *seq, datum_func2 func, bool interpoint);
63 extern SkipList *temporal_tagg_combinefn1(FunctionCallInfo fcinfo, SkipList *state1,
64  SkipList *state2, datum_func2 func, bool crossings);
65 
66 /*****************************************************************************/
67 
68 extern Datum temporal_extent_transfn(PG_FUNCTION_ARGS);
69 extern Datum temporal_extent_combinefn(PG_FUNCTION_ARGS);
70 extern Datum tnumber_extent_transfn(PG_FUNCTION_ARGS);
71 extern Datum tnumber_extent_combinefn(PG_FUNCTION_ARGS);
72 
73 extern Datum tbool_tand_transfn(PG_FUNCTION_ARGS);
74 extern Datum tbool_tand_combinefn(PG_FUNCTION_ARGS);
75 extern Datum tbool_tor_transfn(PG_FUNCTION_ARGS);
76 extern Datum tbool_tor_combinefn(PG_FUNCTION_ARGS);
77 extern Datum tint_tmin_transfn(PG_FUNCTION_ARGS);
78 extern Datum tint_tmin_combinefn(PG_FUNCTION_ARGS);
79 extern Datum tfloat_tmin_transfn(PG_FUNCTION_ARGS);
80 extern Datum tfloat_tmin_combinefn(PG_FUNCTION_ARGS);
81 extern Datum tint_tmax_transfn(PG_FUNCTION_ARGS);
82 extern Datum tint_tmax_combinefn(PG_FUNCTION_ARGS);
83 extern Datum tfloat_tmax_transfn(PG_FUNCTION_ARGS);
84 extern Datum tfloat_tmax_combinefn(PG_FUNCTION_ARGS);
85 extern Datum tint_tsum_transfn(PG_FUNCTION_ARGS);
86 extern Datum tint_tsum_combinefn(PG_FUNCTION_ARGS);
87 extern Datum tfloat_tsum_transfn(PG_FUNCTION_ARGS);
88 extern Datum tfloat_tsum_combinefn(PG_FUNCTION_ARGS);
89 extern Datum temporal_tcount_transfn(PG_FUNCTION_ARGS);
90 extern Datum temporal_tcount_combinefn(PG_FUNCTION_ARGS);
91 extern Datum tnumber_tavg_transfn(PG_FUNCTION_ARGS);
92 extern Datum tnumber_tavg_combinefn(PG_FUNCTION_ARGS);
93 extern Datum temporal_tagg_finalfn(PG_FUNCTION_ARGS);
94 extern Datum tnumber_tavg_finalfn(PG_FUNCTION_ARGS);
95 extern Datum ttext_tmin_transfn(PG_FUNCTION_ARGS);
96 extern Datum ttext_tmin_combinefn(PG_FUNCTION_ARGS);
97 extern Datum ttext_tmax_transfn(PG_FUNCTION_ARGS);
98 extern Datum ttext_tmax_combinefn(PG_FUNCTION_ARGS);
99 
100 /*****************************************************************************/
101 
102 #endif
Datum tint_tmax_transfn(PG_FUNCTION_ARGS)
Transition function for temporal maximum aggregation of temporal integer values.
Definition: temporal_aggfuncs.c:1185
Datum tfloat_tmax_combinefn(PG_FUNCTION_ARGS)
Combine function for temporal maximum aggregation of temporal float values.
Definition: temporal_aggfuncs.c:1215
Datum ttext_tmax_transfn(PG_FUNCTION_ARGS)
Transition function for temporal maximum aggregation of temporal text values.
Definition: temporal_aggfuncs.c:1287
Datum datum_sum_double2(Datum l, Datum r)
Returns the sum of the two arguments.
Definition: temporal_aggfuncs.c:135
Skiplist data structure used for performing aggregates.
Datum datum_min_float8(Datum l, Datum r)
Returns the minimum value of the two arguments.
Definition: temporal_aggfuncs.c:90
Datum ttext_tmax_combinefn(PG_FUNCTION_ARGS)
Combine function for temporal maximum aggregation of temporal text values.
Definition: temporal_aggfuncs.c:1297
Datum tnumber_extent_transfn(PG_FUNCTION_ARGS)
Transition function for temporal extent aggregation for temporal numbers.
Definition: temporal_aggfuncs.c:1042
Datum datum_max_int32(Datum l, Datum r)
Returns the maximum value of the two arguments.
Definition: temporal_aggfuncs.c:81
Structure to represent the common structure of temporal values of any temporal subtype.
Definition: temporal.h:241
Datum tfloat_tmin_transfn(PG_FUNCTION_ARGS)
Transition function for temporal minimum aggregation of temporal float values.
Definition: temporal_aggfuncs.c:1165
Datum datum_min_int32(Datum l, Datum r)
Returns the minimum value of the two arguments.
Definition: temporal_aggfuncs.c:72
Datum tbool_tor_transfn(PG_FUNCTION_ARGS)
Transition function for temporal or aggregation of temporal boolean values.
Definition: temporal_aggfuncs.c:1123
Datum tint_tmin_combinefn(PG_FUNCTION_ARGS)
Combine function for temporal minimum aggregation of temporal integer values.
Definition: temporal_aggfuncs.c:1155
Datum tfloat_tsum_transfn(PG_FUNCTION_ARGS)
Transition function for temporal sum aggregation of temporal float values.
Definition: temporal_aggfuncs.c:1245
Datum tnumber_tavg_transfn(PG_FUNCTION_ARGS)
Transition function for temporal average aggregation.
Definition: temporal_aggfuncs.c:1326
Basic functions for temporal types of any subtype.
Datum temporal_tcount_combinefn(PG_FUNCTION_ARGS)
Generic combine function for temporal aggregation.
Definition: temporal_aggfuncs.c:967
Datum temporal_tagg_finalfn(PG_FUNCTION_ARGS)
Generic final function for temporal aggregation.
Definition: temporal_aggfuncs.c:662
Structure to represent skiplists that keep the current state of an aggregation.
Definition: skiplist.h:77
Datum datum_max_text(Datum l, Datum r)
Returns the maximum value of the two arguments.
Definition: temporal_aggfuncs.c:117
Datum tnumber_tavg_combinefn(PG_FUNCTION_ARGS)
Combine function for temporal average aggregation.
Definition: temporal_aggfuncs.c:1337
Datum temporal_tcount_transfn(PG_FUNCTION_ARGS)
Generic transition function for temporal aggregation.
Definition: temporal_aggfuncs.c:932
Datum tfloat_tmax_transfn(PG_FUNCTION_ARGS)
Transition function for temporal maximum aggregation of temporal float values.
Definition: temporal_aggfuncs.c:1205
Datum tfloat_tmin_combinefn(PG_FUNCTION_ARGS)
Combine function for temporal minimum aggregation of temporal float values.
Definition: temporal_aggfuncs.c:1175
Datum tint_tmax_combinefn(PG_FUNCTION_ARGS)
Combine function for temporal maximum aggregation of temporal integer values.
Definition: temporal_aggfuncs.c:1195
Datum tnumber_extent_combinefn(PG_FUNCTION_ARGS)
Combine function for temporal extent aggregation for temporal numbers.
Definition: temporal_aggfuncs.c:1076
Datum tint_tsum_combinefn(PG_FUNCTION_ARGS)
Combine function for temporal sum aggregation of temporal integer values.
Definition: temporal_aggfuncs.c:1235
Datum datum_sum_double3(Datum l, Datum r)
Returns the sum of the two arguments.
Definition: temporal_aggfuncs.c:145
Datum datum_sum_double4(Datum l, Datum r)
Returns the sum of the two arguments.
Definition: temporal_aggfuncs.c:155
Datum datum_max_float8(Datum l, Datum r)
Returns the maximum value of the two arguments.
Definition: temporal_aggfuncs.c:99
Datum tbool_tand_combinefn(PG_FUNCTION_ARGS)
Combine function for temporal and aggregation of temporal boolean values.
Definition: temporal_aggfuncs.c:1113
Datum(* datum_func2)(Datum, Datum)
Definition: temporal.h:358
SkipList * tsequence_tagg_transfn(FunctionCallInfo fcinfo, SkipList *state, TSequence *seq, datum_func2 func, bool interpoint)
Generic transition function for aggregating temporal values of sequence subtype.
Definition: temporal_aggfuncs.c:520
Datum ttext_tmin_combinefn(PG_FUNCTION_ARGS)
Combine function for temporal minimum aggregation of temporal text values.
Definition: temporal_aggfuncs.c:1277
Datum datum_min_text(Datum l, Datum r)
Returns the minimum value of the two arguments.
Definition: temporal_aggfuncs.c:108
Datum tint_tmin_transfn(PG_FUNCTION_ARGS)
Transition function for temporal minimum aggregation of temporal integer values.
Definition: temporal_aggfuncs.c:1145
Datum ttext_tmin_transfn(PG_FUNCTION_ARGS)
Transition function for temporal minimum aggregation of temporal text values.
Definition: temporal_aggfuncs.c:1267
Datum tbool_tor_combinefn(PG_FUNCTION_ARGS)
Combine function for temporal or aggregation of temporal boolean values.
Definition: temporal_aggfuncs.c:1133
Datum datum_sum_float8(Datum l, Datum r)
Returns the sum of the two arguments.
Definition: temporal_aggfuncs.c:126
Datum temporal_extent_transfn(PG_FUNCTION_ARGS)
Transition function for temporal extent aggregation of temporal values with period bounding box...
Definition: temporal_aggfuncs.c:982
SkipList * temporal_tagg_combinefn1(FunctionCallInfo fcinfo, SkipList *state1, SkipList *state2, datum_func2 func, bool crossings)
Generic combine function for aggregating temporal values.
Definition: temporal_aggfuncs.c:617
Datum tbool_tand_transfn(PG_FUNCTION_ARGS)
Transition function for temporal and aggregation of temporal boolean values.
Definition: temporal_aggfuncs.c:1103
void ensure_same_temp_subtype_skiplist(SkipList *state, int16 subtype, Temporal *temp)
Definition: temporal_aggfuncs.c:442
Datum tfloat_tsum_combinefn(PG_FUNCTION_ARGS)
Combine function for temporal sum aggregation of temporal float values.
Definition: temporal_aggfuncs.c:1255
Structure to represent temporal values of sequence subtype.
Definition: temporal.h:279
Datum temporal_extent_combinefn(PG_FUNCTION_ARGS)
Combine function for temporal extent aggregation.
Definition: temporal_aggfuncs.c:1019
Datum tnumber_tavg_finalfn(PG_FUNCTION_ARGS)
Final function for temporal average aggregation.
Definition: temporal_aggfuncs.c:1393
Datum tint_tsum_transfn(PG_FUNCTION_ARGS)
Transition function for temporal sum aggregation of temporal integer values.
Definition: temporal_aggfuncs.c:1225