|
MobilityDB 1.3
|
General functions for spans (a.k.a. More...
#include "temporal/span.h"#include <assert.h>#include <float.h>#include <limits.h>#include <common/hashfn.h>#include "port/pg_bitutils.h"#include <utils/float.h>#include <utils/timestamp.h>#include <meos.h>#include <meos_internal.h>#include "temporal/meos_catalog.h"#include "temporal/postgres_types.h"#include "temporal/set.h"#include "temporal/temporal.h"#include "temporal/tnumber_mathfuncs.h"#include "temporal/type_parser.h"#include "temporal/type_inout.h"#include "temporal/type_util.h"Functions | |
| Span * | bigintspan_expand (const Span *s, int64 i) |
| Return a big integer span with its bounds expanded/decreased by a value. More... | |
| Interval * | datespan_duration (const Span *s) |
| Return the duration of a date span as an interval. More... | |
| void | datespan_set_tstzspan (const Span *s1, Span *s2) |
| Return the second span initialized with the first one transformed to a timetstamptz span. More... | |
| Span * | datespan_to_tstzspan (const Span *s) |
| Convert a date span into a timestamptz span. More... | |
| bool | ensure_same_span_type (const Span *s1, const Span *s2) |
| Ensure that the spans have the same type. More... | |
| bool | ensure_span_isof_basetype (const Span *s, MeosType basetype) |
| Ensure that a span is of a given base type. More... | |
| bool | ensure_span_isof_type (const Span *s, MeosType spantype) |
| Ensure that a span is of a given span type. More... | |
| bool | ensure_valid_span_span (const Span *s1, const Span *s2) |
| Ensure that two span sets are of the same span type. More... | |
| Span * | floatspan_ceil (const Span *s) |
| Return a float span rounded up to the nearest integer @csqlfn Floatspan_ceil() More... | |
| Span * | floatspan_degrees (const Span *s, bool normalize) |
| Return a float span with the values converted to degrees. More... | |
| Span * | floatspan_expand (const Span *s, double d) |
| Return a float span with its bounds expanded/decreased by a value. More... | |
| Span * | floatspan_floor (const Span *s) |
| Return a float span rounded down to the nearest integer @csqlfn Floatspan_floor() More... | |
| void | floatspan_floor_ceil_iter (Span *s, datum_func1 func) |
| Round down a span to the nearest integer. More... | |
| Span * | floatspan_radians (const Span *s) |
| Return a float span with the values converted to radians. More... | |
| Span * | floatspan_round (const Span *s, int maxdd) |
| Return a float span with the precision of the bounds set to a number of decimal places. More... | |
| void | floatspan_round_set (const Span *s, int maxdd, Span *result) |
| Return in the last argument a float span with the precision set to a number of decimal places. More... | |
| void | floatspan_set_intspan (const Span *s1, Span *s2) |
| Return the second span initialized with the first one transformed to an integer span. More... | |
| Span * | floatspan_to_intspan (const Span *s) |
| Convert a float span into an integer span. More... | |
| Span * | intspan_expand (const Span *s, int i) |
| Return an integer span with its bounds expanded/decreased by a value. More... | |
| void | intspan_set_floatspan (const Span *s1, Span *s2) |
| Return the second span initialized with the first one transformed to a float span. More... | |
| Span * | intspan_to_floatspan (const Span *s) |
| Convert an integer span into a float span. More... | |
| void | numspan_delta_scale_iter (Span *s, Datum origin, Datum delta, bool hasdelta, double scale) |
| Shift and/or scale a span by a delta and a scale (iterator function) More... | |
| Span * | numspan_expand (const Span *s, Datum value) |
| Return a number span with its bounds expanded/decreased by a value. More... | |
| Span * | numspan_shift_scale (const Span *s, Datum shift, Datum width, bool hasshift, bool haswidth) |
| Return a number span shifted and/or scaled by two values. More... | |
| void | numspan_shift_scale_iter (Span *s, Datum shift, Datum width, bool hasshift, bool haswidth, Datum *delta, double *scale) |
| Return a number span shifted and/or scaled by two values (iterator function) More... | |
| Datum | numspan_width (const Span *s) |
| Return the width of a span. More... | |
| void | set_set_span (const Set *s, Span *result) |
| Return in the last argument the bounding span of a set. More... | |
| void | set_set_subspan (const Set *s, int fromidx, int toidx, Span *result) |
| Return in the last argument the bounding span of a set. More... | |
| Span * | set_span (const Set *s) |
| Convert a set into a span. More... | |
| Span * | set_spans (const Set *s) |
| Return an array of spans from the values of a set. More... | |
| Span * | set_split_each_n_spans (const Set *s, int elems_per_span, int *count) |
| Return an array of spans from a set obtained by merging consecutive elements. More... | |
| Span * | set_split_n_spans (const Set *s, int span_count, int *count) |
| Return an array of N spans from the values of a set. More... | |
| Span * | set_to_span (const Set *s) |
| Convert a set into a span. More... | |
| int | span_bound_cmp (const SpanBound *b1, const SpanBound *b2) |
| Compare two span boundary points, returning <0, 0, or >0 according to whether the first one is less than, equal to, or greater than the second one. More... | |
| int | span_bound_qsort_cmp (const void *a1, const void *a2) |
| Comparison function for sorting span bounds. More... | |
| void | span_bounds_shift_scale_time (const Interval *shift, const Interval *duration, TimestampTz *lower, TimestampTz *upper) |
| Shift and/or scale period bounds by two intervals. More... | |
| void | span_bounds_shift_scale_value (Datum shift, Datum width, MeosType basetype, bool hasshift, bool haswidth, Datum *lower, Datum *upper) |
| Shift and/or scale the span bounds by two values. More... | |
| int | span_cmp (const Span *s1, const Span *s2) |
| Return -1, 0, or 1 depending on whether the first span is less than, equal to, or greater than the second one. More... | |
| Span * | span_copy (const Span *s) |
| Return a copy of a span. More... | |
| Datum | span_decr_bound (Datum lower, MeosType basetype) |
| Return the bound decreased by 1 for accounting for canonicalized spans. More... | |
| void | span_deserialize (const Span *s, SpanBound *lower, SpanBound *upper) |
| Deconstruct a span. More... | |
| bool | span_eq (const Span *s1, const Span *s2) |
| Return true if the two spans are equal. More... | |
| void | span_expand (const Span *s1, Span *s2) |
| Return the second span expanded with the first one. More... | |
| bool | span_ge (const Span *s1, const Span *s2) |
| Return true if the first span is greater than or equal to the second one. More... | |
| bool | span_gt (const Span *s1, const Span *s2) |
| Return true if the first span is greater than the second one. More... | |
| uint32 | span_hash (const Span *s) |
| Return the 32-bit hash of a span. More... | |
| uint64 | span_hash_extended (const Span *s, uint64 seed) |
| Return the 64-bit hash of a span using a seed. More... | |
| Span * | span_in (const char *str, MeosType spantype) |
| Return a span from its Well-Known Text (WKT) representation. More... | |
| Datum | span_incr_bound (Datum lower, MeosType basetype) |
| Return the bound increased by 1 for accounting for canonicalized spans. More... | |
| bool | span_le (const Span *s1, const Span *s2) |
| Return true if the first span is less than or equal to the second one. More... | |
| int | span_lower_cmp (const Span *s1, const Span *s2) |
| Compare the lower bounds of two spans, returning <0, 0, or >0 according to whether the first bound is less than, equal to, or greater than the second one. More... | |
| bool | span_lt (const Span *s1, const Span *s2) |
| Return true if the first span is less than the second one. More... | |
| Span * | span_make (Datum lower, Datum upper, bool lower_inc, bool upper_inc, MeosType basetype) |
| Return a span from the bounds. More... | |
| bool | span_ne (const Span *s1, const Span *s2) |
| Return true if the first span is different from the second one. More... | |
| char * | span_out (const Span *s, int maxdd) |
| Return the Well-Known Text (WKT) representation of a span. More... | |
| void | span_set (Datum lower, Datum upper, bool lower_inc, bool upper_inc, MeosType basetype, MeosType spantype, Span *s) |
| Return in the last argument a span constructed from the given arguments. More... | |
| int | span_upper_cmp (const Span *s1, const Span *s2) |
| Compare the upper bounds of two spans, returning <0, 0, or >0 according to whether the first bound is less than, equal to, or greater than the second one. More... | |
| Span * | spanarr_normalize (Span *spans, int count, bool order, int *newcount) |
| Normalize an array of spans. More... | |
| TimestampTz | timestamptz_shift (TimestampTz t, const Interval *interv) |
| Return a timestamptz shifted by an interval. More... | |
| void | tstzspan_delta_scale_iter (Span *s, TimestampTz origin, TimestampTz delta, double scale) |
| Shift and/or scale a timestamptz span by a delta and a scale. More... | |
| Interval * | tstzspan_duration (const Span *s) |
| Return the duration of a timestamptz span as an interval. More... | |
| Span * | tstzspan_expand (const Span *s, const Interval *interv) |
| Return a timestamptz span with its bounds expanded/decreased by an interval. More... | |
| void | tstzspan_set_datespan (const Span *s1, Span *s2) |
| Return the last span initialized with the first one transformed to a date span. More... | |
| Span * | tstzspan_shift_scale (const Span *s, const Interval *shift, const Interval *duration) |
| Return a timestamptz span shifted and/or scaled by two intervals. More... | |
| void | tstzspan_shift_scale1 (Span *s, const Interval *shift, const Interval *duration, TimestampTz *delta, double *scale) |
| Return a timestamptz span shifted and/or scaled by two intervals. More... | |
| Span * | tstzspan_to_datespan (const Span *s) |
| Convert a timestamptz span into a date span. More... | |
| static char * | unquote (char *str) |
| Remove the quotes from the Well-Known Text (WKT) representation of a span. More... | |
| void | value_set_span (Datum value, MeosType basetype, Span *s) |
| Return in the last argument a span constructed from a value. More... | |
| Span * | value_span (Datum value, MeosType basetype) |
| Convert a value into a span. More... | |
General functions for spans (a.k.a.
ranges) composed of two Datum values and two Boolean values stating whether the bounds are inclusive