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

Commit4efbbd7

Browse files
committed
We just released new version of contrib/btree_gist
(7.3 and current CVS) with support of int8, float4, float8in addition to int4. Thanks Janko Richter for contribution.Oleg Bartunov
1 parent4996eea commit4efbbd7

File tree

10 files changed

+975
-602
lines changed

10 files changed

+975
-602
lines changed

‎contrib/btree_gist/Makefile

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,26 @@
1-
# $Header: /cvsroot/pgsql/contrib/btree_gist/Makefile,v 1.3 2001/09/06 10:49:29 petere Exp $
21

32
subdir = contrib/btree_gist
43
top_builddir = ../..
54
include$(top_builddir)/src/Makefile.global
65

7-
MODULES = btree_gist
6+
MODULE_big = btree_gist
7+
OBJS= btree_common.o btree_int4.o btree_int8.o btree_float4.o btree_float8.o btree_ts.o
88
DATA_built = btree_gist.sql
99
DOCS = README.btree_gist
1010
REGRESS = btree_gist
1111

12+
EXTRA_CLEAN = btree_int4.c btree_int8.c btree_float4.c btree_float8.c
13+
1214
include$(top_srcdir)/contrib/contrib-global.mk
15+
16+
btree_int4.c: btree_num.c.in
17+
sed's,__DEFINE_BTREE_TYPE_HERE__,BTREE_GIST_INT4,g;s,__BTREE_GIST_TYPE__,int32,g;s,__BTREE_GIST_TYPE2__,int4,g'<$<>$@
18+
19+
btree_int8.c: btree_num.c.in
20+
sed's,__DEFINE_BTREE_TYPE_HERE__,BTREE_GIST_INT8,g;s,__BTREE_GIST_TYPE__,int64,g;s,__BTREE_GIST_TYPE2__,int8,g'<$<>$@
21+
22+
btree_float4.c: btree_num.c.in
23+
sed's,__DEFINE_BTREE_TYPE_HERE__,BTREE_GIST_FLOAT4,g;s,__BTREE_GIST_TYPE__,float4,g;s,__BTREE_GIST_TYPE2__,float4,g'<$<>$@
24+
25+
btree_float8.c: btree_num.c.in
26+
sed's,__DEFINE_BTREE_TYPE_HERE__,BTREE_GIST_FLOAT8,g;s,__BTREE_GIST_TYPE__,float8,g;s,__BTREE_GIST_TYPE2__,float8,g'<$<>$@

‎contrib/btree_gist/README.btree_gist

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
1-
This is B-Tree implementation using GiST for int4 and
1+
This is B-Tree implementation using GiST for int4, int8, float4, float8
22
timestamp types.
33

44
All work was done by Teodor Sigaev (teodor@stack.net) and Oleg Bartunov
55
(oleg@sai.msu.su). See http://www.sai.msu.su/~megera/postgres/gist
66
for additional information.
77

8+
NEWS:
9+
Feb 5, 2003 - btree_gist now support int8, float4, float8 !
10+
Thank Janko Richter <jankorichter@yahoo.de> for
11+
contribution.
12+
813
NOTICE:
9-
This version will works only with postgresql version 7.2 and above
14+
This version will works only with postgresql version 7.3 and above
1015
because of changes in interface of function calling and in system
1116
tables.
1217

‎contrib/btree_gist/btree_common.c

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
#include"btree_gist.h"
2+
3+
PG_FUNCTION_INFO_V1(btree_decompress);
4+
Datumbtree_decompress(PG_FUNCTION_ARGS);
5+
6+
/*
7+
** GiST DeCompress methods
8+
** do not do anything.
9+
*/
10+
Datum
11+
btree_decompress(PG_FUNCTION_ARGS)
12+
{
13+
PG_RETURN_POINTER(PG_GETARG_POINTER(0));
14+
}
15+
16+
17+
/**************************************************
18+
* Common btree-function (for all ops)
19+
**************************************************/
20+
21+
/*
22+
** The GiST PickSplit method
23+
*/
24+
externGIST_SPLITVEC*
25+
btree_picksplit(bytea*entryvec,GIST_SPLITVEC*v,BINARY_UNIONbu,CMPFUNCcmp)
26+
{
27+
OffsetNumberi;
28+
RIX*array;
29+
OffsetNumbermaxoff;
30+
intnbytes;
31+
32+
maxoff= ((VARSIZE(entryvec)-VARHDRSZ) /sizeof(GISTENTRY))-1;
33+
nbytes= (maxoff+2)*sizeof(OffsetNumber);
34+
v->spl_left= (OffsetNumber*)palloc(nbytes);
35+
v->spl_right= (OffsetNumber*)palloc(nbytes);
36+
v->spl_nleft=0;
37+
v->spl_nright=0;
38+
v->spl_ldatum=PointerGetDatum(0);
39+
v->spl_rdatum=PointerGetDatum(0);
40+
array= (RIX*)palloc(sizeof(RIX)* (maxoff+1));
41+
42+
/* copy the data into RIXes, and sort the RIXes */
43+
for (i=FirstOffsetNumber;i <=maxoff;i=OffsetNumberNext(i))
44+
{
45+
array[i].index=i;
46+
array[i].r= (char*)DatumGetPointer((((GISTENTRY*) (VARDATA(entryvec)))[i].key));
47+
}
48+
qsort((void*)&array[FirstOffsetNumber],maxoff-FirstOffsetNumber+1,
49+
sizeof(RIX),cmp);
50+
51+
for (i=FirstOffsetNumber;i <=maxoff;i=OffsetNumberNext(i))
52+
{
53+
if (i <= (maxoff-FirstOffsetNumber+1) /2)
54+
{
55+
v->spl_left[v->spl_nleft]=array[i].index;
56+
v->spl_nleft++;
57+
(*bu) (&v->spl_ldatum,array[i].r);
58+
}
59+
else
60+
{
61+
v->spl_right[v->spl_nright]=array[i].index;
62+
v->spl_nright++;
63+
(*bu) (&v->spl_rdatum,array[i].r);
64+
}
65+
}
66+
pfree(array);
67+
68+
return (v);
69+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp