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

Bin and tile functions for temporal types. More...

#include "temporal/temporal_tile.h"
#include <assert.h>
#include <float.h>
#include <limits.h>
#include <math.h>
#include <postgres.h>
#include <utils/date.h>
#include <utils/datetime.h>
#include <meos.h>
#include <meos_internal.h>
#include "temporal/span.h"
#include "temporal/spanset.h"
#include "temporal/temporal_restrict.h"
#include "temporal/tsequence.h"
#include "temporal/type_util.h"

Functions

static int bin_position (Datum value, Datum size, Datum origin, meosType type)
 Get the bin number in the bin space that contains the value. More...
 
TBoxtbox_value_time_tiles (const TBox *box, Datum vsize, const Interval *duration, Datum vorigin, TimestampTz torigin, int *count)
 Generate a multidimensional grid for temporal numbers. More...
 
static TSequence ** tcontseq_time_split (const TSequence *seq, TimestampTz start, TimestampTz end, int64 tunits, int count, TimestampTz **bins, int *newcount)
 Split a temporal value into an array of fragments according to time bins. More...
 
static int tcontseq_time_split_iter (const TSequence *seq, TimestampTz start, TimestampTz end, int64 tunits, int count, TSequence **result, TimestampTz *times)
 Split a temporal value into an array of fragments according to time bins. More...
 
static TSequence ** tdiscseq_time_split (const TSequence *seq, TimestampTz start, int64 tunits, int count, TimestampTz **bins, int *newcount)
 Split a temporal value into an array of fragments according to time bins. More...
 
Temporal ** temporal_time_split (const Temporal *temp, const Interval *duration, TimestampTz torigin, TimestampTz **bins, int *count)
 Return the fragments of a temporal value split according to time bins. More...
 
static Temporal ** temporal_time_split_int (const Temporal *temp, TimestampTz start, TimestampTz end, int64 tunits, TimestampTz torigin, int count, TimestampTz **bins, int *newcount)
 Return the fragments of a temporal value split according to time bins. More...
 
TBoxtfloat_time_boxes (const Temporal *temp, const Interval *duration, TimestampTz torigin, int *count)
 Return the temporal boxes of a temporal number split with respect to a value and possibly a time grid. More...
 
TBoxtfloat_value_boxes (const Temporal *temp, double vsize, double vorigin, int *count)
 Return the temporal boxes of a temporal number split with respect to a value grid. More...
 
Temporal ** tfloat_value_split (const Temporal *temp, double size, double origin, double **bins, int *count)
 Return the fragments of a temporal float split according to value bins. More...
 
TBoxtfloat_value_time_boxes (const Temporal *temp, double vsize, const Interval *duration, double vorigin, TimestampTz torigin, int *count)
 Return the temporal boxes of a temporal number split with respect to a value and possibly a time grid. More...
 
Temporal ** tfloat_value_time_split (const Temporal *temp, double size, const Interval *duration, double vorigin, TimestampTz torigin, double **value_bins, TimestampTz **time_bins, int *count)
 Return the fragments of a temporal integer split according to value and time bins. More...
 
TBoxtfloatbox_time_tiles (const TBox *box, const Interval *duration, TimestampTz torigin, int *count)
 Return the time tiles of a temporal float box. More...
 
TBoxtfloatbox_value_tiles (const TBox *box, double vsize, double vorigin, int *count)
 Return the value tiles of a temporal float box. More...
 
TBoxtfloatbox_value_time_tiles (const TBox *box, double vsize, const Interval *duration, double vorigin, TimestampTz torigin, int *count)
 Return the tiles of a temporal float box. More...
 
static TInstant ** tinstant_time_split (const TInstant *inst, int64 tunits, TimestampTz torigin, TimestampTz **bins, int *count)
 Split a temporal value into an array of fragments according to time bins. More...
 
TBoxtint_time_boxes (const Temporal *temp, const Interval *duration, TimestampTz torigin, int *count)
 Return the temporal boxes of a temporal number split with respect to a time grid. More...
 
TBoxtint_value_boxes (const Temporal *temp, int vsize, int vorigin, int *count)
 Return the temporal boxes of a temporal number split with respect to a value grid. More...
 
Temporal ** tint_value_split (const Temporal *temp, int size, int origin, int **bins, int *count)
 Return the fragments of a temporal integer split according to value bins. More...
 
TBoxtint_value_time_boxes (const Temporal *temp, int vsize, const Interval *duration, int vorigin, TimestampTz torigin, int *count)
 Return the temporal boxes of a temporal number split with respect to a value and possibly a time grid. More...
 
Temporal ** tint_value_time_split (const Temporal *temp, int size, const Interval *duration, int vorigin, TimestampTz torigin, int **value_bins, TimestampTz **time_bins, int *count)
 Return the fragments of a temporal integer split according to value and time bins. More...
 
TBoxtintbox_time_tiles (const TBox *box, const Interval *duration, TimestampTz torigin, int *count)
 Return the time tiles of a temporal float box. More...
 
TBoxtintbox_value_tiles (const TBox *box, int vsize, int vorigin, int *count)
 Return the value tiles of a temporal integer box. More...
 
TBoxtintbox_value_time_tiles (const TBox *box, int vsize, const Interval *duration, int vorigin, TimestampTz torigin, int *count)
 Return the tiles of a temporal integer box. More...
 
Temporal ** tnumber_value_split (const Temporal *temp, Datum size, Datum vorigin, Datum **bins, int *count)
 Split a temporal number into an array of fragments according to value bins. More...
 
Temporal ** tnumber_value_time_split (const Temporal *temp, Datum size, const Interval *duration, Datum vorigin, TimestampTz torigin, Datum **value_bins, TimestampTz **time_bins, int *count)
 Return a temporal value split according to a base value and possibly a temporal grid. More...
 
static TInstant ** tnumberinst_value_split (const TInstant *inst, Datum start_bin, Datum size, Datum **bins, int *newcount)
 Split a temporal value into an array of fragments according to value bins. More...
 
static TSequenceSet ** tnumberseq_cont_value_split (const TSequence *seq, Datum start_bin, Datum size, int count, Datum **bins, int *newcount)
 Split a temporal value into an array of fragments according to value bins. More...
 
static TSequence ** tnumberseq_disc_value_split (const TSequence *seq, Datum start_bin, Datum size, int count, Datum **bins, int *newcount)
 Split a temporal value into an array of fragments according to value bins. More...
 
static void tnumberseq_linear_value_split (const TSequence *seq, Datum start_bin, Datum size, int count, TSequence **result, int *nseqs, int numcols)
 Split a temporal value into an array of fragments according to value bins. More...
 
static void tnumberseq_step_value_split (const TSequence *seq, Datum start_bin, Datum size, int count, TSequence **result, int *nseqs, int numcols)
 Split a temporal value into an array of fragments according to value bins. More...
 
static TSequenceSet ** tnumberseqset_value_split (const TSequenceSet *ss, Datum start_bin, Datum size, int count, Datum **bins, int *newcount)
 Split a temporal value into an array of fragments according to value bins. More...
 
static TSequenceSet ** tsequenceset_time_split (const TSequenceSet *ss, TimestampTz start, TimestampTz end, int64 tunits, int count, TimestampTz **bins, int *newcount)
 Split a temporal value into an array of disjoint fragments. More...
 

Detailed Description

Bin and tile functions for temporal types.

Note
The time bin functions are inspired from TimescaleDB https://docs.timescale.com/latest/api#time_bucket