#include "postgres.h"
#include <float.h>
#include <math.h>
#include "access/gist.h"
#include "access/skey.h"
#include "utils/builtins.h"
#include "lib/stringinfo.h"
#include "utils/array.h"
#include "tsdata.h"
Go to the source code of this file.
Defines | |
#define | V1P 0.001 |
#define | V10P 0.01 |
#define | V25P 0.025 |
#define | V50P 0.05 |
Functions | |
PG_FUNCTION_INFO_V1 (sax_union) | |
PG_FUNCTION_INFO_V1 (sax_distance) | |
SAX * | i_sax_union (SAX *r1, SAX *r2) |
Datum | sax_union (PG_FUNCTION_ARGS) |
Datum | sax_distance (PG_FUNCTION_ARGS) |
PG_FUNCTION_INFO_V1 (sax_nar_1p) | |
Function which returns true iff distance between two SAX strings less than 1% of maximal distance. | |
Datum | sax_nar_1p (PG_FUNCTION_ARGS) |
Check that distance between two SAX string is within 1 promille of theoretical maximum from each other. | |
PG_FUNCTION_INFO_V1 (sax_nar_10p) | |
Function which returns true iff distance between two SAX strings less than 10% of maximal distance. | |
Datum | sax_nar_10p (PG_FUNCTION_ARGS) |
Check that distance between two SAX string is within 10 promille of theoretical maximum from each other. | |
PG_FUNCTION_INFO_V1 (sax_nar_25p) | |
Function which returns true iff distance between two SAX strings less than 25% of maximal distance. | |
Datum | sax_nar_25p (PG_FUNCTION_ARGS) |
Check that distance between two SAX string is within 25 promille of theoretical maximum from each other. | |
PG_FUNCTION_INFO_V1 (sax_nar_50p) | |
Function which returns true iff distance between two SAX strings less than 50% of maximal distance. | |
Datum | sax_nar_50p (PG_FUNCTION_ARGS) |
Check that distance between two SAX string is within 50 promille of theoretical maximum from each other. | |
PG_FUNCTION_INFO_V1 (sax_1p_away) | |
Function which returns true iff distance between two SAX strings greater than 1% of maximal distance. | |
Datum | sax_1p_away (PG_FUNCTION_ARGS) |
Check that distance between two SAX string is not within 1 promille of theoretical maximum from each other. | |
PG_FUNCTION_INFO_V1 (sax_10p_away) | |
Function which returns true iff distance between two SAX strings greater than 10% of maximal distance. | |
Datum | sax_10p_away (PG_FUNCTION_ARGS) |
Check that distance between two SAX string is not within 10 promille of theoretical maximum from each other. | |
PG_FUNCTION_INFO_V1 (sax_25p_away) | |
Function which returns true iff distance between two SAX strings greater than 25% of maximal distance. | |
Datum | sax_25p_away (PG_FUNCTION_ARGS) |
Check that distance between two SAX string is not within 25 promille of theoretical maximum from each other. | |
PG_FUNCTION_INFO_V1 (sax_50p_away) | |
Function which returns true iff distance between two SAX strings greater than 50% of maximal distance. | |
Datum | sax_50p_away (PG_FUNCTION_ARGS) |
Check that distance between two SAX string is not within 50 promille of theoretical maximum from each other. | |
PG_FUNCTION_INFO_V1 (gsax_compress) | |
Datum | gsax_compress (PG_FUNCTION_ARGS) |
PG_FUNCTION_INFO_V1 (gsax_decompress) | |
Datum | gsax_decompress (PG_FUNCTION_ARGS) |
PG_FUNCTION_INFO_V1 (gsax_same) | |
Datum | gsax_same (PG_FUNCTION_ARGS) |
PG_FUNCTION_INFO_V1 (gsax_union) | |
Datum | gsax_union (PG_FUNCTION_ARGS) |
PG_FUNCTION_INFO_V1 (gsax_penalty) | |
Datum | gsax_penalty (PG_FUNCTION_ARGS) |
PG_FUNCTION_INFO_V1 (gsax_picksplit) | |
Datum | gsax_picksplit (PG_FUNCTION_ARGS) |
PG_FUNCTION_INFO_V1 (gsax_proximity) | |
Datum | gsax_proximity (PG_FUNCTION_ARGS) |
bool | sax_closer_then (SAX *a, SAX *b, float threshold) |
Check that two SAX strings closer then threshold. | |
bool | gsax_leaf_consistent (SAX *key, SAX *query, StrategyNumber strategy) |
bool | gsax_internal_consistent (SAX *key, SAX *query, StrategyNumber strategy) |
float | i_sax_distance (SAX *r1, SAX *r2) |
unsigned char | unify_cardinality_up (SAX_ELEMENT *a, SAX_ELEMENT *b, unsigned char *al, unsigned char *au, unsigned char *bl, unsigned char *bu) |
calculate new boundaries for both SAX_ELEMENTS in assumption that alphabet promote to upper cardinality | |
unsigned char | unify_cardinality_down (SAX_ELEMENT *a, SAX_ELEMENT *b, unsigned char *al, unsigned char *au, unsigned char *bl, unsigned char *bu) |
bool | sax_uoverlap (SAX *a, SAX *b) |
overlap from top: a &> b means a[i].l >= b[i].l & a[i].l <= b[i].u for all i=1. | |
bool | sax_loverlap (SAX *a, SAX *b) |
overlap from bottom: a &< b means a[i].u<= b[i].u & a[i].u >= b[i].l for all i=1. | |
bool | sax_contained (SAX *a, SAX *b) |
contained (a <@ b) : a[i].u < b[i].u & a[i].l>b[i].l for all i=1. | |
bool | sax_contains (SAX *a, SAX *b) |
contains (a > b) : a[i].u > b[i].u & a[i].l < b[i].l for all i=1. | |
bool | sax_intersect (SAX *a, SAX *b) |
intersect ( a >< b) a is neither greater nor less than b; | |
bool | sax_greater (SAX *a, SAX *b) |
greater (a>b) - lower bound of a is always higher than upper bound of b (a[i].l >= b[i].u for all i=1. | |
bool | sax_less (SAX *a, SAX *b) |
less (a<b) - is equivalent of b>a (a[i].u <= b[i].l for all i=1. | |
bool | sax_same (SAX *a, SAX *b) |
bool | sax_different (SAX *a, SAX *b) |
float | i_sax_elem_distance (SAX_ELEMENT *e1, SAX_ELEMENT *e2) |
float | i_sax_penalty (SAX *r1, SAX *r2) |
int32 | sax_cmp (SAX *a, SAX *b) |
SAX_ELEMENT * | sax_element_intersect (SAX_ELEMENT *a, SAX_ELEMENT *b, SAX_ELEMENT *u) |
float | sax_element_size (SAX_ELEMENT *a) |
void | sax_element_union (SAX_ELEMENT *a, SAX_ELEMENT *b, SAX_ELEMENT *u) |
bool | gsax_consistent (GISTENTRY *entry, SAX *query, StrategyNumber strategy) |
The GiST Consistent method for SAX Should return false if for all data items x below entry, the predicate x op query == FALSE, where op is the oper corresponding to strategy in the pg_amop table. | |
void | printSAX_ELM (SAX_ELEMENT elem) |
SAX * | singular_sax (SAX *sax) |
Calculates single value representation of SAX signal. | |
void | printSAX (SAX *sax) |
create string | |
SAX * | i_gsax_union_old (GistEntryVector *entryvec, int offset) |
SAX * | singular_sax_union (SAX *out) |
SAX * | i_gsax_union (GistEntryVector *entryvec, int offset) |
GIST_SPLITVEC * | gsax_picksplit_old (GistEntryVector *entryvec, GIST_SPLITVEC *v) |
#define V10P 0.01 |
Definition at line 41 of file saxoperators.c.
#define V1P 0.001 |
Definition at line 40 of file saxoperators.c.
#define V25P 0.025 |
Definition at line 42 of file saxoperators.c.
#define V50P 0.05 |
Definition at line 43 of file saxoperators.c.
Datum gsax_compress | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1029 of file saxoperators.c.
bool gsax_consistent | ( | GISTENTRY * | entry, | |
SAX * | query, | |||
StrategyNumber | strategy | |||
) |
The GiST Consistent method for SAX Should return false if for all data items x below entry, the predicate x op query == FALSE, where op is the oper corresponding to strategy in the pg_amop table.
Definition at line 716 of file saxoperators.c.
Datum gsax_decompress | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1036 of file saxoperators.c.
Definition at line 1597 of file saxoperators.c.
Definition at line 1517 of file saxoperators.c.
Datum gsax_penalty | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1059 of file saxoperators.c.
Datum gsax_picksplit | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1333 of file saxoperators.c.
GIST_SPLITVEC* gsax_picksplit_old | ( | GistEntryVector * | entryvec, | |
GIST_SPLITVEC * | v | |||
) |
Definition at line 1107 of file saxoperators.c.
Datum gsax_proximity | ( | PG_FUNCTION_ARGS | ) |
Definition at line 625 of file saxoperators.c.
Datum gsax_same | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1043 of file saxoperators.c.
Datum gsax_union | ( | PG_FUNCTION_ARGS | ) |
Definition at line 950 of file saxoperators.c.
SAX* i_gsax_union | ( | GistEntryVector * | entryvec, | |
int | offset | |||
) |
Definition at line 897 of file saxoperators.c.
SAX* i_gsax_union_old | ( | GistEntryVector * | entryvec, | |
int | offset | |||
) |
Definition at line 787 of file saxoperators.c.
Definition at line 349 of file saxoperators.c.
float i_sax_elem_distance | ( | SAX_ELEMENT * | e1, | |
SAX_ELEMENT * | e2 | |||
) |
(sax_isNull((r1->data[i])) || sax_isNull((r2->data[i])))) {
Definition at line 332 of file saxoperators.c.
(sax_isNull((r1->data[i])) || sax_isNull((r2->data[i])))) {
Definition at line 369 of file saxoperators.c.
Definition at line 589 of file saxoperators.c.
PG_FUNCTION_INFO_V1 | ( | gsax_proximity | ) |
PG_FUNCTION_INFO_V1 | ( | gsax_picksplit | ) |
PG_FUNCTION_INFO_V1 | ( | gsax_penalty | ) |
PG_FUNCTION_INFO_V1 | ( | gsax_union | ) |
PG_FUNCTION_INFO_V1 | ( | gsax_same | ) |
PG_FUNCTION_INFO_V1 | ( | gsax_decompress | ) |
PG_FUNCTION_INFO_V1 | ( | gsax_compress | ) |
PG_FUNCTION_INFO_V1 | ( | sax_50p_away | ) |
Function which returns true iff distance between two SAX strings greater than 50% of maximal distance.
PG_FUNCTION_INFO_V1 | ( | sax_25p_away | ) |
Function which returns true iff distance between two SAX strings greater than 25% of maximal distance.
PG_FUNCTION_INFO_V1 | ( | sax_10p_away | ) |
Function which returns true iff distance between two SAX strings greater than 10% of maximal distance.
PG_FUNCTION_INFO_V1 | ( | sax_1p_away | ) |
Function which returns true iff distance between two SAX strings greater than 1% of maximal distance.
PG_FUNCTION_INFO_V1 | ( | sax_nar_50p | ) |
Function which returns true iff distance between two SAX strings less than 50% of maximal distance.
PG_FUNCTION_INFO_V1 | ( | sax_nar_25p | ) |
Function which returns true iff distance between two SAX strings less than 25% of maximal distance.
PG_FUNCTION_INFO_V1 | ( | sax_nar_10p | ) |
Function which returns true iff distance between two SAX strings less than 10% of maximal distance.
PG_FUNCTION_INFO_V1 | ( | sax_nar_1p | ) |
Function which returns true iff distance between two SAX strings less than 1% of maximal distance.
PG_FUNCTION_INFO_V1 | ( | sax_distance | ) |
PG_FUNCTION_INFO_V1 | ( | sax_union | ) |
void printSAX | ( | SAX * | sax | ) |
void printSAX_ELM | ( | SAX_ELEMENT | elem | ) |
Definition at line 733 of file saxoperators.c.
Datum sax_10p_away | ( | PG_FUNCTION_ARGS | ) |
Check that distance between two SAX string is not within 10 promille of theoretical maximum from each other.
Definition at line 479 of file saxoperators.c.
Datum sax_1p_away | ( | PG_FUNCTION_ARGS | ) |
Check that distance between two SAX string is not within 1 promille of theoretical maximum from each other.
Definition at line 466 of file saxoperators.c.
Datum sax_25p_away | ( | PG_FUNCTION_ARGS | ) |
Check that distance between two SAX string is not within 25 promille of theoretical maximum from each other.
Definition at line 492 of file saxoperators.c.
Datum sax_50p_away | ( | PG_FUNCTION_ARGS | ) |
Check that distance between two SAX string is not within 50 promille of theoretical maximum from each other.
Definition at line 505 of file saxoperators.c.
Definition at line 515 of file saxoperators.c.
contained (a <@ b) : a[i].u < b[i].u & a[i].l>b[i].l for all i=1.
.N; this is equivalent of ((a &> b) & (b &< a))
Definition at line 253 of file saxoperators.c.
contains (a > b) : a[i].u > b[i].u & a[i].l < b[i].l for all i=1.
.N; is equivalent of b <@ a
Definition at line 257 of file saxoperators.c.
Definition at line 328 of file saxoperators.c.
Datum sax_distance | ( | PG_FUNCTION_ARGS | ) |
Definition at line 397 of file saxoperators.c.
SAX_ELEMENT* sax_element_intersect | ( | SAX_ELEMENT * | a, | |
SAX_ELEMENT * | b, | |||
SAX_ELEMENT * | u | |||
) |
Definition at line 524 of file saxoperators.c.
float sax_element_size | ( | SAX_ELEMENT * | a | ) |
Definition at line 546 of file saxoperators.c.
void sax_element_union | ( | SAX_ELEMENT * | a, | |
SAX_ELEMENT * | b, | |||
SAX_ELEMENT * | u | |||
) |
Definition at line 563 of file saxoperators.c.
greater (a>b) - lower bound of a is always higher than upper bound of b (a[i].l >= b[i].u for all i=1.
.N );
Definition at line 265 of file saxoperators.c.
intersect ( a >< b) a is neither greater nor less than b;
Definition at line 261 of file saxoperators.c.
less (a<b) - is equivalent of b>a (a[i].u <= b[i].l for all i=1.
.N);
Definition at line 281 of file saxoperators.c.
overlap from bottom: a &< b means a[i].u<= b[i].u & a[i].u >= b[i].l for all i=1.
.N
Definition at line 237 of file saxoperators.c.
Datum sax_nar_10p | ( | PG_FUNCTION_ARGS | ) |
Check that distance between two SAX string is within 10 promille of theoretical maximum from each other.
Definition at line 427 of file saxoperators.c.
Datum sax_nar_1p | ( | PG_FUNCTION_ARGS | ) |
Check that distance between two SAX string is within 1 promille of theoretical maximum from each other.
Definition at line 414 of file saxoperators.c.
Datum sax_nar_25p | ( | PG_FUNCTION_ARGS | ) |
Check that distance between two SAX string is within 25 promille of theoretical maximum from each other.
Definition at line 440 of file saxoperators.c.
Datum sax_nar_50p | ( | PG_FUNCTION_ARGS | ) |
Check that distance between two SAX string is within 50 promille of theoretical maximum from each other.
Definition at line 453 of file saxoperators.c.
Definition at line 310 of file saxoperators.c.
Datum sax_union | ( | PG_FUNCTION_ARGS | ) |
Definition at line 612 of file saxoperators.c.
overlap from top: a &> b means a[i].l >= b[i].l & a[i].l <= b[i].u for all i=1.
.N
Definition at line 212 of file saxoperators.c.
Calculates single value representation of SAX signal.
In the case SAX signal is represented as one-value-interval, function will return exactly the same data structure. Otherwise it will calculate new SAX with each letter representing middle point between upper and lower.
Definition at line 754 of file saxoperators.c.
Definition at line 853 of file saxoperators.c.
unsigned char unify_cardinality_down | ( | SAX_ELEMENT * | a, | |
SAX_ELEMENT * | b, | |||
unsigned char * | al, | |||
unsigned char * | au, | |||
unsigned char * | bl, | |||
unsigned char * | bu | |||
) |
Definition at line 174 of file saxoperators.c.
unsigned char unify_cardinality_up | ( | SAX_ELEMENT * | a, | |
SAX_ELEMENT * | b, | |||
unsigned char * | al, | |||
unsigned char * | au, | |||
unsigned char * | bl, | |||
unsigned char * | bu | |||
) |
calculate new boundaries for both SAX_ELEMENTS in assumption that alphabet promote to upper cardinality
Definition at line 136 of file saxoperators.c.