Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4d94911

Browse files
committed
finish refactoring, now indexes uses new interface. Get rid of JsQueryValue
1 parent90a853d commit4d94911

File tree

3 files changed

+92
-137
lines changed

3 files changed

+92
-137
lines changed

‎jsonb_gin_ops.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ typedef struct
5959
staticuint32get_bloom_value(uint32hash);
6060
staticuint32get_path_bloom(PathHashStack*stack);
6161
staticGINKey*make_gin_key(JsonbValue*v,uint32hash);
62-
staticGINKey*make_gin_query_key(JsQueryValue*value,uint32hash);
62+
staticGINKey*make_gin_query_key(JsQueryItemR*value,uint32hash);
6363
staticGINKey*make_gin_query_key_minus_inf(uint32hash);
6464
staticint32compare_gin_key_value(GINKey*arg1,GINKey*arg2);
6565
staticintadd_entry(Entries*e,Datumkey,Pointerextra,boolpmatch);
@@ -281,11 +281,11 @@ make_gin_key(JsonbValue *v, uint32 hash)
281281
}
282282

283283
staticGINKey*
284-
make_gin_query_key(JsQueryValue*value,uint32hash)
284+
make_gin_query_key(JsQueryItemR*value,uint32hash)
285285
{
286286
GINKey*key;
287-
char*jqBase=value->jqBase;
288-
intlen,jqPos=value->jqPos;
287+
int32len;
288+
char*s;
289289
Numericnumeric;
290290

291291
switch(value->type)
@@ -296,21 +296,19 @@ make_gin_query_key(JsQueryValue *value, uint32 hash)
296296
SET_VARSIZE(key,GINKEYLEN);
297297
break;
298298
casejqiString:
299-
read_int32(len,jqBase,jqPos);
300299
key= (GINKey*)palloc(GINKeyLenString);
301300
key->type=jbvString;
302-
GINKeyDataString(key)=hash_any((unsignedchar*)jqBase+jqPos,
303-
len);
301+
s=jsqGetString(value,&len);
302+
GINKeyDataString(key)=hash_any((unsignedchar*)s,len);
304303
SET_VARSIZE(key,GINKeyLenString);
305304
break;
306305
casejqiBool:
307-
read_byte(len,jqBase,jqPos);
308306
key= (GINKey*)palloc(GINKEYLEN);
309-
key->type=jbvBool | (len ?GINKeyTrue :0);
307+
key->type=jbvBool | (jsqGetBool(value) ?GINKeyTrue :0);
310308
SET_VARSIZE(key,GINKEYLEN);
311309
break;
312310
casejqiNumeric:
313-
numeric=(Numeric)(jqBase+jqPos);
311+
numeric=jsqGetNumeric(value);
314312
key= (GINKey*)palloc(GINKeyLenNumeric(VARSIZE_ANY(numeric)));
315313
key->type=jbvNumeric;
316314
memcpy(GINKeyDataNumeric(key),numeric,VARSIZE_ANY(numeric));
@@ -319,6 +317,7 @@ make_gin_query_key(JsQueryValue *value, uint32 hash)
319317
default:
320318
elog(ERROR,"Wrong state");
321319
}
320+
322321
key->hash=hash;
323322
returnkey;
324323
}
@@ -852,10 +851,11 @@ make_hash_entry_handler(ExtractedNode *node, Pointer extra)
852851
{
853852
if (node->bounds.exact->type==jqiAny)
854853
{
855-
JsQueryValuevalue;
856-
value.jqBase=NULL;
857-
value.jqPos=0;
854+
JsQueryItemRvalue;
855+
858856
value.type=jqiNull;
857+
value.nextPos=0;
858+
value.base=NULL;
859859
key=make_gin_query_key(&value,hash);
860860
partialMatch= true;
861861
keyExtra->lossy= true;

‎jsquery.h

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,9 @@ typedef enum
154154
typedefstructPathItemPathItem;
155155
structPathItem
156156
{
157-
char*s;
158157
PathItemTypetype;
159158
intlen;
159+
char*s;
160160
PathItem*parent;
161161
};
162162

@@ -168,13 +168,6 @@ typedef enum
168168
eNot
169169
}ExtractedNodeType;
170170

171-
typedefstruct
172-
{
173-
char*jqBase;
174-
int32jqPos;
175-
int32type;
176-
}JsQueryValue;
177-
178171
typedefstructExtractedNodeExtractedNode;
179172
structExtractedNode
180173
{
@@ -193,9 +186,9 @@ struct ExtractedNode
193186
boolinequality;
194187
boolleftInclusive;
195188
boolrightInclusive;
196-
JsQueryValue*exact;
197-
JsQueryValue*leftBound;
198-
JsQueryValue*rightBound;
189+
JsQueryItemR*exact;
190+
JsQueryItemR*leftBound;
191+
JsQueryItemR*rightBound;
199192
}bounds;
200193
intentryNum;
201194
};

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp