• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

estebanzimanyi / MobilityDB / 8500781728

31 Mar 2024 08:37PM UTC coverage: 95.311% (-1.9%) from 97.225%
8500781728

push

github

estebanzimanyi
Fix lifting structure for ARM

1 of 1 new or added line in 1 file covered. (100.0%)

1095 existing lines in 71 files now uncovered.

31344 of 32886 relevant lines covered (95.31%)

832354.38 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

96.97
/meos/src/general/span_aggfuncs.c
1
/*****************************************************************************
2
 *
3
 * This MobilityDB code is provided under The PostgreSQL License.
4
 * Copyright (c) 2016-2024, Université libre de Bruxelles and MobilityDB
5
 * contributors
6
 *
7
 * MobilityDB includes portions of PostGIS version 3 source code released
8
 * under the GNU General Public License (GPLv2 or later).
9
 * Copyright (c) 2001-2024, PostGIS contributors
10
 *
11
 * Permission to use, copy, modify, and distribute this software and its
12
 * documentation for any purpose, without fee, and without a written
13
 * agreement is hereby granted, provided that the above copyright notice and
14
 * this paragraph and the following two paragraphs appear in all copies.
15
 *
16
 * IN NO EVENT SHALL UNIVERSITE LIBRE DE BRUXELLES BE LIABLE TO ANY PARTY FOR
17
 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING
18
 * LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION,
19
 * EVEN IF UNIVERSITE LIBRE DE BRUXELLES HAS BEEN ADVISED OF THE POSSIBILITY
20
 * OF SUCH DAMAGE.
21
 *
22
 * UNIVERSITE LIBRE DE BRUXELLES SPECIFICALLY DISCLAIMS ANY WARRANTIES,
23
 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
24
 * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON
25
 * AN "AS IS" BASIS, AND UNIVERSITE LIBRE DE BRUXELLES HAS NO OBLIGATIONS TO
26
 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
27
 *
28
 *****************************************************************************/
29

30
/**
31
 * @file
32
 * @brief Aggregate functions for span types
33
 */
34

35
/* C */
36
#include <assert.h>
37
/* PostgreSQL */
38
#include <postgres.h>
39
#include <utils/timestamp.h>
40
/* MEOS */
41
#include <meos.h>
42
#include <meos_internal.h>
43
#include "general/span.h"
44
#include "general/spanset.h"
45

46
/*****************************************************************************
47
 * Extent
48
 *****************************************************************************/
49

50
/**
51
 * @ingroup meos_internal_setspan_agg
52
 * @brief Transition function for span extent aggregate of values
53
 * @param[in,out] state Current aggregate state
54
 * @param[in] value Value to aggregate
55
 * @param[in] basetype Type of the value
56
 */
57
Span *
58
spanbase_extent_transfn(Span *state, Datum value, meosType basetype)
99✔
59
{
60
  /* Null span: return the span of the base value */
61
  if (! state)
99✔
62
    return span_make(value, value, true, true, basetype);
1✔
63

64
  Span s1;
65
  span_set(value, value, true, true, state->basetype, state->spantype, &s1);
98✔
66
  span_expand(&s1, state);
98✔
67
  return state;
98✔
68
}
69

70
#if MEOS
71
/**
72
 * @ingroup meos_setspan_agg
73
 * @brief Transition function for span extent aggregate of integers
74
 * @param[in,out] state Current aggregate state
75
 * @param[in] i Value to aggregate
76
 */
77
Span *
78
int_extent_transfn(Span *state, int i)
79
{
80
  /* Ensure validity of the arguments */
81
  if (state && ! ensure_span_isof_type(state, T_INTSPAN))
82
    return NULL;
83
  return spanbase_extent_transfn(state, Int32GetDatum(i), T_INT4);
84
}
85

86
/**
87
 * @ingroup meos_setspan_agg
88
 * @brief Transition function for span extent aggregate of big integers
89
 * @param[in,out] state Current aggregate state
90
 * @param[in] i Value to aggregate
91
 */
92
Span *
93
bigint_extent_transfn(Span *state, int64 i)
94
{
95
  /* Ensure validity of the arguments */
96
  if (state && ! ensure_span_isof_type(state, T_BIGINTSPAN))
97
    return NULL;
98
  return spanbase_extent_transfn(state, Int64GetDatum(i), T_INT8);
99
}
100

101
/**
102
 * @ingroup meos_setspan_agg
103
 * @brief Transition function for span extent aggregate of floats
104
 * @param[in,out] state Current aggregate state
105
 * @param[in] d Value to aggregate
106
 */
