Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
ea9825d6
Commit
ea9825d6
authored
Jul 10, 2007
by
gkodinov/kgeorge@magare.gmz
Browse files
Options
Browse Files
Download
Plain Diff
Merge gkodinov@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into magare.gmz:/home/kgeorge/mysql/autopush/B29070-5.0-opt
parents
7cab171f
3e9679e1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
61 additions
and
42 deletions
+61
-42
myisam/sp_key.c
myisam/sp_key.c
+29
-42
mysql-test/r/gis-rtree.result
mysql-test/r/gis-rtree.result
+13
-0
mysql-test/t/gis-rtree.test
mysql-test/t/gis-rtree.test
+19
-0
No files found.
myisam/sp_key.c
View file @
ea9825d6
...
@@ -31,11 +31,6 @@ static int sp_get_geometry_mbr(uchar *(*wkb), uchar *end, uint n_dims,
...
@@ -31,11 +31,6 @@ static int sp_get_geometry_mbr(uchar *(*wkb), uchar *end, uint n_dims,
double
*
mbr
,
int
top
);
double
*
mbr
,
int
top
);
static
int
sp_mbr_from_wkb
(
uchar
(
*
wkb
),
uint
size
,
uint
n_dims
,
double
*
mbr
);
static
int
sp_mbr_from_wkb
(
uchar
(
*
wkb
),
uint
size
,
uint
n_dims
,
double
*
mbr
);
static
void
get_double
(
double
*
d
,
const
byte
*
pos
)
{
float8get
(
*
d
,
pos
);
}
uint
sp_make_key
(
register
MI_INFO
*
info
,
uint
keynr
,
uchar
*
key
,
uint
sp_make_key
(
register
MI_INFO
*
info
,
uint
keynr
,
uchar
*
key
,
const
byte
*
record
,
my_off_t
filepos
)
const
byte
*
record
,
my_off_t
filepos
)
{
{
...
@@ -62,48 +57,40 @@ uint sp_make_key(register MI_INFO *info, uint keynr, uchar *key,
...
@@ -62,48 +57,40 @@ uint sp_make_key(register MI_INFO *info, uint keynr, uchar *key,
for
(
i
=
0
,
keyseg
=
keyinfo
->
seg
;
keyseg
->
type
;
keyseg
++
,
i
++
)
for
(
i
=
0
,
keyseg
=
keyinfo
->
seg
;
keyseg
->
type
;
keyseg
++
,
i
++
)
{
{
uint
length
=
keyseg
->
length
;
uint
length
=
keyseg
->
length
,
start
=
keyseg
->
start
;
double
val
;
DBUG_ASSERT
(
length
==
sizeof
(
double
));
DBUG_ASSERT
(
!
(
start
%
sizeof
(
double
)));
DBUG_ASSERT
(
start
<
sizeof
(
mbr
));
DBUG_ASSERT
(
keyseg
->
type
==
HA_KEYTYPE_DOUBLE
);
pos
=
((
byte
*
)
mbr
)
+
keyseg
->
start
;
val
=
mbr
[
start
/
sizeof
(
double
)];
if
(
keyseg
->
flag
&
HA_SWAP_KEY
)
{
#ifdef HAVE_ISNAN
#ifdef HAVE_ISNAN
if
(
keyseg
->
type
==
HA_KEYTYPE_FLOAT
)
if
(
isnan
(
val
))
{
{
float
nr
;
bzero
(
key
,
length
);
float4get
(
nr
,
pos
);
key
+=
length
;
if
(
isnan
(
nr
))
len
+=
length
;
{
continue
;
/* Replace NAN with zero */
}
bzero
(
key
,
length
);
key
+=
length
;
continue
;
}
}
else
if
(
keyseg
->
type
==
HA_KEYTYPE_DOUBLE
)
{
double
nr
;
get_double
(
&
nr
,
pos
);
if
(
isnan
(
nr
))
{
bzero
(
key
,
length
);
key
+=
length
;
continue
;
}
}
#endif
#endif
pos
+=
length
;
while
(
length
--
)
if
(
keyseg
->
flag
&
HA_SWAP_KEY
)
{
{
char
buf
[
sizeof
(
double
)];
float8store
(
buf
,
val
);
pos
=
&
buf
[
length
];
while
(
pos
>
buf
)
*
key
++
=
*--
pos
;
*
key
++
=
*--
pos
;
}
}
}
else
else
{
{
memcpy
((
byte
*
)
key
,
pos
,
length
);
float8store
((
byte
*
)
key
,
val
);
key
+=
keyseg
->
length
;
key
+=
length
;
}
}
len
+=
keyseg
->
length
;
len
+=
length
;
}
}
_mi_dpointer
(
info
,
key
,
filepos
);
_mi_dpointer
(
info
,
key
,
filepos
);
return
len
;
return
len
;
...
@@ -141,13 +128,13 @@ static int sp_add_point_to_mbr(uchar *(*wkb), uchar *end, uint n_dims,
...
@@ -141,13 +128,13 @@ static int sp_add_point_to_mbr(uchar *(*wkb), uchar *end, uint n_dims,
{
{
if
((
*
wkb
)
>
end
-
8
)
if
((
*
wkb
)
>
end
-
8
)
return
-
1
;
return
-
1
;
get_double
(
&
ord
,
(
const
byte
*
)
*
wkb
);
float8get
(
ord
,
(
const
byte
*
)
*
wkb
);
(
*
wkb
)
+=
8
;
(
*
wkb
)
+=
8
;
if
(
ord
<
*
mbr
)
if
(
ord
<
*
mbr
)
float8store
((
char
*
)
mbr
,
ord
)
;
*
mbr
=
ord
;
mbr
++
;
mbr
++
;
if
(
ord
>
*
mbr
)
if
(
ord
>
*
mbr
)
float8store
((
char
*
)
mbr
,
ord
)
;
*
mbr
=
ord
;
mbr
++
;
mbr
++
;
}
}
return
0
;
return
0
;
...
...
mysql-test/r/gis-rtree.result
View file @
ea9825d6
...
@@ -1444,3 +1444,16 @@ OPTIMIZE TABLE t1;
...
@@ -1444,3 +1444,16 @@ OPTIMIZE TABLE t1;
Table Op Msg_type Msg_text
Table Op Msg_type Msg_text
test.t1 optimize status OK
test.t1 optimize status OK
DROP TABLE t1;
DROP TABLE t1;
CREATE TABLE t1 (a INT, b GEOMETRY NOT NULL, SPATIAL KEY b(b));
INSERT INTO t1 VALUES (1, GEOMFROMTEXT('LINESTRING(1102218.456 1,2000000 2)'));
INSERT INTO t1 VALUES (2, GEOMFROMTEXT('LINESTRING(1102218.456 1,2000000 2)'));
SELECT COUNT(*) FROM t1 WHERE
MBRINTERSECTS(b, GEOMFROMTEXT('LINESTRING(1 1,1102219 2)') );
COUNT(*)
2
SELECT COUNT(*) FROM t1 IGNORE INDEX (b) WHERE
MBRINTERSECTS(b, GEOMFROMTEXT('LINESTRING(1 1,1102219 2)') );
COUNT(*)
2
DROP TABLE t1;
End of 5.0 tests.
mysql-test/t/gis-rtree.test
View file @
ea9825d6
...
@@ -827,3 +827,22 @@ INSERT INTO t1 (b) SELECT b FROM t1;
...
@@ -827,3 +827,22 @@ INSERT INTO t1 (b) SELECT b FROM t1;
OPTIMIZE
TABLE
t1
;
OPTIMIZE
TABLE
t1
;
DROP
TABLE
t1
;
DROP
TABLE
t1
;
#
# Bug #29070: Error in spatial index
#
CREATE
TABLE
t1
(
a
INT
,
b
GEOMETRY
NOT
NULL
,
SPATIAL
KEY
b
(
b
));
INSERT
INTO
t1
VALUES
(
1
,
GEOMFROMTEXT
(
'LINESTRING(1102218.456 1,2000000 2)'
));
INSERT
INTO
t1
VALUES
(
2
,
GEOMFROMTEXT
(
'LINESTRING(1102218.456 1,2000000 2)'
));
# must return the same number as the next select
SELECT
COUNT
(
*
)
FROM
t1
WHERE
MBRINTERSECTS
(
b
,
GEOMFROMTEXT
(
'LINESTRING(1 1,1102219 2)'
)
);
SELECT
COUNT
(
*
)
FROM
t1
IGNORE
INDEX
(
b
)
WHERE
MBRINTERSECTS
(
b
,
GEOMFROMTEXT
(
'LINESTRING(1 1,1102219 2)'
)
);
DROP
TABLE
t1
;
--
echo
End
of
5.0
tests
.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment