PostgreSQL Source Code
git master
|
#include "postgres.h"
#include <math.h>
#include "access/gist.h"
#include "access/stratnum.h"
#include "cubedata.h"
#include "libpq/pqformat.h"
#include "utils/array.h"
#include "utils/float.h"
Go to the source code of this file.
Macros | |
#define | ARRPTR(x) ( (double *) ARR_DATA_PTR(x) ) |
#define | ARRNELEMS(x) ArrayGetNItems( ARR_NDIM(x), ARR_DIMS(x)) |
Variables | |
PG_MODULE_MAGIC | |
#define ARRPTR | ( | x | ) | ( (double *) ARR_DATA_PTR(x) ) |
Datum cube_a_f8 | ( | PG_FUNCTION_ARGS | ) |
Definition at line 206 of file cube.c.
References array_contains_nulls(), ARRNELEMS, ARRPTR, CUBE_MAX_DIM, ereport, errcode(), errdetail(), errmsg(), ERROR, i, palloc0(), PG_GETARG_ARRAYTYPE_P, PG_RETURN_NDBOX_P, POINT_SIZE, SET_DIM, SET_POINT_BIT, SET_VARSIZE, size, and NDBOX::x.
Datum cube_a_f8_f8 | ( | PG_FUNCTION_ARGS | ) |
Definition at line 139 of file cube.c.
References array_contains_nulls(), ARRNELEMS, ARRPTR, CUBE_MAX_DIM, CUBE_SIZE, ereport, errcode(), errdetail(), errmsg(), ERROR, i, if(), palloc0(), PG_GETARG_ARRAYTYPE_P, PG_RETURN_NDBOX_P, POINT_SIZE, SET_DIM, SET_POINT_BIT, SET_VARSIZE, size, and NDBOX::x.
Datum cube_c_f8 | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1818 of file cube.c.
References CUBE_MAX_DIM, CUBE_SIZE, DIM, ereport, errcode(), errdetail(), errmsg(), ERROR, i, IS_POINT, palloc0(), PG_FREE_IF_COPY, PG_GETARG_FLOAT8, PG_GETARG_NDBOX_P, PG_RETURN_NDBOX_P, POINT_SIZE, SET_DIM, SET_POINT_BIT, SET_VARSIZE, size, NDBOX::x, and x.
Datum cube_c_f8_f8 | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1865 of file cube.c.
References CUBE_MAX_DIM, CUBE_SIZE, DIM, ereport, errcode(), errdetail(), errmsg(), ERROR, i, IS_POINT, LL_COORD, palloc0(), PG_FREE_IF_COPY, PG_GETARG_FLOAT8, PG_GETARG_NDBOX_P, PG_RETURN_NDBOX_P, POINT_SIZE, SET_DIM, SET_POINT_BIT, SET_VARSIZE, size, UR_COORD, and NDBOX::x.
Datum cube_cmp | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1017 of file cube.c.
References a, b, cube_cmp_v0(), PG_FREE_IF_COPY, PG_GETARG_NDBOX_P, PG_RETURN_INT32, and res.
Datum cube_contained | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1178 of file cube.c.
References a, b, cube_contains_v0(), PG_FREE_IF_COPY, PG_GETARG_NDBOX_P, PG_RETURN_BOOL, and res.
Datum cube_contains | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1162 of file cube.c.
References a, b, cube_contains_v0(), PG_FREE_IF_COPY, PG_GETARG_NDBOX_P, PG_RETURN_BOOL, and res.
Definition at line 1124 of file cube.c.
References a, b, DIM, i, LL_COORD, Max, Min, and UR_COORD.
Referenced by cube_contained(), cube_contains(), g_cube_internal_consistent(), and g_cube_leaf_consistent().
Datum cube_coord | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1603 of file cube.c.
References DIM, ereport, errcode(), errmsg(), ERROR, IS_POINT, PG_GETARG_INT32, PG_GETARG_NDBOX_P, PG_RETURN_FLOAT8, and NDBOX::x.
Datum cube_coord_llur | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1644 of file cube.c.
References DIM, ereport, errcode(), errmsg(), ERROR, IS_POINT, Max, Min, PG_GETARG_INT32, PG_GETARG_NDBOX_P, PG_RETURN_FLOAT8, upper(), and NDBOX::x.
Datum cube_dim | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1554 of file cube.c.
References DIM, PG_FREE_IF_COPY, PG_GETARG_NDBOX_P, and PG_RETURN_INT32.
Datum cube_distance | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1253 of file cube.c.
References a, b, DIM, distance_1D(), i, LL_COORD, PG_FREE_IF_COPY, PG_GETARG_NDBOX_P, PG_RETURN_FLOAT8, and UR_COORD.
Referenced by g_cube_distance().
Datum cube_enlarge | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1703 of file cube.c.
References a, cube_is_point_internal(), CUBE_MAX_DIM, CUBE_SIZE, DIM, i, j, LL_COORD, palloc0(), PG_FREE_IF_COPY, PG_GETARG_FLOAT8, PG_GETARG_INT32, PG_GETARG_NDBOX_P, PG_RETURN_NDBOX_P, POINT_SIZE, SET_DIM, SET_POINT_BIT, SET_VARSIZE, size, UR_COORD, and NDBOX::x.
Datum cube_eq | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1032 of file cube.c.
References a, b, cube_cmp_v0(), PG_FREE_IF_COPY, PG_GETARG_NDBOX_P, PG_RETURN_BOOL, and res.
Datum cube_f8 | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1768 of file cube.c.
References palloc0(), PG_GETARG_FLOAT8, PG_RETURN_NDBOX_P, POINT_SIZE, SET_DIM, SET_POINT_BIT, SET_VARSIZE, size, NDBOX::x, and x.
Datum cube_f8_f8 | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1786 of file cube.c.
References CUBE_SIZE, palloc0(), PG_GETARG_FLOAT8, PG_RETURN_NDBOX_P, POINT_SIZE, SET_DIM, SET_POINT_BIT, SET_VARSIZE, size, and NDBOX::x.
Datum cube_ge | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1107 of file cube.c.
References a, b, cube_cmp_v0(), PG_FREE_IF_COPY, PG_GETARG_NDBOX_P, PG_RETURN_BOOL, and res.
Datum cube_gt | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1077 of file cube.c.
References a, b, cube_cmp_v0(), PG_FREE_IF_COPY, PG_GETARG_NDBOX_P, PG_RETURN_BOOL, and res.
Datum cube_in | ( | PG_FUNCTION_ARGS | ) |
Definition at line 118 of file cube.c.
References cube_scanner_finish(), cube_scanner_init(), cube_yyparse(), PG_GETARG_CSTRING, PG_RETURN_NDBOX_P, and str.
Datum cube_inter | ( | PG_FUNCTION_ARGS | ) |
Definition at line 823 of file cube.c.
References a, b, cube_is_point_internal(), CUBE_SIZE, DIM, i, LL_COORD, Max, Min, palloc0(), PG_FREE_IF_COPY, PG_GETARG_NDBOX_P, PG_RETURN_NDBOX_P, POINT_SIZE, repalloc(), SET_DIM, SET_POINT_BIT, SET_VARSIZE, size, UR_COORD, and NDBOX::x.
Referenced by g_cube_picksplit().
Datum cube_is_point | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1519 of file cube.c.
References cube_is_point_internal(), PG_FREE_IF_COPY, PG_GETARG_NDBOX_P, and PG_RETURN_BOOL.
Definition at line 1530 of file cube.c.
References DIM, i, IS_POINT, LL_COORD, and UR_COORD.
Referenced by cube_enlarge(), cube_inter(), cube_is_point(), cube_out(), and cube_union_v0().
Datum cube_le | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1092 of file cube.c.
References a, b, cube_cmp_v0(), PG_FREE_IF_COPY, PG_GETARG_NDBOX_P, PG_RETURN_BOOL, and res.
Datum cube_ll_coord | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1565 of file cube.c.
References DIM, LL_COORD, Min, PG_FREE_IF_COPY, PG_GETARG_INT32, PG_GETARG_NDBOX_P, PG_RETURN_FLOAT8, and UR_COORD.
Datum cube_lt | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1062 of file cube.c.
References a, b, cube_cmp_v0(), PG_FREE_IF_COPY, PG_GETARG_NDBOX_P, PG_RETURN_BOOL, and res.
Datum cube_ne | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1047 of file cube.c.
References a, b, cube_cmp_v0(), PG_FREE_IF_COPY, PG_GETARG_NDBOX_P, PG_RETURN_BOOL, and res.
Datum cube_out | ( | PG_FUNCTION_ARGS | ) |
Definition at line 292 of file cube.c.
References appendStringInfoChar(), appendStringInfoString(), buf, cube_is_point_internal(), DIM, float8out_internal(), i, initStringInfo(), LL_COORD, PG_FREE_IF_COPY, PG_GETARG_NDBOX_P, PG_RETURN_CSTRING, and UR_COORD.
Datum cube_overlap | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1233 of file cube.c.
References a, b, cube_overlap_v0(), PG_FREE_IF_COPY, PG_GETARG_NDBOX_P, PG_RETURN_BOOL, and res.
Definition at line 1194 of file cube.c.
References a, b, DIM, i, LL_COORD, Max, Min, and UR_COORD.
Referenced by cube_overlap(), g_cube_internal_consistent(), and g_cube_leaf_consistent().
Datum cube_recv | ( | PG_FUNCTION_ARGS | ) |
Definition at line 352 of file cube.c.
References buf, CUBE_MAX_DIM, DIM_MASK, ereport, errcode(), errdetail(), errmsg(), ERROR, NDBOX::header, i, nitems, palloc(), PG_GETARG_POINTER, PG_RETURN_NDBOX_P, POINT_BIT, pq_getmsgfloat8(), pq_getmsgint(), SET_VARSIZE, NDBOX::x, and x.
Datum cube_send | ( | PG_FUNCTION_ARGS | ) |
Definition at line 330 of file cube.c.
References buf, DIM, NDBOX::header, i, IS_POINT, nitems, PG_GETARG_NDBOX_P, PG_RETURN_BYTEA_P, pq_begintypsend(), pq_endtypsend(), pq_sendfloat8(), pq_sendint32(), and NDBOX::x.
Datum cube_size | ( | PG_FUNCTION_ARGS | ) |
Definition at line 899 of file cube.c.
References a, PG_FREE_IF_COPY, PG_GETARG_NDBOX_P, PG_RETURN_FLOAT8, and rt_cube_size().
Datum cube_subset | ( | PG_FUNCTION_ARGS | ) |
Definition at line 243 of file cube.c.
References ARR_DATA_PTR, array_contains_nulls(), ARRNELEMS, CUBE_MAX_DIM, CUBE_SIZE, DIM, ereport, errcode(), errdetail(), errmsg(), ERROR, i, idx(), IS_POINT, palloc0(), PG_FREE_IF_COPY, PG_GETARG_ARRAYTYPE_P, PG_GETARG_NDBOX_P, PG_RETURN_NDBOX_P, POINT_SIZE, SET_DIM, SET_POINT_BIT, SET_VARSIZE, size, and NDBOX::x.
Datum cube_union | ( | PG_FUNCTION_ARGS | ) |
Definition at line 808 of file cube.c.
References a, b, cube_union_v0(), PG_FREE_IF_COPY, PG_GETARG_NDBOX_P, PG_RETURN_NDBOX_P, and res.
Definition at line 748 of file cube.c.
References a, b, cube_is_point_internal(), CUBE_SIZE, DIM, i, LL_COORD, Max, Min, palloc0(), POINT_SIZE, SET_DIM, SET_POINT_BIT, SET_VARSIZE, size, UR_COORD, and NDBOX::x.
Referenced by cube_union(), g_cube_binary_union(), g_cube_penalty(), and g_cube_picksplit().
Datum cube_ur_coord | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1582 of file cube.c.
References DIM, LL_COORD, Max, PG_FREE_IF_COPY, PG_GETARG_INT32, PG_GETARG_NDBOX_P, PG_RETURN_FLOAT8, and UR_COORD.
|
static |
Definition at line 1503 of file cube.c.
References a1, a2, Max, and Min.
Referenced by cube_distance(), distance_chebyshev(), and distance_taxicab().
Datum distance_chebyshev | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1346 of file cube.c.
References a, b, DIM, distance_1D(), i, LL_COORD, PG_FREE_IF_COPY, PG_GETARG_NDBOX_P, PG_RETURN_FLOAT8, and UR_COORD.
Referenced by g_cube_distance().
Datum distance_taxicab | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1302 of file cube.c.
References a, b, DIM, distance_1D(), i, LL_COORD, PG_FREE_IF_COPY, PG_GETARG_NDBOX_P, PG_RETURN_FLOAT8, and UR_COORD.
Referenced by g_cube_distance().
Definition at line 735 of file cube.c.
References cube_union_v0(), and VARSIZE.
Referenced by g_cube_union().
Datum g_cube_compress | ( | PG_FUNCTION_ARGS | ) |
Datum g_cube_consistent | ( | PG_FUNCTION_ARGS | ) |
Definition at line 391 of file cube.c.
References DatumGetNDBOXP, g_cube_internal_consistent(), g_cube_leaf_consistent(), GIST_LEAF, GISTENTRY::key, PG_FREE_IF_COPY, PG_GETARG_NDBOX_P, PG_GETARG_POINTER, PG_GETARG_UINT16, PG_RETURN_BOOL, and res.
Datum g_cube_decompress | ( | PG_FUNCTION_ARGS | ) |
Definition at line 463 of file cube.c.
References DatumGetNDBOXP, gistentryinit, GISTENTRY::key, sort-test::key, GISTENTRY::offset, GISTENTRY::page, palloc(), PG_GETARG_POINTER, PG_RETURN_POINTER, PointerGetDatum(), and GISTENTRY::rel.
Datum g_cube_distance | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1398 of file cube.c.
References cube_distance(), CubeKNNDistanceChebyshev, CubeKNNDistanceCoord, CubeKNNDistanceEuclid, CubeKNNDistanceTaxicab, DatumGetFloat8(), DatumGetNDBOXP, DIM, DirectFunctionCall2, distance_chebyshev(), distance_taxicab(), elog, ereport, errcode(), errmsg(), ERROR, GistPageIsLeaf, IS_POINT, GISTENTRY::key, Max, Min, GISTENTRY::page, PG_GETARG_INT32, PG_GETARG_NDBOX_P, PG_GETARG_POINTER, PG_GETARG_UINT16, PG_RETURN_FLOAT8, PointerGetDatum(), upper(), and NDBOX::x.
bool g_cube_internal_consistent | ( | NDBOX * | key, |
NDBOX * | query, | ||
StrategyNumber | strategy | ||
) |
Definition at line 708 of file cube.c.
References cube_contains_v0(), cube_overlap_v0(), sort-test::key, RTContainedByStrategyNumber, RTContainsStrategyNumber, RTOldContainedByStrategyNumber, RTOldContainsStrategyNumber, RTOverlapStrategyNumber, and RTSameStrategyNumber.
Referenced by g_cube_consistent().
bool g_cube_leaf_consistent | ( | NDBOX * | key, |
NDBOX * | query, | ||
StrategyNumber | strategy | ||
) |
Definition at line 679 of file cube.c.
References cube_cmp_v0(), cube_contains_v0(), cube_overlap_v0(), sort-test::key, RTContainedByStrategyNumber, RTContainsStrategyNumber, RTOldContainedByStrategyNumber, RTOldContainsStrategyNumber, RTOverlapStrategyNumber, and RTSameStrategyNumber.
Referenced by g_cube_consistent().
Datum g_cube_penalty | ( | PG_FUNCTION_ARGS | ) |
Definition at line 486 of file cube.c.
References cube_union_v0(), DatumGetNDBOXP, GISTENTRY::key, PG_GETARG_POINTER, PG_RETURN_FLOAT8, and rt_cube_size().
Datum g_cube_picksplit | ( | PG_FUNCTION_ARGS | ) |
Definition at line 511 of file cube.c.
References cube_inter(), cube_union_v0(), DatumGetNDBOXP, DirectFunctionCall2, FirstOffsetNumber, i, j, GISTENTRY::key, GistEntryVector::n, OffsetNumberNext, palloc(), PG_GETARG_POINTER, PG_RETURN_POINTER, PointerGetDatum(), rt_cube_size(), GIST_SPLITVEC::spl_ldatum, GIST_SPLITVEC::spl_left, GIST_SPLITVEC::spl_nleft, GIST_SPLITVEC::spl_nright, GIST_SPLITVEC::spl_rdatum, GIST_SPLITVEC::spl_right, and GistEntryVector::vector.
Datum g_cube_same | ( | PG_FUNCTION_ARGS | ) |
Definition at line 661 of file cube.c.
References cube_cmp_v0(), PG_GETARG_NDBOX_P, PG_GETARG_POINTER, and PG_RETURN_NDBOX_P.
Datum g_cube_union | ( | PG_FUNCTION_ARGS | ) |
Definition at line 425 of file cube.c.
References DatumGetNDBOXP, g_cube_binary_union(), i, GISTENTRY::key, GistEntryVector::n, PG_GETARG_POINTER, PG_RETURN_POINTER, VARSIZE, and GistEntryVector::vector.
PG_FUNCTION_INFO_V1 | ( | cube_a_f8 | ) |
PG_FUNCTION_INFO_V1 | ( | cube_a_f8_f8 | ) |
PG_FUNCTION_INFO_V1 | ( | cube_c_f8 | ) |
PG_FUNCTION_INFO_V1 | ( | cube_c_f8_f8 | ) |
PG_FUNCTION_INFO_V1 | ( | cube_cmp | ) |
PG_FUNCTION_INFO_V1 | ( | cube_contained | ) |
PG_FUNCTION_INFO_V1 | ( | cube_contains | ) |
PG_FUNCTION_INFO_V1 | ( | cube_coord | ) |
PG_FUNCTION_INFO_V1 | ( | cube_coord_llur | ) |
PG_FUNCTION_INFO_V1 | ( | cube_dim | ) |
PG_FUNCTION_INFO_V1 | ( | cube_distance | ) |
PG_FUNCTION_INFO_V1 | ( | cube_enlarge | ) |
PG_FUNCTION_INFO_V1 | ( | cube_eq | ) |
PG_FUNCTION_INFO_V1 | ( | cube_f8 | ) |
PG_FUNCTION_INFO_V1 | ( | cube_f8_f8 | ) |
PG_FUNCTION_INFO_V1 | ( | cube_ge | ) |
PG_FUNCTION_INFO_V1 | ( | cube_gt | ) |
PG_FUNCTION_INFO_V1 | ( | cube_in | ) |
PG_FUNCTION_INFO_V1 | ( | cube_inter | ) |
PG_FUNCTION_INFO_V1 | ( | cube_is_point | ) |
PG_FUNCTION_INFO_V1 | ( | cube_le | ) |
PG_FUNCTION_INFO_V1 | ( | cube_ll_coord | ) |
PG_FUNCTION_INFO_V1 | ( | cube_lt | ) |
PG_FUNCTION_INFO_V1 | ( | cube_ne | ) |
PG_FUNCTION_INFO_V1 | ( | cube_out | ) |
PG_FUNCTION_INFO_V1 | ( | cube_overlap | ) |
PG_FUNCTION_INFO_V1 | ( | cube_recv | ) |
PG_FUNCTION_INFO_V1 | ( | cube_send | ) |
PG_FUNCTION_INFO_V1 | ( | cube_size | ) |
PG_FUNCTION_INFO_V1 | ( | cube_subset | ) |
PG_FUNCTION_INFO_V1 | ( | cube_union | ) |
PG_FUNCTION_INFO_V1 | ( | cube_ur_coord | ) |
PG_FUNCTION_INFO_V1 | ( | distance_chebyshev | ) |
PG_FUNCTION_INFO_V1 | ( | distance_taxicab | ) |
PG_FUNCTION_INFO_V1 | ( | g_cube_compress | ) |
PG_FUNCTION_INFO_V1 | ( | g_cube_consistent | ) |
PG_FUNCTION_INFO_V1 | ( | g_cube_decompress | ) |
PG_FUNCTION_INFO_V1 | ( | g_cube_distance | ) |
PG_FUNCTION_INFO_V1 | ( | g_cube_penalty | ) |
PG_FUNCTION_INFO_V1 | ( | g_cube_picksplit | ) |
PG_FUNCTION_INFO_V1 | ( | g_cube_same | ) |
PG_FUNCTION_INFO_V1 | ( | g_cube_union | ) |
void rt_cube_size | ( | NDBOX * | a, |
double * | size | ||
) |
Definition at line 910 of file cube.c.
References a, DIM, i, IS_POINT, LL_COORD, size, and UR_COORD.
Referenced by cube_size(), g_cube_penalty(), and g_cube_picksplit().