MobilityDB  1.0
time_selfuncs.h
Go to the documentation of this file.
1 /*****************************************************************************
2  *
3  * This MobilityDB code is provided under The PostgreSQL License.
4  *
5  * Copyright (c) 2016-2021, Université libre de Bruxelles and MobilityDB
6  * contributors
7  *
8  * MobilityDB includes portions of PostGIS version 3 source code released
9  * under the GNU General Public License (GPLv2 or later).
10  * Copyright (c) 2001-2021, PostGIS contributors
11  *
12  * Permission to use, copy, modify, and distribute this software and its
13  * documentation for any purpose, without fee, and without a written
14  * agreement is hereby granted, provided that the above copyright notice and
15  * this paragraph and the following two paragraphs appear in all copies.
16  *
17  * IN NO EVENT SHALL UNIVERSITE LIBRE DE BRUXELLES BE LIABLE TO ANY PARTY FOR
18  * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING
19  * LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION,
20  * EVEN IF UNIVERSITE LIBRE DE BRUXELLES HAS BEEN ADVISED OF THE POSSIBILITY
21  * OF SUCH DAMAGE.
22  *
23  * UNIVERSITE LIBRE DE BRUXELLES SPECIFICALLY DISCLAIMS ANY WARRANTIES,
24  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
25  * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON
26  * AN "AS IS" BASIS, AND UNIVERSITE LIBRE DE BRUXELLES HAS NO OBLIGATIONS TO
27  * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 
28  *
29  *****************************************************************************/
30 
36 #ifndef __TIME_SELFUNCS_H__
37 #define __TIME_SELFUNCS_H__
38 
39 #include <postgres.h>
40 #include <catalog/pg_type.h>
41 #include <utils/selfuncs.h>
42 
43 #include "temporal_selfuncs.h"
44 #include "timetypes.h"
45 
46 /*****************************************************************************/
47 
48 extern double calc_period_hist_selectivity(VariableStatData *vardata,
49  const Period *constval, CachedOp cachedOp);
50 extern double calc_period_hist_selectivity_scalar(PeriodBound *constbound,
51  PeriodBound *hist, int hist_nvalues, bool equal);
53  PeriodBound *upper, PeriodBound *hist_lower, int hist_nvalues,
54  Datum *length_hist_values, int length_hist_nvalues);
56  PeriodBound *upper, PeriodBound *hist_lower, int hist_nvalues,
57  Datum *length_hist_values, int length_hist_nvalues);
59  PeriodBound *upper, PeriodBound *hist_lower,
60  PeriodBound *hist_upper, int hist_nvalues);
61 
62 extern int length_hist_bsearch(Datum *length_hist_values,
63  int length_hist_nvalues, double value, bool equal);
64 extern double get_len_position(double value, double hist1, double hist2);
65 extern double calc_length_hist_frac(Datum *length_hist_values, int length_hist_nvalues,
66  double length1, double length2, bool equal);
67 
68 extern Datum period_analyze(PG_FUNCTION_ARGS);
69 extern Datum timestampset_analyze(PG_FUNCTION_ARGS);
70 extern Datum periodset_analyze(PG_FUNCTION_ARGS);
71 
72 /*****************************************************************************/
73 
74 #endif
double calc_period_hist_selectivity_scalar(PeriodBound *constbound, PeriodBound *hist, int hist_nvalues, bool equal)
Definition: time_selfuncs.c:363
double calc_period_hist_selectivity(VariableStatData *vardata, const Period *constval, CachedOp cachedOp)
Definition: time_selfuncs.c:162
Structure to represent periods.
Definition: timetypes.h:52
Internal representation of either bound of a period (not what&#39;s on disk)
Definition: timetypes.h:63
double calc_length_hist_frac(Datum *length_hist_values, int length_hist_nvalues, double length1, double length2, bool equal)
Definition: time_selfuncs.c:467
double calc_period_hist_selectivity_adjacent(PeriodBound *lower, PeriodBound *upper, PeriodBound *hist_lower, PeriodBound *hist_upper, int hist_nvalues)
Definition: time_selfuncs.c:810
double calc_period_hist_selectivity_contains(PeriodBound *lower, PeriodBound *upper, PeriodBound *hist_lower, int hist_nvalues, Datum *length_hist_values, int length_hist_nvalues)
Definition: time_selfuncs.c:738
Functions for time types based on TimestampTz, that is, TimestampSet, Period, and PeriodSet...
CachedOp
Enumeration that defines the classes of Boolean operators used in MobilityDB.
Definition: tempcache.h:108
Datum timestampset_analyze(PG_FUNCTION_ARGS)
Compute statistics for timestamp set columns.
Definition: time_analyze.c:391
Datum periodset_analyze(PG_FUNCTION_ARGS)
Compute statistics for period set columns.
Definition: time_analyze.c:427
double get_len_position(double value, double hist1, double hist2)
Definition: time_selfuncs.c:417
Datum period_analyze(PG_FUNCTION_ARGS)
Compute statistics for period columns.
Definition: time_analyze.c:355
Selectivity functions for temporal types.
double calc_period_hist_selectivity_contained(PeriodBound *lower, PeriodBound *upper, PeriodBound *hist_lower, int hist_nvalues, Datum *length_hist_values, int length_hist_nvalues)
Definition: time_selfuncs.c:631
int length_hist_bsearch(Datum *length_hist_values, int length_hist_nvalues, double value, bool equal)
Definition: time_selfuncs.c:393