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

Commitd0e1e86

Browse files
committed
add to RumConfig knowledge about scan direction depending on strategy
1 parentd0dd137 commitd0e1e86

File tree

7 files changed

+48
-4
lines changed

7 files changed

+48
-4
lines changed

‎expected/rum.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ SELECT count(*) FROM test_rum WHERE a @@ to_tsquery('pg_catalog.english',
8787
'def <2> fgr');
8888
count
8989
-------
90-
2
90+
1
9191
(1 row)
9292

9393
SELECT rum_ts_distance(a, to_tsquery('pg_catalog.english', 'way')), *

‎rum--1.0.sql

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,11 @@ RETURNS int4
119119
AS'MODULE_PATHNAME'
120120
LANGUAGE C STRICT IMMUTABLE;
121121

122+
CREATEFUNCTIONrum_timestamp_config(internal)
123+
RETURNS void
124+
AS'MODULE_PATHNAME'
125+
LANGUAGE C IMMUTABLE STRICT;
126+
122127
CREATEFUNCTIONrum_timestamp_extract_query(timestamp,internal,smallint,internal,internal,internal,internal)
123128
RETURNS internal
124129
AS'MODULE_PATHNAME'
@@ -148,6 +153,7 @@ AS
148153
FUNCTION3 rum_timestamp_extract_query(timestamp,internal,smallint,internal,internal,internal,internal),
149154
FUNCTION4 rum_timestamp_consistent(internal,smallint,timestamp,int,internal,internal,internal,internal),
150155
FUNCTION5 rum_timestamp_compare_prefix(timestamp,timestamp,smallint,internal),
156+
FUNCTION6 rum_timestamp_config(internal),
151157
-- support to timestamp disttance in rum_tsvector_timestamp_ops
152158
FUNCTION9 rum_timestamp_outer_distance(timestamp,timestamp,smallint),
153159
OPERATOR20<=> (timestamp,timestamp) FORORDER BYpg_catalog.float_ops,

‎rum.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -985,6 +985,4 @@ extern Datum FunctionCall10Coll(FmgrInfo *flinfo, Oid collation,
985985
Datumarg6,Datumarg7,Datumarg8,
986986
Datumarg9,Datumarg10);
987987

988-
#defineFROM_STRATEGY(21)
989-
990988
#endif/* __RUM_H__ */

‎rum_timestamp.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include<limits.h>
44

55
#include"access/stratnum.h"
6+
#include"rum.h"
67
#include"utils/builtins.h"
78
#include"utils/timestamp.h"
89

@@ -270,3 +271,20 @@ rum_timestamp_outer_distance(PG_FUNCTION_ARGS)
270271

271272
PG_RETURN_DATUM(diff);
272273
}
274+
275+
PG_FUNCTION_INFO_V1(rum_timestamp_config);
276+
Datum
277+
rum_timestamp_config(PG_FUNCTION_ARGS)
278+
{
279+
RumConfig*config= (RumConfig*)PG_GETARG_POINTER(0);
280+
281+
config->addInfoTypeOid=InvalidOid;
282+
283+
config->strategyInfo[0].strategy=RUM_TMST_LEFT_DISTANCE;
284+
config->strategyInfo[0].direction=ForwardScanDirection;
285+
286+
config->strategyInfo[1].strategy=InvalidStrategy;
287+
288+
PG_RETURN_VOID();
289+
}
290+

‎rum_ts_utils.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1202,5 +1202,7 @@ rum_tsvector_config(PG_FUNCTION_ARGS)
12021202
RumConfig*config= (RumConfig*)PG_GETARG_POINTER(0);
12031203

12041204
config->addInfoTypeOid=BYTEAOID;
1205+
config->strategyInfo[0].strategy=InvalidStrategy;
1206+
12051207
PG_RETURN_VOID();
12061208
}

‎rumscan.c

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,23 @@ initScanKey(RumScanOpaque so, ScanKey skey, bool *hasNullQuery)
391391
(skey->sk_flags&SK_ORDER_BY) ? true : false);
392392
}
393393

394+
staticScanDirection
395+
lookupScanDirection(RumState*state,AttrNumberattno,StrategyNumberstrategy)
396+
{
397+
inti;
398+
RumConfig*rumConfig=state->rumConfig+attno-1;
399+
400+
for(i=0;rumConfig->strategyInfo[i].strategy!=InvalidStrategy&&
401+
i<MAX_STRATEGIES;i++)
402+
{
403+
if (rumConfig->strategyInfo[i].strategy==strategy)
404+
returnrumConfig->strategyInfo[i].direction;
405+
406+
}
407+
408+
returnNoMovementScanDirection;
409+
}
410+
394411
staticvoid
395412
fillMarkAddInfo(RumScanOpaqueso,RumScanKeyorderKey)
396413
{
@@ -405,7 +422,8 @@ fillMarkAddInfo(RumScanOpaque so, RumScanKey orderKey)
405422

406423
if (scanKey->attnum==so->rumstate.attrnAddToColumn&&
407424
orderKey->attnum==so->rumstate.attrnAddToColumn&&
408-
orderKey->strategy==FROM_STRATEGY/* FIXME teodor */)
425+
lookupScanDirection(&so->rumstate,orderKey->attnumOrig,
426+
orderKey->strategy)==ForwardScanDirection)
409427
{
410428
intj;
411429

‎rumtsquery.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -629,5 +629,7 @@ ruminv_tsquery_config(PG_FUNCTION_ARGS)
629629
RumConfig*config= (RumConfig*)PG_GETARG_POINTER(0);
630630

631631
config->addInfoTypeOid=BYTEAOID;
632+
config->strategyInfo[0].strategy=InvalidStrategy;
633+
632634
PG_RETURN_VOID();
633635
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp