summaryrefslogtreecommitdiff
path: root/sql/item_geofunc.cc
diff options
context:
space:
mode:
authorAlexey Botchkov <holyfoot@askmonty.org>2011-09-13 13:59:11 +0500
committerAlexey Botchkov <holyfoot@askmonty.org>2011-09-13 13:59:11 +0500
commit3882c5d62c83f4768c022f38bf91180ce0fcc7a2 (patch)
tree9c3bf39a8c49c9a2b4049f55a4dbd15ca0b2da93 /sql/item_geofunc.cc
parenta1315808b4a067fd82877ea1cfbd8867f9a8588a (diff)
downloadmariadb-git-3882c5d62c83f4768c022f38bf91180ce0fcc7a2.tar.gz
Fix for few similar bugs:
#841622 Assertion `t->rp->type == Gcalc_function::shape_line' failed in Gcalc_operation_reducer::end_line in maria-5.3-gi #841625 Assertion `m_poly_borders->next' failed in Gcalc_operation_reducer::count_slice in maria-5.3-gis #841638 Assertion `!m_prev || m_prev->x != x || m_prev->y != y' failed in Gcalc_shape_transporter::int_add_point in maria-5.3-gis #841662 Third assertion `n > 0 && n < SINUSES_CALCULATED*2+1' in get_n_sincos #841745 Assertion `!sp0->is_bottom()' failed in Gcalc_scan_iterator::find_intersections in maria-5.3-gis They mostly was caused by inprecision of double arithmetic. Fixed by changes in how to handle multiple intersections to keep their order right. Also ST_DISTANCE(GEOM, EMPTY_GEOM) was defined as NULL. per-file comments: mysql-test/r/gis-precise.result GIS bugfixes. test result updated. mysql-test/t/gis-precise.test GIS bugfixes. test cases added. sql/gcalc_slicescan.cc GIS bugfixes. If intersections are close, add order checks to cope with the double calcualtions imprecision. sql/gcalc_slicescan.h GIS bugfixes. n_row parameter added to intersection to check their order. sql/item_geofunc.cc GIS bugfixes. ST_DISTANCE(GEOM, EMPTY_GEOM) returns NULL.
Diffstat (limited to 'sql/item_geofunc.cc')
-rw-r--r--sql/item_geofunc.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/sql/item_geofunc.cc b/sql/item_geofunc.cc
index ea849bb10a3..631b63812b5 100644
--- a/sql/item_geofunc.cc
+++ b/sql/item_geofunc.cc
@@ -1789,6 +1789,14 @@ double Item_func_distance::val_real()
if (g2->store_shapes(&trn) || func.alloc_states())
goto mem_error;
+ if (obj2_si == 0 || func.get_nshapes() == obj2_si)
+ {
+ distance= 0.0;
+ null_value= 1;
+ goto exit;
+ }
+
+
collector.prepare_operation();
scan_it.init(&collector);