MobilityDB 1.1
Macros | Functions
tpoint_analyze.c File Reference
#include "pg_point/tpoint_analyze.h"
#include <assert.h>
#include <float.h>
#include <math.h>
#include <postgres.h>
#include <access/htup_details.h>
#include <executor/spi.h>
#include <utils/lsyscache.h>
#include <meos.h>
#include <meos_internal.h>
#include "point/tpoint.h"
#include "point/tpoint_spatialfuncs.h"
#include "npoint/tnpoint_spatialfuncs.h"
#include "pg_general/meos_catalog.h"
#include "pg_general/span_analyze.h"
#include "pg_general/temporal_analyze.h"
Include dependency graph for tpoint_analyze.c:

Macros

#define MAX_DIMENSION_WIDTH   1.0E+20
 Maximum width of a dimension that we'll bother trying to compute statistics on. More...
 
#define MIN_DIMENSION_WIDTH   0.000000001
 Minimum width of a dimension that we'll bother trying to compute statistics on. More...
 
#define NUM_BINS   50
 How many bins shall we use in figuring out the distribution? More...
 
#define SDFACTOR   3.25
 The SD factor restricts the side of the statistics histogram based on the standard deviation of the extent of the data. More...
 
#define STATISTIC_KIND_2D   103
 
#define STATISTIC_KIND_ND   102
 Functions for gathering statistics from temporal point columns. More...
 
#define STATISTIC_SLOT_2D   1
 
#define STATISTIC_SLOT_ND   0
 

Functions

static int cmp_int (const void *a, const void *b)
 Integer comparison function for qsort. More...
 
static int gbox_ndims (const GBOX *gbox)
 Given that geodetic boxes are X/Y/Z regardless of the underlying geometry dimensionality and other boxes are guided by HAS_Z/HAS_M in their dimesionality, we have a little utility function to make it easy. More...
 
void gserialized_compute_stats (VacAttrStats *stats, AnalyzeAttrFetchFunc fetchfunc, int sample_rows, double total_rows, int mode)
 The gserialized_analyze_nd sets this function as a callback on the stats object when called by the ANALYZE command. More...
 
static int nd_box_array_distribution (const ND_BOX **nd_boxes, int num_boxes, const ND_BOX *extent, int ndims, double *distribution)
 Calculate how much a set of boxes is homogenously distributed or contentrated within one dimension, returning the range_quintile of of the overlap counts per cell in a uniform partition of the extent of the dimension. More...
 
static int nd_box_expand (ND_BOX *nd_box, double expansion_factor)
 Expand an ND_BOX ever so slightly. More...
 
static void nd_box_from_gbox (const GBOX *gbox, ND_BOX *nd_box)
 Set the values of an ND_BOX from a GBOX. More...
 
int nd_box_init (ND_BOX *a)
 Zero out an ND_BOX. More...
 
static int nd_box_init_bounds (ND_BOX *a)
 Prepare an ND_BOX for bounds calculation: set the maximum values to the smallest thing possible and the mininum values to the largest. More...
 
int nd_box_intersects (const ND_BOX *a, const ND_BOX *b, int ndims)
 Return true if ND_BOX a overlaps b, false otherwise. More...
 
static int nd_box_merge (const ND_BOX *source, ND_BOX *target)
 Expand the bounds of target to include source. More...
 
int nd_box_overlap (const ND_STATS *nd_stats, const ND_BOX *nd_box, ND_IBOX *nd_ibox)
 What stats cells overlap with this ND_BOX? Put the lowest cell addresses in ND_IBOX->min and the highest in ND_IBOX->max. More...
 
double nd_box_ratio_overlaps (const ND_BOX *b1, const ND_BOX *b2, int ndims)
 Return the proportion of b2 that is covered by b1. More...
 
int nd_increment (ND_IBOX *ibox, int ndims, int *counter)
 Given an n-d index array (counter), and a domain to increment it in (ibox) increment it by one, unless it's already at the max of the domain, in which case return false. More...
 
int nd_stats_value_index (const ND_STATS *stats, const int *indexes)
 Given a position in the n-d histogram (i,j,k) return the position in the 1-d values array. More...
 
static int range_quintile (int *vals, int nvals)
 The difference between the fourth and first quintile values, the "inter-quintile range". More...
 
PGDLLEXPORT Datum Spatialset_analyze (PG_FUNCTION_ARGS)
 Compute the statistics for spatial set columns. More...
 
void spatialset_compute_stats (VacAttrStats *stats, AnalyzeAttrFetchFunc fetchfunc, int sample_rows, double total_rows)
 Compute the statistics for spatial set columns (callback function) More...
 
static double total_double (const double *vals, int nvals)
 Return the sum of values of the double array. More...
 
PGDLLEXPORT Datum Tpoint_analyze (PG_FUNCTION_ARGS)
 Compute the statistics for temporal point columns. More...
 
void tpoint_compute_stats (VacAttrStats *stats, AnalyzeAttrFetchFunc fetchfunc, int sample_rows, double total_rows)
 Compute the statistics for temporal point columns (callback function) More...