28 #define GETENTRY(vec,pos) ((ltree_gist *) DatumGetPointer((vec)->vector[(pos)].key))
29 #define NEXTVAL(x) ( (ltree*)( (char*)(x) + INTALIGN( VARSIZE(x) ) ) )
31 #define WISH_F(a,b,c) (double)( -(double)(((a)-(b))*((a)-(b))*((a)-(b)))*(c) )
66 (
errcode(ERRCODE_ARRAY_SUBSCRIPT_ERROR),
67 errmsg(
"array must be one-dimensional")));
70 (
errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED),
71 errmsg(
"array must not contain nulls")));
95 if ((
sign[
i] & 0xff) != 0xff)
165 for (
i = 0;
i < entryvec->
n;
i++)
195 diff = (
unsigned char) (
a[
i] ^
b[
i]);
271 maxoff = entryvec->
n - 2;
282 if (size_waste > waste)
296 if (seed_1 == 0 || seed_2 == 0)
316 costvector[
j - 1].
pos =
j;
318 size_alpha =
hemdist(datum_l, _j, siglen);
319 size_beta =
hemdist(datum_r, _j, siglen);
320 costvector[
j - 1].
cost = abs(size_alpha - size_beta);
327 for (k = 0; k < maxoff; k++)
329 j = costvector[k].
pos;
336 else if (
j == seed_2)
343 size_alpha =
hemdist(datum_l, _j, siglen);
344 size_beta =
hemdist(datum_r, _j, siglen);
351 memset(union_l, 0xff, siglen);
357 union_l[
i] |= ptr[
i];
367 memset(union_r, 0xff, siglen);
373 union_r[
i] |= ptr[
i];
455 bool isexist =
false;
488 (
errcode(ERRCODE_ARRAY_SUBSCRIPT_ERROR),
489 errmsg(
"array must be one-dimensional")));
492 (
errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED),
493 errmsg(
"array must not contain nulls")));
541 elog(
ERROR,
"unrecognized StrategyNumber: %d", strategy);
static bool gist_qe(ltree_gist *key, lquery *query, int siglen)
static bool _arrq_cons(ltree_gist *key, ArrayType *_query, int siglen)
static bool gist_te(ltree_gist *key, ltree *query, int siglen)
static void hashing(BITVECP sign, ltree *t, int siglen)
static int32 sizebitvec(BITVECP sign, int siglen)
static int hemdistsign(BITVECP a, BITVECP b, int siglen)
Datum _ltree_union(PG_FUNCTION_ARGS)
#define GETENTRY(vec, pos)
PG_FUNCTION_INFO_V1(_ltree_compress)
Datum _ltree_penalty(PG_FUNCTION_ARGS)
static bool gist_qtxt(ltree_gist *key, ltxtquery *query, int siglen)
static int hemdist(ltree_gist *a, ltree_gist *b, int siglen)
static int32 unionkey(BITVECP sbase, ltree_gist *add, int siglen)
struct LtreeSignature LtreeSignature
Datum _ltree_gist_options(PG_FUNCTION_ARGS)
static bool checkcondition_bit(void *cxt, ITEM *val)
Datum _ltree_compress(PG_FUNCTION_ARGS)
Datum _ltree_consistent(PG_FUNCTION_ARGS)
Datum _ltree_same(PG_FUNCTION_ARGS)
Datum _ltree_picksplit(PG_FUNCTION_ARGS)
static int comparecost(const void *a, const void *b)
#define DatumGetArrayTypeP(X)
bool array_contains_nulls(ArrayType *array)
int ArrayGetNItems(int ndim, const int *dims)
unsigned int ltree_crc32_sz(const char *buf, int size)
static void PGresult * res
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
#define PG_FREE_IF_COPY(ptr, n)
#define PG_GETARG_POINTER(n)
#define PG_GETARG_DATUM(n)
#define PG_GETARG_UINT16(n)
#define PG_DETOAST_DATUM(datum)
#define PG_RETURN_POINTER(x)
#define PG_RETURN_BOOL(x)
#define gistentryinit(e, k, r, pg, o, l)
#define FLG_CANLOOKSIGN(x)
#define AHASHVAL(val, siglen)
#define LTREE_GET_ASIGLEN()
#define ASIGLENBIT(siglen)
#define LTREE_ASIGLEN_MAX
#define ALOOPBYTE(siglen)
ltree_gist * ltree_gist_alloc(bool isalltrue, BITVECP sign, int siglen, ltree *left, ltree *right)
bool ltree_execute(ITEM *curitem, void *checkval, bool calcnot, bool(*chkcond)(void *checkval, ITEM *val))
#define LQL_CANLOOKSIGN(x)
#define AHASH(sign, val, siglen)
#define LTREE_ASIGLEN_DEFAULT
#define OffsetNumberNext(offsetNumber)
#define FirstOffsetNumber
PGDLLIMPORT const uint8 pg_number_of_ones[256]
static uint64 pg_popcount(const char *buf, int bytes)
#define qsort(a, b, c, d)
static Datum PointerGetDatum(const void *X)
static Pointer DatumGetPointer(Datum X)
static unsigned hash(unsigned *uv, int n)
void init_local_reloptions(local_relopts *relopts, Size relopt_struct_size)
void add_local_int_reloption(local_relopts *relopts, const char *name, const char *desc, int default_val, int min_val, int max_val, int offset)
static pg_noinline void Size size
char name[FLEXIBLE_ARRAY_MEMBER]
#define SET_VARSIZE(PTR, len)