28#define ARRPTR(x) ( (double *) ARR_DATA_PTR(x) )
29#define ARRNELEMS(x) ArrayGetNItems( ARR_NDIM(x), ARR_DIMS(x))
130 cube_yyparse(&result, scanbuflen, fcinfo->context, scanner);
158 errmsg(
"cannot work with arrays containing NULLs")));
164 errmsg(
"can't extend cube"),
165 errdetail(
"A cube cannot have more than %d dimensions.",
171 errmsg(
"UR and LL arrays must be of same length")));
178 for (
i = 0;
i < dim;
i++)
192 for (
i = 0;
i < dim;
i++)
197 for (
i = 0;
i < dim;
i++)
198 result->
x[
i + dim] =
dll[
i];
222 errmsg(
"cannot work with arrays containing NULLs")));
228 errmsg(
"array is too long"),
229 errdetail(
"A cube cannot have more than %d dimensions.",
240 for (
i = 0;
i < dim;
i++)
260 errmsg(
"cannot work with arrays containing NULLs")));
268 errmsg(
"array is too long"),
269 errdetail(
"A cube cannot have more than %d dimensions.",
280 for (
i = 0;
i < dim;
i++)
285 errmsg(
"Index out of bounds")));
286 result->
x[
i] =
c->x[
dx[
i] - 1];
288 result->
x[
i + dim] =
c->x[
dx[
i] +
DIM(
c) - 1];
306 for (
i = 0;
i < dim;
i++)
317 for (
i = 0;
i < dim;
i++)
369 errmsg(
"cube dimension is too large"),
370 errdetail(
"A cube cannot have more than %d dimensions.",
376 cube->header = header;
790 result->
x[
i] =
Min(0,
793 result->
x[
i + dim] =
Max(0,
865 result->
x[
i] =
Max(0,
950 for (
i = 0;
i < dim;
i++)
959 for (
i = 0;
i < dim;
i++)
1002 for (
i = dim;
i <
DIM(
b);
i++)
1424 errmsg(
"zero cube index is not defined")));
1499 elog(
ERROR,
"unrecognized cube strategy number: %d", strategy);
1576 if (
DIM(
c) >= n && n > 0)
1593 if (
DIM(
c) >= n && n > 0)
1616 errmsg(
"cube index %d is out of bounds",
coord)));
1660 errmsg(
"zero cube index is not defined")));
1731 for (
i = 0,
j = dim;
i <
DIM(
a);
i++,
j++)
1743 if (result->
x[
i] > result->
x[
j])
1745 result->
x[
i] = (result->
x[
i] + result->
x[
j]) / 2;
1746 result->
x[
j] = result->
x[
i];
1750 for (;
i < dim;
i++,
j++)
1834 errmsg(
"can't extend cube"),
1835 errdetail(
"A cube cannot have more than %d dimensions.",
1847 result->
x[
DIM(result) - 1] =
x;
1860 result->
x[
DIM(result) - 1] =
x;
1861 result->
x[2 *
DIM(result) - 1] =
x;
1882 errmsg(
"can't extend cube"),
1883 errdetail(
"A cube cannot have more than %d dimensions.",
1895 result->
x[
DIM(result) - 1] =
x1;
1908 result->
x[
DIM(result) - 1] =
x1;
1909 result->
x[2 *
DIM(result) - 1] =
x2;
Datum idx(PG_FUNCTION_ARGS)
#define PG_GETARG_ARRAYTYPE_P(n)
bool array_contains_nulls(const ArrayType *array)
Datum cube_gt(PG_FUNCTION_ARGS)
Datum cube_eq(PG_FUNCTION_ARGS)
Datum cube_le(PG_FUNCTION_ARGS)
Datum cube_coord(PG_FUNCTION_ARGS)
Datum distance_taxicab(PG_FUNCTION_ARGS)
Datum cube_ll_coord(PG_FUNCTION_ARGS)
Datum cube_subset(PG_FUNCTION_ARGS)
Datum cube_distance(PG_FUNCTION_ARGS)
static bool cube_is_point_internal(NDBOX *cube)
bool cube_overlap_v0(NDBOX *a, NDBOX *b)
bool g_cube_leaf_consistent(NDBOX *key, NDBOX *query, StrategyNumber strategy)
bool cube_contains_v0(NDBOX *a, NDBOX *b)
Datum distance_chebyshev(PG_FUNCTION_ARGS)
Datum g_cube_picksplit(PG_FUNCTION_ARGS)
int32 cube_cmp_v0(NDBOX *a, NDBOX *b)
Datum cube_dim(PG_FUNCTION_ARGS)
Datum g_cube_union(PG_FUNCTION_ARGS)
Datum cube_in(PG_FUNCTION_ARGS)
Datum cube_enlarge(PG_FUNCTION_ARGS)
Datum cube_c_f8(PG_FUNCTION_ARGS)
Datum g_cube_same(PG_FUNCTION_ARGS)
Datum cube_ur_coord(PG_FUNCTION_ARGS)
Datum g_cube_distance(PG_FUNCTION_ARGS)
Datum cube_contained(PG_FUNCTION_ARGS)
Datum cube_cmp(PG_FUNCTION_ARGS)
Datum cube_a_f8_f8(PG_FUNCTION_ARGS)
Datum g_cube_consistent(PG_FUNCTION_ARGS)
NDBOX * cube_union_v0(NDBOX *a, NDBOX *b)
static double distance_1D(double a1, double a2, double b1, double b2)
Datum cube_size(PG_FUNCTION_ARGS)
Datum cube_recv(PG_FUNCTION_ARGS)
void rt_cube_size(NDBOX *a, double *size)
Datum cube_lt(PG_FUNCTION_ARGS)
Datum cube_contains(PG_FUNCTION_ARGS)
Datum cube_union(PG_FUNCTION_ARGS)
Datum cube_f8_f8(PG_FUNCTION_ARGS)
Datum g_cube_decompress(PG_FUNCTION_ARGS)
Datum cube_f8(PG_FUNCTION_ARGS)
Datum cube_a_f8(PG_FUNCTION_ARGS)
Datum cube_c_f8_f8(PG_FUNCTION_ARGS)
Datum cube_coord_llur(PG_FUNCTION_ARGS)
Datum cube_inter(PG_FUNCTION_ARGS)
Datum g_cube_compress(PG_FUNCTION_ARGS)
Datum cube_is_point(PG_FUNCTION_ARGS)
bool g_cube_internal_consistent(NDBOX *key, NDBOX *query, StrategyNumber strategy)
NDBOX * g_cube_binary_union(NDBOX *r1, NDBOX *r2, int *sizep)
Datum cube_send(PG_FUNCTION_ARGS)
Datum cube_overlap(PG_FUNCTION_ARGS)
Datum cube_ge(PG_FUNCTION_ARGS)
Datum cube_out(PG_FUNCTION_ARGS)
Datum g_cube_penalty(PG_FUNCTION_ARGS)
Datum cube_ne(PG_FUNCTION_ARGS)
int cube_yyparse(NDBOX **result, Size scanbuflen, struct Node *escontext, yyscan_t yyscanner)
#define SET_DIM(cube, _dim)
void cube_scanner_init(const char *str, Size *scanbuflen, yyscan_t *yyscannerp)
#define DatumGetNDBOXP(x)
#define LL_COORD(cube, i)
#define CubeKNNDistanceCoord
void cube_scanner_finish(yyscan_t yyscanner)
#define CubeKNNDistanceEuclid
#define PG_RETURN_NDBOX_P(x)
#define CubeKNNDistanceTaxicab
#define SET_POINT_BIT(cube)
#define CubeKNNDistanceChebyshev
#define PG_GETARG_NDBOX_P(x)
#define UR_COORD(cube, i)
int errdetail(const char *fmt,...)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
#define palloc_object(type)
char * float8out_internal(double num)
#define PG_FREE_IF_COPY(ptr, n)
#define PG_RETURN_BYTEA_P(x)
#define DirectFunctionCall2(func, arg1, arg2)
#define PG_GETARG_FLOAT8(n)
#define PG_RETURN_FLOAT8(x)
#define PG_GETARG_POINTER(n)
#define PG_MODULE_MAGIC_EXT(...)
#define PG_RETURN_CSTRING(x)
#define PG_GETARG_DATUM(n)
#define PG_GETARG_CSTRING(n)
#define PG_FUNCTION_INFO_V1(funcname)
#define PG_GETARG_UINT16(n)
#define PG_RETURN_INT32(x)
#define PG_GETARG_INT32(n)
#define PG_RETURN_DATUM(x)
#define PG_RETURN_POINTER(x)
#define PG_RETURN_BOOL(x)
#define GistPageIsLeaf(page)
#define gistentryinit(e, k, r, pg, o, l)
static const FormData_pg_attribute a1
static const FormData_pg_attribute a2
void * repalloc(void *pointer, Size size)
void * palloc0(Size size)
#define OffsetNumberNext(offsetNumber)
#define FirstOffsetNumber
Datum upper(PG_FUNCTION_ARGS)
static char buf[DEFAULT_XLOG_SEG_SIZE]
static Datum PointerGetDatum(const void *X)
static float8 DatumGetFloat8(Datum X)
#define RTOldContainsStrategyNumber
#define RTOverlapStrategyNumber
#define RTSameStrategyNumber
#define RTContainsStrategyNumber
#define RTOldContainedByStrategyNumber
#define RTContainedByStrategyNumber
struct StringInfoData * StringInfo
void appendStringInfoString(StringInfo str, const char *s)
void appendStringInfoChar(StringInfo str, char ch)
void initStringInfo(StringInfo str)
double x[FLEXIBLE_ARRAY_MEMBER]
static Size VARSIZE(const void *PTR)
static void SET_VARSIZE(void *PTR, Size len)