107
Span *
108
float_extent_transfn(Span *state, double d)
109
{
110
  /* Ensure validity of the arguments */
111
  if (state && ! ensure_span_isof_type(state, T_FLOATSPAN))
112
    return NULL;
113
  return spanbase_extent_transfn(state, Float8GetDatum(d), T_FLOAT8);
114
}
115

116
/**
117
 * @ingroup meos_setspan_agg
118
 * @brief Transition function for span extent aggregate of dates
119
 * @param[in,out] state Current aggregate state
120
 * @param[in] d Value to aggregate
121
 */
122
Span *
123
date_extent_transfn(Span *state, DateADT d)
124
{
125
  /* Ensure validity of the arguments */
126
  if (state && ! ensure_span_isof_type(state, T_DATESPAN))
127
    return NULL;
128
  return spanbase_extent_transfn(state, DateADTGetDatum(d), T_DATE);
129
}
130

131
/**
132
 * @ingroup meos_setspan_agg
133
 * @brief Transition function for span extent aggregate of timestamptz
134
 * @param[in,out] state Current aggregate state
135
 * @param[in] t Value to aggregate
136
 */
137
Span *
138
timestamptz_extent_transfn(Span *state, TimestampTz t)
139
{
140
  /* Ensure validity of the arguments */
141
  if (state && ! ensure_span_isof_type(state, T_TSTZSPAN))
142
    return NULL;
143
  return spanbase_extent_transfn(state, TimestampTzGetDatum(t),
144
    T_TIMESTAMPTZ);
145
}
146
#endif /* MEOS */
147

148
/**
149
 * @ingroup meos_setspan_agg
150
 * @brief Transition function for span extent aggregate of sets
151
 * @param[in,out] state Current aggregate state
152
 * @param[in] s Set to aggregate
153
 */
154
Span *
155
set_extent_transfn(Span *state, const Set *s)
146✔
156
{
157
  /* Can't do anything with null inputs */
158
  if (! state && ! s)
146✔
159
    return NULL;
160
  /* Null period and non-null set: return the bbox of the timestamp set */
161
  if (! state)
102✔
162
    return set_to_span(s);
3✔
163
  /* Non-null period and null set: return the period */
164
  if (! s)
99✔
165
    return state;
166

167
  /* Ensure validity of the arguments */
168
  if (! ensure_set_spantype(s->settype) ||
196✔
169
      ! ensure_span_isof_basetype(state, s->basetype))
98✔
UNCOV
170
    return NULL;
×
171

172
  Span s1;
173
  set_set_span(s, &s1);
98✔
174
  span_expand(&s1, state);
98✔
175
  return state;
98✔
176
}
177

178
/**
179
 * @ingroup meos_setspan_agg
180
 * @brief Transition function for span extent aggregate of spans
181
 * @param[in,out] state Current aggregate state
182
 * @param[in] s Span to aggregate
183
 */
184
Span *
185
span_extent_transfn(Span *state, const Span *s)
20,746✔
186
{
187
  /* Can't do anything with null inputs */
188
  if (! state && ! s)
20,746✔
189
    return NULL;
190
  /* Null span and non-null span, return the span */
191
  if (! state)
20,497✔
192
    return span_cp(s);
11✔
193
  /* Non-null span and null span, return the span */
194
  if (! s)
20,486✔
195
    return state;
196

197
  /* Ensure validity of the arguments */
198
  if (! ensure_same_span_type(state, s))
19,866✔
199
    return NULL;
200

201
  span_expand(s, state);
19,866✔
202
  return state;
19,866✔
203
}
204

205
/**
206
 * @ingroup meos_setspan_agg
207
 * @brief Transition function for span extent aggregate of span sets
208
 * @param[in,out] state Current aggregate state
209
 * @param[in] ss Span set to aggregate
210
 */
211
Span *
212
spanset_extent_transfn(Span *state, const SpanSet *ss)
146✔
213
{
214
  /* Can't do anything with null inputs */
215
  if (! state && ! ss)
146✔
216
    return NULL;
217
  /* Null  and non-null span set, return the bbox of the span set */
218
  if (! state)
102✔
219
    return span_cp(&ss->span);
3✔
220
  /* Non-null span and null temporal, return the span */
221
  if (! ss)
99✔
222
    return state;
223

224
  /* Ensure validity of the arguments */
225
  if (! ensure_same_spanset_span_type(ss, state))
98✔
226
    return NULL;
227

228
  span_expand(&ss->span, state);
98✔
229
  return state;
98✔
230
}
231

232
/*****************************************************************************/
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc