summaryrefslogtreecommitdiff
path: root/myisam
diff options
context:
space:
mode:
authorunknown <holyfoot/hf@hfmain.(none)>2007-10-05 15:41:56 +0500
committerunknown <holyfoot/hf@hfmain.(none)>2007-10-05 15:41:56 +0500
commit8e37481553eed9630987dbf8f122b0fc33b94909 (patch)
tree6c0853f69ad5b030d8be36ab02cad87586320e43 /myisam
parent5c5233cd2b71fc28a07fbe9d9f625702bcb85ce6 (diff)
parent6d54b5771bf3cce3e5a5e8ca295219fdbae80c00 (diff)
downloadmariadb-git-8e37481553eed9630987dbf8f122b0fc33b94909.tar.gz
Merge mysql.com:/home/hf/work/30286/my41-30286
into mysql.com:/home/hf/work/30286/my50-30286 myisam/rt_index.c: Auto merged myisam/rt_mbr.c: Auto merged mysql-test/t/gis-rtree.test: Auto merged mysql-test/r/gis-rtree.result: merging
Diffstat (limited to 'myisam')
-rw-r--r--myisam/rt_index.c18
-rw-r--r--myisam/rt_mbr.c5
2 files changed, 9 insertions, 14 deletions
diff --git a/myisam/rt_index.c b/myisam/rt_index.c
index cf144839dd1..8ecb3688ad5 100644
--- a/myisam/rt_index.c
+++ b/myisam/rt_index.c
@@ -483,15 +483,16 @@ static uchar *rtree_pick_key(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *key,
uint key_length, uchar *page_buf, uint nod_flag)
{
double increase;
- double best_incr = DBL_MAX;
+ double best_incr;
double area;
double best_area;
- uchar *best_key;
+ uchar *best_key= NULL;
uchar *k = rt_PAGE_FIRST_KEY(page_buf, nod_flag);
uchar *last = rt_PAGE_END(page_buf);
LINT_INIT(best_area);
LINT_INIT(best_key);
+ LINT_INIT(best_incr);
for (; k < last; k = rt_PAGE_NEXT_KEY(k, key_length, nod_flag))
{
@@ -500,22 +501,13 @@ static uchar *rtree_pick_key(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *key,
&area)) == -1.0)
return NULL;
/* The following should be safe, even if we compare doubles */
- if (increase < best_incr)
+ if (!best_key || increase < best_incr ||
+ ((increase == best_incr) && (area < best_area)))
{
best_key = k;
best_area = area;
best_incr = increase;
}
- else
- {
- /* The following should be safe, even if we compare doubles */
- if ((increase == best_incr) && (area < best_area))
- {
- best_key = k;
- best_area = area;
- best_incr = increase;
- }
- }
}
return best_key;
}
diff --git a/myisam/rt_mbr.c b/myisam/rt_mbr.c
index 1855e24feb0..deca23bbec7 100644
--- a/myisam/rt_mbr.c
+++ b/myisam/rt_mbr.c
@@ -523,7 +523,10 @@ double rtree_overlapping_area(HA_KEYSEG *keyseg, uchar* a, uchar* b,
}
/*
-Calculates MBR_AREA(a+b) - MBR_AREA(a)
+ Calculates MBR_AREA(a+b) - MBR_AREA(a)
+ Note: when 'a' and 'b' objects are far from each other,
+ the area increase can be really big, so this function
+ can return 'inf' as a result.
*/
double rtree_area_increase(HA_KEYSEG *keyseg, uchar* a, uchar* b,
uint key_length, double *ab_area)