1
0
mirror of https://github.com/MariaDB/server.git synced 2025-12-24 11:21:21 +03:00

BUG#20257: Fix partition pruning for BIGINT UNSIGNED:

- Fix problems in the "Interval walking" partition interval analyzer.
This commit is contained in:
sergefp@mysql.com
2006-07-24 21:58:11 +04:00
parent dd3434b302
commit e7db9d4545
3 changed files with 157 additions and 4 deletions

View File

@@ -6566,10 +6566,19 @@ int get_part_iter_for_interval_via_walking(partition_info *part_info,
store_key_image_to_rec(field, max_value, len);
b= field->val_int();
/*
Handle a special case where the distance between interval bounds is
exactly 4G-1. This interval is too big for range walking, and if it is an
(x,y]-type interval then the following "b +=..." code will convert it to
an empty interval by "wrapping around" a + 4G-1 + 1 = a.
*/
if ((ulonglong)b - (ulonglong)a == ~0ULL)
return -1;
a += test(flags & NEAR_MIN);
b += test(!(flags & NEAR_MAX));
uint n_values= b - a;
ulonglong n_values= b - a;
if (n_values > total_parts || n_values > MAX_RANGE_TO_WALK)
return -1;
@@ -6673,7 +6682,8 @@ static uint32 get_next_partition_via_walking(PARTITION_ITERATOR *part_iter)
while (part_iter->field_vals.cur != part_iter->field_vals.end)
{
longlong dummy;
field->store(part_iter->field_vals.cur++, FALSE);
field->store(part_iter->field_vals.cur++,
((Field_num*)field)->unsigned_flag);
if (part_iter->part_info->is_sub_partitioned() &&
!part_iter->part_info->get_part_partition_id(part_iter->part_info,
&part_id, &dummy) ||
@@ -6681,8 +6691,6 @@ static uint32 get_next_partition_via_walking(PARTITION_ITERATOR *part_iter)
&part_id, &dummy))
return part_id;
}
//psergey-todo: return partition(part_func(NULL)) here...
part_iter->field_vals.cur= part_iter->field_vals.start;
return NOT_A_PARTITION_ID;
}