mirror of
https://github.com/MariaDB/server.git
synced 2026-05-07 23:54:31 +02:00
Bug #1043845 st_distance() results are incorrect depending on variable order.
Autointersections of an object were treated as nodes, so the wrong result. per-file comments: mysql-test/r/gis.result Bug #1043845 st_distance() results are incorrect depending on variable order. test result updated. mysql-test/t/gis.test Bug #1043845 st_distance() results are incorrect depending on variable order. test case added. sql/item.cc small fix to make compilers happy. sql/item_geofunc.cc Bug #1043845 st_distance() results are incorrect depending on variable order. Skip intersection points when calculate distance.
This commit is contained in:
parent
51e14492e9
commit
589c62fefe
4 changed files with 42 additions and 2 deletions
|
|
@ -1473,3 +1473,26 @@ WHERE ST_Contains(ST_Buffer(bridges.position, 15.0), buildings.footprint) = 1;
|
|||
count(*)
|
||||
1
|
||||
DROP DATABASE gis_ogs;
|
||||
#
|
||||
# BUG #1043845 st_distance() results are incorrect depending on variable order
|
||||
#
|
||||
select st_distance(geomfromtext('LINESTRING(-95.9673005697771 36.13509598461,
|
||||
-95.9673057475387 36.1344478941074,
|
||||
-95.9673063519371 36.134484524621,
|
||||
-95.9673049102515 36.1343976584193)'),
|
||||
geomfromtext('point(-95.96269500000000000000 36.14181833333330000000)')) ;
|
||||
st_distance(geomfromtext('LINESTRING(-95.9673005697771 36.13509598461,
|
||||
-95.9673057475387 36.1344478941074,
|
||||
-95.9673063519371 36.134484524621,
|
||||
|
||||
0.008148695928138
|
||||
select st_distance(geomfromtext('point(-95.96269500000000000000 36.14181833333330000000)'),
|
||||
geomfromtext('LINESTRING(-95.9673005697771 36.13509598461,
|
||||
-95.9673057475387 36.1344478941074,
|
||||
-95.9673063519371 36.134484524621,
|
||||
-95.9673049102515 36.1343976584193) ')) ;
|
||||
st_distance(geomfromtext('point(-95.96269500000000000000 36.14181833333330000000)'),
|
||||
geomfromtext('LINESTRING(-95.9673005697771 36.13509598461,
|
||||
-95.9673057475387 36.1344478941074,
|
||||
-95.9673063519371 36.
|
||||
0.008148695928138
|
||||
|
|
|
|||
|
|
@ -1355,3 +1355,19 @@ WHERE ST_Contains(ST_Buffer(bridges.position, 15.0), buildings.footprint) = 1;
|
|||
#WHERE lakes.name = 'Blue Lake';
|
||||
|
||||
DROP DATABASE gis_ogs;
|
||||
|
||||
--echo #
|
||||
--echo # BUG #1043845 st_distance() results are incorrect depending on variable order
|
||||
--echo #
|
||||
|
||||
select st_distance(geomfromtext('LINESTRING(-95.9673005697771 36.13509598461,
|
||||
-95.9673057475387 36.1344478941074,
|
||||
-95.9673063519371 36.134484524621,
|
||||
-95.9673049102515 36.1343976584193)'),
|
||||
geomfromtext('point(-95.96269500000000000000 36.14181833333330000000)')) ;
|
||||
select st_distance(geomfromtext('point(-95.96269500000000000000 36.14181833333330000000)'),
|
||||
geomfromtext('LINESTRING(-95.9673005697771 36.13509598461,
|
||||
-95.9673057475387 36.1344478941074,
|
||||
-95.9673063519371 36.134484524621,
|
||||
-95.9673049102515 36.1343976584193) ')) ;
|
||||
|
||||
|
|
|
|||
|
|
@ -8858,7 +8858,7 @@ bool Item_type_holder::join_types(THD *thd, Item *item)
|
|||
item->max_length, item->decimals));
|
||||
fld_type= Field::field_type_merge(fld_type, get_real_type(item));
|
||||
{
|
||||
int item_decimals= item->decimals;
|
||||
uint item_decimals= item->decimals;
|
||||
/* fix variable decimals which always is NOT_FIXED_DEC */
|
||||
if (Field::result_merge_type(fld_type) == INT_RESULT)
|
||||
item_decimals= 0;
|
||||
|
|
|
|||
|
|
@ -1693,7 +1693,8 @@ count_distance:
|
|||
for (dist_point= collector.get_first(); dist_point; dist_point= dist_point->get_next())
|
||||
{
|
||||
/* We only check vertices of object 2 */
|
||||
if (dist_point->shape < obj2_si)
|
||||
if (dist_point->type != Gcalc_heap::nt_shape_node ||
|
||||
dist_point->shape < obj2_si)
|
||||
continue;
|
||||
|
||||
/* if we have an edge to check */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue