MobilityDB  1.0
Functions
temporal_aggfuncs.c File Reference

Temporal aggregate functions. More...

#include "general/temporal_aggfuncs.h"
#include <assert.h>
#include <math.h>
#include <string.h>
#include <catalog/pg_collation.h>
#include <libpq/pqformat.h>
#include <utils/memutils.h>
#include <utils/timestamp.h>
#include "general/skiplist.h"
#include "general/period.h"
#include "general/timeops.h"
#include "general/temporaltypes.h"
#include "general/tempcache.h"
#include "general/temporal_util.h"
#include "general/tbool_boolops.h"
#include "general/temporal_boxops.h"
#include "general/doublen.h"
#include "general/time_aggfuncs.h"
Include dependency graph for temporal_aggfuncs.c:

Functions

TInstant ** tinstant_tagg (TInstant **instants1, int count1, TInstant **instants2, int count2, datum_func2 func, int *newcount)
 
TSequence ** tsequence_tagg (TSequence **sequences1, int count1, TSequence **sequences2, int count2, datum_func2 func, bool crossings, int *newcount)
 Generic aggregate function for temporal sequences. More...
 
Datum datum_min_int32 (Datum l, Datum r)
 Returns the minimum value of the two arguments. More...
 
Datum datum_max_int32 (Datum l, Datum r)
 Returns the maximum value of the two arguments. More...
 
Datum datum_min_float8 (Datum l, Datum r)
 Returns the minimum value of the two arguments. More...
 
Datum datum_max_float8 (Datum l, Datum r)
 Returns the maximum value of the two arguments. More...
 
Datum datum_min_text (Datum l, Datum r)
 Returns the minimum value of the two arguments. More...
 
Datum datum_max_text (Datum l, Datum r)
 Returns the maximum value of the two arguments. More...
 
Datum datum_sum_float8 (Datum l, Datum r)
 Returns the sum of the two arguments. More...
 
Datum datum_sum_double2 (Datum l, Datum r)
 Returns the sum of the two arguments. More...
 
Datum datum_sum_double3 (Datum l, Datum r)
 Returns the sum of the two arguments. More...
 
Datum datum_sum_double4 (Datum l, Datum r)
 Returns the sum of the two arguments. More...
 
static int tsequence_tagg1 (TSequence **result, const TSequence *seq1, const TSequence *seq2, datum_func2 func, bool crossings)
 Generic aggregate function for temporal sequences. More...
 
void ensure_same_temp_subtype_skiplist (SkipList *state, int16 subtype, Temporal *temp)
 
static SkipListtinstant_tagg_transfn (FunctionCallInfo fcinfo, SkipList *state, const TInstant *inst, datum_func2 func)
 Generic transition function for aggregating temporal values of instant subtype. More...
 
static SkipListtinstantset_tagg_transfn (FunctionCallInfo fcinfo, SkipList *state, const TInstantSet *ti, datum_func2 func)
 Generic transition function for aggregating temporal values of instant set subtype. More...
 
SkipListtsequence_tagg_transfn (FunctionCallInfo fcinfo, SkipList *state, TSequence *seq, datum_func2 func, bool crossings)
 Generic transition function for aggregating temporal values of sequence subtype. More...
 
static SkipListtsequenceset_tagg_transfn (FunctionCallInfo fcinfo, SkipList *state, const TSequenceSet *ts, datum_func2 func, bool crossings)
 Generic transition function for aggregating temporal values of sequence set subtype. More...
 
static Datum temporal_tagg_transfn (FunctionCallInfo fcinfo, datum_func2 func, bool crossings)
 Generic transition function for aggregating temporal values. More...
 
SkipListtemporal_tagg_combinefn1 (FunctionCallInfo fcinfo, SkipList *state1, SkipList *state2, datum_func2 func, bool crossings)
 Generic combine function for aggregating temporal values. More...
 
Datum temporal_tagg_combinefn (FunctionCallInfo fcinfo, datum_func2 func, bool crossings)
 Generic combine function for aggregating temporal alphanumeric values. More...
 
PGDLLEXPORT Datum temporal_tagg_finalfn (PG_FUNCTION_ARGS)
 Generic final function for temporal aggregation. More...
 
TInstant ** tinstantset_transform_tagg (const TInstantSet *ti, TInstant *(*func)(const TInstant *))
 Transform a temporal instant set value for aggregation. More...
 
TSequencetsequence_transform_tagg (const TSequence *seq, TInstant *(*func)(const TInstant *))
 Transform a temporal sequence value for aggregation. More...
 
TSequence ** tsequenceset_transform_tagg (const TSequenceSet *ts, TInstant *(*func)(const TInstant *))
 Transform a temporal sequence set value for aggregation. More...
 
Temporal ** temporal_transform_tagg (const Temporal *temp, int *count, TInstant *(*func)(const TInstant *))
 Transform a temporal value for aggregation (dispatch function) More...
 
Datum temporal_tagg_transform_transfn (FunctionCallInfo fcinfo, 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...
 
static TInstanttinstant_transform_tcount (const TInstant *inst)
 Transform a temporal instant value into a temporal integer value for performing temporal count aggregation. More...
 
static TInstant ** tinstantset_transform_tcount (const TInstantSet *ti)
 Transform a temporal instant set value into a temporal integer value for performing temporal count aggregation. More...
 
static TSequencetsequence_transform_tcount (const TSequence *seq)
 Transform a temporal sequence value into a temporal integer value for performing temporal count aggregation. More...
 
static TSequence ** tsequenceset_transform_tcount (const TSequenceSet *ts)
 Transform a temporal sequence set value into a temporal integer value for performing temporal count aggregation. More...
 
static 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...
 
PGDLLEXPORT Datum temporal_tcount_transfn (PG_FUNCTION_ARGS)
 Generic transition function for temporal aggregation. More...
 
PGDLLEXPORT Datum temporal_tcount_combinefn (PG_FUNCTION_ARGS)
 Generic combine function for temporal aggregation. More...
 
PGDLLEXPORT Datum temporal_extent_transfn (PG_FUNCTION_ARGS)
 Transition function for temporal extent aggregation of temporal values with period bounding box. More...
 
PGDLLEXPORT Datum temporal_extent_combinefn (PG_FUNCTION_ARGS)
 Combine function for temporal extent aggregation. More...
 
PGDLLEXPORT Datum tnumber_extent_transfn (PG_FUNCTION_ARGS)
 Transition function for temporal extent aggregation for temporal numbers. More...
 
PGDLLEXPORT Datum tnumber_extent_combinefn (PG_FUNCTION_ARGS)
 Combine function for temporal extent aggregation for temporal numbers. More...
 
PGDLLEXPORT Datum tbool_tand_transfn (PG_FUNCTION_ARGS)
 Transition function for temporal and aggregation of temporal boolean values. More...
 
PGDLLEXPORT Datum tbool_tand_combinefn (PG_FUNCTION_ARGS)
 Combine function for temporal and aggregation of temporal boolean values. More...
 
PGDLLEXPORT Datum tbool_tor_transfn (PG_FUNCTION_ARGS)
 Transition function for temporal or aggregation of temporal boolean values. More...
 
PGDLLEXPORT Datum tbool_tor_combinefn (PG_FUNCTION_ARGS)
 Combine function for temporal or aggregation of temporal boolean values. More...
 
PGDLLEXPORT Datum tint_tmin_transfn (PG_FUNCTION_ARGS)
 Transition function for temporal minimum aggregation of temporal integer values. More...
 
PGDLLEXPORT Datum tint_tmin_combinefn (PG_FUNCTION_ARGS)
 Combine function for temporal minimum aggregation of temporal integer values. More...
 
PGDLLEXPORT Datum tfloat_tmin_transfn (PG_FUNCTION_ARGS)
 Transition function for temporal minimum aggregation of temporal float values. More...
 
PGDLLEXPORT Datum tfloat_tmin_combinefn (PG_FUNCTION_ARGS)
 Combine function for temporal minimum aggregation of temporal float values. More...
 
PGDLLEXPORT Datum tint_tmax_transfn (PG_FUNCTION_ARGS)
 Transition function for temporal maximum aggregation of temporal integer values. More...
 
PGDLLEXPORT Datum tint_tmax_combinefn (PG_FUNCTION_ARGS)
 Combine function for temporal maximum aggregation of temporal integer values. More...
 
PGDLLEXPORT Datum tfloat_tmax_transfn (PG_FUNCTION_ARGS)
 Transition function for temporal maximum aggregation of temporal float values. More...
 
PGDLLEXPORT Datum tfloat_tmax_combinefn (PG_FUNCTION_ARGS)
 Combine function for temporal maximum aggregation of temporal float values. More...
 
PGDLLEXPORT Datum tint_tsum_transfn (PG_FUNCTION_ARGS)
 Transition function for temporal sum aggregation of temporal integer values. More...
 
PGDLLEXPORT Datum tint_tsum_combinefn (PG_FUNCTION_ARGS)
 Combine function for temporal sum aggregation of temporal integer values. More...
 
PGDLLEXPORT Datum tfloat_tsum_transfn (PG_FUNCTION_ARGS)
 Transition function for temporal sum aggregation of temporal float values. More...
 
PGDLLEXPORT Datum tfloat_tsum_combinefn (PG_FUNCTION_ARGS)
 Combine function for temporal sum aggregation of temporal float values. More...
 
PGDLLEXPORT Datum ttext_tmin_transfn (PG_FUNCTION_ARGS)
 Transition function for temporal minimum aggregation of temporal text values. More...
 
PGDLLEXPORT Datum ttext_tmin_combinefn (PG_FUNCTION_ARGS)
 Combine function for temporal minimum aggregation of temporal text values. More...
 
PGDLLEXPORT Datum ttext_tmax_transfn (PG_FUNCTION_ARGS)
 Transition function for temporal maximum aggregation of temporal text values. More...
 
PGDLLEXPORT Datum ttext_tmax_combinefn (PG_FUNCTION_ARGS)
 Combine function for temporal maximum aggregation of temporal text values. More...
 
TInstanttnumberinst_transform_tavg (const TInstant *inst)
 Transform a temporal number into a temporal double2 value for performing temporal average aggregation. More...
 
PGDLLEXPORT Datum tnumber_tavg_transfn (PG_FUNCTION_ARGS)
 Transition function for temporal average aggregation. More...
 
PGDLLEXPORT Datum tnumber_tavg_combinefn (PG_FUNCTION_ARGS)
 Combine function for temporal average aggregation. More...
 
static TInstantSettinstant_tavg_finalfn (TInstant **instants, int count)
 Final function for temporal average aggregation of temporal instat values. More...
 
static TSequenceSettsequence_tavg_finalfn (TSequence **sequences, int count)
 Final function for temporal average aggregation of temporal sequence values. More...
 
PGDLLEXPORT Datum tnumber_tavg_finalfn (PG_FUNCTION_ARGS)
 Final function for temporal average aggregation. More...
 
PGDLLEXPORT Datum temporal_merge_transfn (PG_FUNCTION_ARGS)
 Transition function for union aggregate of periods. More...
 
PGDLLEXPORT Datum temporal_merge_combinefn (PG_FUNCTION_ARGS)
 Combine function for union aggregate of time types. More...
 

Detailed Description

Temporal aggregate functions.