MobilityDB 1.3
Loading...
Searching...
No Matches
Functions
temporal_aggfuncs.c File Reference

General aggregate functions for temporal types. More...

#include "temporal/temporal_aggfuncs.h"
#include <assert.h>
#include <string.h>
#include <postgres.h>
#include <utils/timestamp.h>
#include <meos.h>
#include <meos_internal.h>
#include "temporal/postgres_types.h"
#include "temporal/set.h"
#include "temporal/skiplist.h"
#include "temporal/span.h"
#include "temporal/spanset.h"
#include "temporal/temporal_restrict.h"
#include "temporal/tbool_ops.h"
#include "temporal/tinstant.h"
#include "temporal/tsequence.h"
#include "temporal/tsequenceset.h"
#include "temporal/type_util.h"

Functions

Datum datum_max_float8 (Datum l, Datum r)
 Return the maximum value of the two arguments. More...
 
Datum datum_max_int32 (Datum l, Datum r)
 Return the maximum value of the two arguments. More...
 
Datum datum_max_text (Datum l, Datum r)
 Return the maximum value of the two arguments. More...
 
Datum datum_min_float8 (Datum l, Datum r)
 Return the minimum value of the two arguments. More...
 
Datum datum_min_int32 (Datum l, Datum r)
 Return the minimum value of the two arguments. More...
 
Datum datum_min_text (Datum l, Datum r)
 Return the minimum value of the two arguments. More...
 
Datum datum_sum_double2 (Datum l, Datum r)
 Return the sum of the two arguments. More...
 
Datum datum_sum_double3 (Datum l, Datum r)
 Return the sum of the two arguments. More...
 
Datum datum_sum_double4 (Datum l, Datum r)
 Return the sum of the two arguments. More...
 
Datum datum_sum_float8 (Datum l, Datum r)
 Return the sum of the two arguments. More...
 
Datum datum_sum_int32 (Datum l, Datum r)
 Return the sum of the two arguments. More...
 
bool ensure_same_skiplist_subtype (SkipList *state, uint8 subtype)
 
Temporal ** skiplist_temporal_values (SkipList *list)
 Return a copy of the temporal values contained in the skiplist. More...
 
static int span_span_cmp (const Span *s1, const Span *s2)
 Determine the relative position of two periods. More...
 
static int span_timestamptz_cmp (const Span *s, TimestampTz t)
 Determine the relative position of a span and a timestamptz. More...
 
SkipListtcontseq_tagg_transfn (SkipList *state, const TSequence *seq, datum_func2 func, bool crossings)
 Generic transition function for aggregating temporal values of sequence subtype. More...
 
TSequencetcontseq_transform_tagg (const TSequence *seq, TInstant *(*func)(const TInstant *))
 Transform a temporal sequence value for aggregation. More...
 
static TSequencetcontseq_transform_tcount (const TSequence *seq)
 Transform a temporal sequence value into a temporal integer value for performing temporal count aggregation. More...
 
SkipListtdiscseq_tagg_transfn (SkipList *state, const TSequence *seq, datum_func2 func)
 Generic transition function for aggregating temporal discrete sequence values. More...
 
TInstant ** tdiscseq_transform_tagg (const TSequence *seq, TInstant *(*func)(const TInstant *))
 Transform a temporal discrete sequence value for aggregation. More...
 
static TInstant ** tdiscseq_transform_tcount (const TSequence *seq)
 Transform a temporal discrete sequence value into a temporal integer value for performing temporal count aggregation. More...
 
Temporaltemporal_app_tinst_transfn (Temporal *state, const TInstant *inst, interpType interp, double maxdist, const Interval *maxt)
 Transition function for append temporal instant aggregate. More...
 
Temporaltemporal_app_tseq_transfn (Temporal *state, const TSequence *seq)
 Transition function for append temporal sequence aggregate. More...
 
Spantemporal_extent_transfn (Span *state, const Temporal *temp)
 Transition function for temporal extent aggregate of temporal values. More...
 
int temporal_skiplist_common (SkipList *list, void **values, int count, int *lower, int *upper, int update[SKIPLIST_MAXLEVEL])
 Determine the segment of the list that overlaps with the new set of temporal values. More...
 
static int temporal_skiplist_elempos (const SkipList *list, Span *s, int cur)
 Comparison function used for skiplists. More...
 
void ** temporal_skiplist_merge (void **spliced, int spliced_count, void **values, int count, datum_func2 func, bool crossings, int *newcount, void ***tofree, int *nfree)
 Return the new values obtained by merging the segment of the list that overlaps with the new set of temporal values. More...
 
void temporal_skiplist_splice (SkipList *list, void **values, int count, datum_func2 func, bool crossings)
 Insert a new set of values to the skiplist while performing the aggregation between the new values that overlap with the values in the list. More...
 
