MobilityDB 1.3
Loading...
Searching...
No Matches
Functions
temporal_tile.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

int64 bigint_get_bin (int64 value, int64 size, int64 origin)
 Return the initial value of the bin that contains an integer. More...
 
static DateADT date_bin_start (DateADT d, int32 ndays, DateADT origin)
 To bin by day we get the year and month of a date and convert that to the nth month since origin. More...
 
DateADT date_get_bin (DateADT d, const Interval *duration, DateADT origin)
 Return the initial date of the bin that contains a date. More...
 
Datum datum_bin (Datum value, Datum size, Datum origin, meosType type)
 Return the initial value of the bin that contains a number value. More...
 
double float_get_bin (double value, double size, double origin)
 Return the initial value of the bin that contains a float. More...
 
int int_get_bin (int value, int size, int origin)
 Return the initial value of the bin that contains an integer. More...
 
int64 interval_units (const Interval *interval)
 Return the interval in the same representation as Postgres timestamps. More...
 
Spanspan_bins (const Span *s, Datum size, Datum origin, int *count)
 Return the bins from a span. More...
 
int span_num_bins (const Span *s, Datum size, Datum origin, Datum *start_bin, Datum *end_bin)
 Get the time bins of a temporal value. More...
 
Spanspanset_bins (const SpanSet *ss, Datum size, Datum origin, int *count)
 Return the bins from a span set. More...
 
TBoxtbox_get_value_time_tile (Datum value, TimestampTz t, Datum vsize, const Interval *duration, Datum vorigin, TimestampTz torigin, meosType basetype, meosType spantype)
 Return a tile in a multidimensional grid for temporal numbers. More...
 
bool tbox_tile_state_get (TboxGridState *state, TBox *box)
 Get the current tile of the multidimensional grid. More...
 
TboxGridStatetbox_tile_state_make (const Temporal *temp, const TBox *box, Datum vsize, const Interval *duration, Datum vorigin, TimestampTz torigin)
 Create the initial state for tiling operations. More...
 
void tbox_tile_state_next (TboxGridState *state)
 Increment the current state to the next tile of the multidimensional grid. More...
 
void tbox_tile_state_set (Datum value, TimestampTz t, Datum vsize, int64 tunits, meosType basetype, meosType spantype, TBox *box)
 Generate a tile from the a multidimensional grid. More...
 
Spantemporal_time_bins (const Temporal *temp, const Interval *duration, TimestampTz torigin, int *count)
 Return the time bins of a temporal value. More...
 
TimestampTz timestamptz_bin_start (TimestampTz t, int64 size, TimestampTz origin)
 Return the initial timestamp of the bin that contains a timestamptz (internal function) More...
 
TimestampTz timestamptz_get_bin (TimestampTz t, const Interval *duration, TimestampTz origin)
 Return the initial timestamp of the bin that contains a timestamptz. More...
 
Spantnumber_value_bins (const Temporal *temp, Datum vsize, Datum vorigin, int *count)
 Return the bins of a temporal number. More...
 
TBoxtnumber_value_time_boxes (const Temporal *temp, Datum vsize, const Interval *duration, Datum 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...
 
TboxGridStatetnumber_value_time_tile_init (const Temporal *temp, Datum vsize, const Interval *duration, Datum vorigin, TimestampTz torigin, int *ntiles)
 Set the state with a temporal number and a value and possibly time grid for splitting or obtaining a set of temporal boxes. 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