43 #include "utils/fmgrprotos.h"
169 quadrant =
getQuadrant(typcache, centroid, inRange);
171 Assert(quadrant <= in->nNodes);
227 &lowerBounds[
j], &upperBounds[
j], &empty);
238 if (nonEmptyCount == 0)
268 &upperBounds[nonEmptyCount / 2],
false, NULL);
313 bool needPrevious =
false;
338 which = (1 << 1) | (1 << 2);
401 elog(
ERROR,
"unrecognized range strategy: %d", strategy);
430 which = (1 << 1) | (1 << 2) | (1 << 3) | (1 << 4) | (1 << 5);
452 bool inclusive =
true;
453 bool strictEmpty =
true;
468 lower.inclusive =
true;
469 lower.infinite =
false;
473 upper.inclusive =
true;
474 upper.infinite =
false;
562 &prevLower, &prevUpper, &prevEmpty);
576 prevCentroid ? &prevUpper : NULL);
578 which1 = (1 << 1) | (1 << 4);
580 which1 = (1 << 2) | (1 << 3);
592 prevCentroid ? &prevLower : NULL);
594 which2 = (1 << 1) | (1 << 2);
596 which2 = (1 << 3) | (1 << 4);
601 which &= which1 | which2;
619 which &= (1 << 1) | (1 << 2) | (1 << 3) | (1 << 4);
651 elog(
ERROR,
"unrecognized range strategy: %d", strategy);
666 which &= (1 << 1) | (1 << 2) | (1 << 3) | (1 << 4);
683 which &= (1 << 1) | (1 << 2) | (1 << 5);
698 if (
cmp > 0 || (!inclusive &&
cmp == 0))
699 which &= (1 << 3) | (1 << 4) | (1 << 5);
710 which &= (1 << 1) | (1 << 4) | (1 << 5);
725 if (
cmp > 0 || (!inclusive &&
cmp == 0))
726 which &= (1 << 2) | (1 << 3) | (1 << 5);
748 if (which & (1 <<
i))
753 Datum previousCentroid;
905 if ((prevcmp < 0 && cmp >= 0) || (prevcmp > 0 &&
cmp < 0))
984 elog(
ERROR,
"unrecognized range strategy: %d",
#define Assert(condition)
Datum datumCopy(Datum value, bool typByVal, int typLen)
static void PGresult * res
#define PG_GETARG_POINTER(n)
#define PG_RETURN_BOOL(x)
Datum lower(PG_FUNCTION_ARGS)
Datum upper(PG_FUNCTION_ARGS)
void qsort_arg(void *base, size_t nel, size_t elsize, qsort_arg_comparator cmp, void *arg)
static Datum PointerGetDatum(const void *X)
MemoryContextSwitchTo(old_ctx)
int range_cmp_bounds(TypeCacheEntry *typcache, const RangeBound *b1, const RangeBound *b2)
bool range_contained_by_internal(TypeCacheEntry *typcache, const RangeType *r1, const RangeType *r2)
bool range_contains_internal(TypeCacheEntry *typcache, const RangeType *r1, const RangeType *r2)
bool range_after_internal(TypeCacheEntry *typcache, const RangeType *r1, const RangeType *r2)
bool bounds_adjacent(TypeCacheEntry *typcache, RangeBound boundA, RangeBound boundB)
bool range_overlaps_internal(TypeCacheEntry *typcache, const RangeType *r1, const RangeType *r2)
bool range_before_internal(TypeCacheEntry *typcache, const RangeType *r1, const RangeType *r2)
bool range_overright_internal(TypeCacheEntry *typcache, const RangeType *r1, const RangeType *r2)
bool range_contains_elem_internal(TypeCacheEntry *typcache, const RangeType *r, Datum val)
void range_deserialize(TypeCacheEntry *typcache, const RangeType *range, RangeBound *lower, RangeBound *upper, bool *empty)
TypeCacheEntry * range_get_typcache(FunctionCallInfo fcinfo, Oid rngtypid)
bool range_eq_internal(TypeCacheEntry *typcache, const RangeType *r1, const RangeType *r2)
bool range_adjacent_internal(TypeCacheEntry *typcache, const RangeType *r1, const RangeType *r2)
bool range_overleft_internal(TypeCacheEntry *typcache, const RangeType *r1, const RangeType *r2)
RangeType * range_serialize(TypeCacheEntry *typcache, RangeBound *lower, RangeBound *upper, bool empty, struct Node *escontext)
#define RANGESTRAT_OVERLAPS
#define RANGESTRAT_BEFORE
#define RANGESTRAT_OVERRIGHT
#define RANGESTRAT_OVERLEFT
#define RANGESTRAT_CONTAINED_BY
static Datum RangeTypePGetDatum(const RangeType *X)
#define RANGESTRAT_ADJACENT
static RangeType * DatumGetRangeTypeP(Datum X)
#define RANGESTRAT_CONTAINS_ELEM
#define RANGESTRAT_CONTAINS
#define RangeTypeGetOid(r)
static int adjacent_inner_consistent(TypeCacheEntry *typcache, const RangeBound *arg, const RangeBound *centroid, const RangeBound *prev)
Datum spg_range_quad_config(PG_FUNCTION_ARGS)
Datum spg_range_quad_leaf_consistent(PG_FUNCTION_ARGS)
Datum spg_range_quad_picksplit(PG_FUNCTION_ARGS)
static int adjacent_cmp_bounds(TypeCacheEntry *typcache, const RangeBound *arg, const RangeBound *centroid)
Datum spg_range_quad_inner_consistent(PG_FUNCTION_ARGS)
Datum spg_range_quad_choose(PG_FUNCTION_ARGS)
static int bound_cmp(const void *a, const void *b, void *arg)
static int16 getQuadrant(TypeCacheEntry *typcache, const RangeType *centroid, const RangeType *tst)
static struct cvec * range(struct vars *v, chr a, chr b, int cases)
static int cmp(const chr *x, const chr *y, size_t len)
StrategyNumber sk_strategy
spgChooseResultType resultType
union spgChooseOut::@50 result
struct spgChooseOut::@50::@51 matchNode
MemoryContext traversalMemoryContext