SkipListtemporal_tagg_combinefn (SkipList *state1, SkipList *state2, datum_func2 func, bool crossings)
 Generic combine function for aggregating temporal values. More...
 
Temporaltemporal_tagg_finalfn (SkipList *state)
 Generic final function for aggregating temporal values. More...
 
SkipListtemporal_tagg_transfn (SkipList *state, const Temporal *temp, datum_func2 func, bool crossings)
 Generic transition function for aggregating temporal values of sequence set subtype. More...
 
SkipListtemporal_tagg_transform_transfn (SkipList *state, const Temporal *temp, datum_func2 func, bool crossings, TInstant *(*transform)(const TInstant *))
 Transition function for aggregating temporal values that require a transformation to each composing instant/sequence. More...
 
SkipListtemporal_tcount_transfn (SkipList *state, const Temporal *temp)
 Transition function for temporal count aggregation. More...
 
Temporal ** temporal_transform_tagg (const Temporal *temp, int *count, TInstant *(*func)(const TInstant *))
 Transform a temporal value for aggregation. More...
 
Temporal ** temporal_transform_tcount (const Temporal *temp, int *count)
 Transform a temporal value into a temporal integer value for performing temporal count aggregation (dispatch function) More...
 
static TInstant ** timestamp_transform_tcount (TimestampTz t)
 Transform a timestamp value into a temporal integer value for performing temporal count aggregation. More...
 
SkipListtimestamptz_tcount_transfn (SkipList *state, TimestampTz t)
 Transition function for temporal count aggregate of timestamps. More...
 
TInstant ** tinstant_tagg (const TInstant **instants1, int count1, const TInstant **instants2, int count2, datum_func2 func, int *newcount, void ***tofree, int *nfree)
 Generic aggregate function for temporal instants. More...
 
SkipListtinstant_tagg_transfn (SkipList *state, const TInstant *inst, datum_func2 func)
 Generic transition function for aggregating temporal values of instant subtype. More...
 
TSequencetinstant_tavg_finalfn (const TInstant **instants, int count)
 Final function for temporal average aggregation of temporal instant values. More...
 
static TInstanttinstant_transform_tcount (const TInstant *inst)
 Transform a temporal instant value into a temporal integer value for performing temporal count aggregation. More...
 
TBoxtnumber_extent_transfn (TBox *state, const Temporal *temp)
 Transition function for temporal extent aggregate of temporal numbers. More...
 
Temporaltnumber_tavg_finalfn (SkipList *state)
 Final function for temporal average aggregation. More...
 
TInstanttnumberinst_transform_tavg (const TInstant *inst)
 Transform a temporal number into a temporal double2 value for performing temporal average aggregation. More...
 
TSequence ** tsequence_tagg (const TSequence **sequences1, int count1, const TSequence **sequences2, int count2, datum_func2 func, bool crossings, int *newcount)
 Generic aggregate function for temporal sequences. More...
 
static int tsequence_tagg_iter (const TSequence *seq1, const TSequence *seq2, datum_func2 func, bool crossings, TSequence **result)
 Generic aggregate function for temporal sequences (iterator function) More...
 
TSequenceSettsequence_tavg_finalfn (const TSequence **sequences, int count)
 Final function for temporal average aggregation of temporal sequence values. More...
 
SkipListtsequenceset_tagg_transfn (SkipList *state, const TSequenceSet *ss, datum_func2 func, bool crossings)
 Generic transition function for aggregating temporal values of sequence set subtype. More...
 
TSequence ** tsequenceset_transform_tagg (const TSequenceSet *ss, TInstant *(*func)(const TInstant *))
 Transform a temporal sequence set for aggregation. More...
 
static TSequence ** tsequenceset_transform_tcount (const TSequenceSet *ss)
 Transform a temporal sequence set value into a temporal integer value for performing temporal count aggregation. More...
 
SkipListtstzset_tcount_transfn (SkipList *state, const Set *s)
 Transition function for temporal count aggregate of timestamp sets. More...
 
static TInstant ** tstzset_transform_tcount (const Set *s)
 Transform a timestamp set value into a temporal integer value for performing temporal count aggregation. More...
 
SkipListtstzspan_tcount_transfn (SkipList *state, const Span *s)
 Transition function for temporal count aggregate of timestamptz spans. More...
 
static TSequencetstzspan_transform_tcount (const Span *s)
 Transform a a timestamptz span into a temporal integer value for performing temporal count aggregation. More...
 
SkipListtstzspanset_tcount_transfn (SkipList *state, const SpanSet *ss)
 Transition function for temporal count aggregate of timestamptz span sets. More...
 
static TSequence ** tstzspanset_transform_tcount (const SpanSet *ss)
 Transform a timestamptz span set value into a temporal integer value for performing temporal count aggregation. More...
 

Detailed Description

General aggregate functions for temporal types.