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

Commitdcf2e1c

Browse files
committed
Remove the << >> &< and &> operators for contrib/cube, which were
wrong, but nobody noticed because they were also useless.
1 parent54c80a3 commitdcf2e1c

File tree

7 files changed

+13
-978
lines changed

7 files changed

+13
-978
lines changed

‎contrib/cube/README.cube

Lines changed: 9 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ numbers with more than about 16 significant digits will be truncated.
181181
USAGE
182182
=====
183183

184-
The access method for CUBE is a GiST (gist_cube_ops), which is a
184+
The access method for CUBE is a GiSTindex(gist_cube_ops), which is a
185185
generalization of R-tree. GiSTs allow the postgres implementation of
186186
R-tree, originally encoded to support 2-D geometric types such as
187187
boxes and polygons, to be used with any data type whose data domain
@@ -193,42 +193,21 @@ things, all geometric data types, regardless of their dimensionality
193193

194194
The operators supported by the GiST access method include:
195195

196+
a = bSame as
196197

197-
[a, b] << [c, d]Is left of
198+
The cubements a and b are identical.
198199

199-
The left operand, [a, b], occurs entirely to the left of the
200-
right operand, [c, d], on the axis (-inf, inf). It means,
201-
[a, b] << [c, d] is true if b < c and false otherwise
200+
a && bOverlaps
202201

203-
[a, b] >> [c, d]Is right of
202+
The cubements a and b overlap.
204203

205-
[a, b] is occurs entirely to the right of [c, d].
206-
[a, b] >> [c, d] is true if b > c and false otherwise
204+
a @ bContains
207205

208-
[a, b] &< [c, d]Over left
206+
The cubement a contains the cubement b.
209207

210-
The cubement [a, b] overlaps the cubement [c, d] in such a way
211-
that a <= c <= b and b <= d
208+
a ~ bContained in
212209

213-
[a, b] &> [c, d]Over right
214-
215-
The cubement [a, b] overlaps the cubement [c, d] in such a way
216-
that a > c and b <= c <= d
217-
218-
[a, b] = [c, d]Same as
219-
220-
The cubements [a, b] and [c, d] are identical, that is, a == b
221-
and c == d
222-
223-
[a, b] @ [c, d]Contains
224-
225-
The cubement [a, b] contains the cubement [c, d], that is,
226-
a <= c and b >= d
227-
228-
[a, b] @ [c, d]Contained in
229-
230-
The cubement [a, b] is contained in [c, d], that is,
231-
a >= c and b <= d
210+
The cubement a is contained in b.
232211

233212
Although the mnemonics of the following operators is questionable, I
234213
preserved them to maintain visual consistency with other geometric

‎contrib/cube/cube.c

Lines changed: 0 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,6 @@ NDBOX *cube_inter(NDBOX * a, NDBOX * b);
7272
double*cube_size(NDBOX*a);
7373
voidrt_cube_size(NDBOX*a,double*sz);
7474

75-
/*
76-
** These make no sense for this type, but R-tree wants them
77-
*/
78-
boolcube_over_left(NDBOX*a,NDBOX*b);
79-
boolcube_over_right(NDBOX*a,NDBOX*b);
80-
boolcube_left(NDBOX*a,NDBOX*b);
81-
boolcube_right(NDBOX*a,NDBOX*b);
82-
8375
/*
8476
** miscellaneous
8577
*/
@@ -460,21 +452,9 @@ g_cube_leaf_consistent(NDBOX * key,
460452
*/
461453
switch (strategy)
462454
{
463-
caseRTLeftStrategyNumber:
464-
retval= (bool)cube_left(key,query);
465-
break;
466-
caseRTOverLeftStrategyNumber:
467-
retval= (bool)cube_over_left(key,query);
468-
break;
469455
caseRTOverlapStrategyNumber:
470456
retval= (bool)cube_overlap(key,query);
471457
break;
472-
caseRTOverRightStrategyNumber:
473-
retval= (bool)cube_over_right(key,query);
474-
break;
475-
caseRTRightStrategyNumber:
476-
retval= (bool)cube_right(key,query);
477-
break;
478458
caseRTSameStrategyNumber:
479459
retval= (bool)cube_eq(key,query);
480460
break;
@@ -502,17 +482,9 @@ g_cube_internal_consistent(NDBOX * key,
502482
*/
503483
switch (strategy)
504484
{
505-
caseRTLeftStrategyNumber:
506-
caseRTOverLeftStrategyNumber:
507-
retval= (bool)cube_over_left(key,query);
508-
break;
509485
caseRTOverlapStrategyNumber:
510486
retval= (bool)cube_overlap(key,query);
511487
break;
512-
caseRTOverRightStrategyNumber:
513-
caseRTRightStrategyNumber:
514-
retval= (bool)cube_right(key,query);
515-
break;
516488
caseRTSameStrategyNumber:
517489
caseRTContainsStrategyNumber:
518490
retval= (bool)cube_contains(key,query);
@@ -692,62 +664,6 @@ rt_cube_size(NDBOX * a, double *size)
692664
return;
693665
}
694666

695-
/* The following four methods compare the projections of the boxes
696-
onto the 0-th coordinate axis. These methods are useless for dimensions
697-
larger than 2, but it seems that R-tree requires all its strategies
698-
map to real functions that return something */
699-
700-
/*is the right edge of (a) located to the left of
701-
the right edge of (b)? */
702-
bool
703-
cube_over_left(NDBOX*a,NDBOX*b)
704-
{
705-
if ((a==NULL)|| (b==NULL))
706-
return (FALSE);
707-
708-
return (Min(a->x[a->dim-1],a->x[2*a->dim-1]) <=
709-
Min(b->x[b->dim-1],b->x[2*b->dim-1])&&
710-
!cube_left(a,b)&& !cube_right(a,b));
711-
}
712-
713-
/*is the left edge of (a) located to the right of
714-
the left edge of (b)? */
715-
bool
716-
cube_over_right(NDBOX*a,NDBOX*b)
717-
{
718-
if ((a==NULL)|| (b==NULL))
719-
return (FALSE);
720-
721-
return (Min(a->x[a->dim-1],a->x[2*a->dim-1]) >=
722-
Min(b->x[b->dim-1],b->x[2*b->dim-1])&&
723-
!cube_left(a,b)&& !cube_right(a,b));
724-
}
725-
726-
727-
/* return 'true' if the projection of 'a' is
728-
entirely on the left of the projection of 'b' */
729-
bool
730-
cube_left(NDBOX*a,NDBOX*b)
731-
{
732-
if ((a==NULL)|| (b==NULL))
733-
return (FALSE);
734-
735-
return (Min(a->x[a->dim-1],a->x[2*a->dim-1])<
736-
Min(b->x[0],b->x[b->dim]));
737-
}
738-
739-
/* return 'true' if the projection of 'a' is
740-
entirely on the right of the projection of 'b' */
741-
bool
742-
cube_right(NDBOX*a,NDBOX*b)
743-
{
744-
if ((a==NULL)|| (b==NULL))
745-
return (FALSE);
746-
747-
return (Min(a->x[0],a->x[a->dim])>
748-
Min(b->x[b->dim-1],b->x[2*b->dim-1]));
749-
}
750-
751667
/* make up a metric in which one box will be 'lower' than the other
752668
-- this can be useful for sorting and to determine uniqueness */
753669
int32

‎contrib/cube/cube.sql.in

Lines changed: 4 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,13 @@ LANGUAGE 'C' IMMUTABLE STRICT;
1212
CREATE OR REPLACE FUNCTION cube_out(cube)
1313
RETURNS cstring
1414
AS 'MODULE_PATHNAME'
15-
LANGUAGE 'c'IMMUTABLE STRICT;
15+
LANGUAGE 'C'IMMUTABLE STRICT;
1616

1717
CREATE TYPE cube (
1818
INTERNALLENGTH = variable,
1919
INPUT = cube_in,
20-
OUTPUT = cube_out
20+
OUTPUT = cube_out,
21+
ALIGNMENT = double
2122
);
2223

2324
COMMENT ON TYPE cube IS 'multi-dimensional cube ''(FLOAT-1, FLOAT-2, ..., FLOAT-N), (FLOAT-1, FLOAT-2, ..., FLOAT-N)''';
@@ -36,38 +37,6 @@ CREATE CAST (text AS cube) WITH FUNCTION cube(text) AS ASSIGNMENT;
3637
-- External C-functions for R-tree methods
3738
--
3839

39-
-- Left/Right methods
40-
41-
CREATE OR REPLACE FUNCTION cube_over_left(cube, cube)
42-
RETURNS bool
43-
AS 'MODULE_PATHNAME'
44-
LANGUAGE 'C' IMMUTABLE STRICT;
45-
46-
COMMENT ON FUNCTION cube_over_left(cube, cube) IS 'is over and left of (NOT IMPLEMENTED)';
47-
48-
CREATE OR REPLACE FUNCTION cube_over_right(cube, cube)
49-
RETURNS bool
50-
AS 'MODULE_PATHNAME'
51-
LANGUAGE 'C' IMMUTABLE STRICT;
52-
53-
COMMENT ON FUNCTION cube_over_right(cube, cube) IS 'is over and right of (NOT IMPLEMENTED)';
54-
55-
CREATE OR REPLACE FUNCTION cube_left(cube, cube)
56-
RETURNS bool
57-
AS 'MODULE_PATHNAME'
58-
LANGUAGE 'C' IMMUTABLE STRICT;
59-
60-
COMMENT ON FUNCTION cube_left(cube, cube) IS
61-
'is left of (NOT IMPLEMENTED)';
62-
63-
CREATE OR REPLACE FUNCTION cube_right(cube, cube)
64-
RETURNS bool
65-
AS 'MODULE_PATHNAME'
66-
LANGUAGE 'C' IMMUTABLE STRICT;
67-
68-
COMMENT ON FUNCTION cube_right(cube, cube) IS 'is right of (NOT IMPLEMENTED)';
69-
70-
7140
-- Comparison methods
7241

7342
CREATE OR REPLACE FUNCTION cube_eq(cube, cube)
@@ -242,34 +211,10 @@ CREATE OPERATOR >= (
242211
RESTRICT = scalargtsel, JOIN = scalargtjoinsel
243212
);
244213

245-
CREATE OPERATOR << (
246-
LEFTARG = cube, RIGHTARG = cube, PROCEDURE = cube_left,
247-
COMMUTATOR = '>>',
248-
RESTRICT = positionsel, JOIN = positionjoinsel
249-
);
250-
251-
CREATE OPERATOR &< (
252-
LEFTARG = cube, RIGHTARG = cube, PROCEDURE = cube_over_left,
253-
COMMUTATOR = '&>',
254-
RESTRICT = positionsel, JOIN = positionjoinsel
255-
);
256-
257214
CREATE OPERATOR && (
258215
LEFTARG = cube, RIGHTARG = cube, PROCEDURE = cube_overlap,
259216
COMMUTATOR = '&&',
260-
RESTRICT = positionsel, JOIN = positionjoinsel
261-
);
262-
263-
CREATE OPERATOR &> (
264-
LEFTARG = cube, RIGHTARG = cube, PROCEDURE = cube_over_right,
265-
COMMUTATOR = '&<',
266-
RESTRICT = positionsel, JOIN = positionjoinsel
267-
);
268-
269-
CREATE OPERATOR >> (
270-
LEFTARG = cube, RIGHTARG = cube, PROCEDURE = cube_right,
271-
COMMUTATOR = '<<',
272-
RESTRICT = positionsel, JOIN = positionjoinsel
217+
RESTRICT = areasel, JOIN = areajoinsel
273218
);
274219

275220
CREATE OPERATOR = (
@@ -348,11 +293,7 @@ CREATE OPERATOR CLASS cube_ops
348293

349294
CREATE OPERATOR CLASS gist_cube_ops
350295
DEFAULT FOR TYPE cube USING gist AS
351-
OPERATOR1<< ,
352-
OPERATOR2&< ,
353296
OPERATOR3&& ,
354-
OPERATOR4&> ,
355-
OPERATOR5>> ,
356297
OPERATOR6= ,
357298
OPERATOR7@ ,
358299
OPERATOR8~ ,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp