mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
BUG#16002: More review fixes
This commit is contained in:

parent
64ca16506b
commit
bda7c1fd13
@ -365,13 +365,28 @@ COUNT(*)
|
|||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
create table t1 (a bigint unsigned)
|
create table t1 (a bigint unsigned)
|
||||||
partition by range (a)
|
partition by range (a)
|
||||||
|
(partition p0 values less than (10),
|
||||||
|
partition p1 values less than (0));
|
||||||
|
ERROR HY000: VALUES LESS THAN value must be strictly increasing for each partition
|
||||||
|
create table t1 (a bigint unsigned)
|
||||||
|
partition by range (a)
|
||||||
(partition p0 values less than (0),
|
(partition p0 values less than (0),
|
||||||
partition p1 values less than (10));
|
partition p1 values less than (10));
|
||||||
ERROR HY000: VALUES LESS THAN value must be strictly increasing for each partition
|
show create table t1;
|
||||||
|
Table Create Table
|
||||||
|
t1 CREATE TABLE `t1` (
|
||||||
|
`a` bigint(20) unsigned DEFAULT NULL
|
||||||
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION p1 VALUES LESS THAN (10) ENGINE = MyISAM)
|
||||||
|
drop table t1;
|
||||||
create table t1 (a bigint unsigned)
|
create table t1 (a bigint unsigned)
|
||||||
partition by range (a)
|
partition by range (a)
|
||||||
(partition p0 values less than (2),
|
(partition p0 values less than (2),
|
||||||
partition p1 values less than (10));
|
partition p1 values less than (10));
|
||||||
|
show create table t1;
|
||||||
|
Table Create Table
|
||||||
|
t1 CREATE TABLE `t1` (
|
||||||
|
`a` bigint(20) unsigned DEFAULT NULL
|
||||||
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (2) ENGINE = MyISAM, PARTITION p1 VALUES LESS THAN (10) ENGINE = MyISAM)
|
||||||
insert into t1 values (0xFFFFFFFFFFFFFFFF);
|
insert into t1 values (0xFFFFFFFFFFFFFFFF);
|
||||||
ERROR HY000: Table has no partition for value 18446744073709551615
|
ERROR HY000: Table has no partition for value 18446744073709551615
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
@ -392,16 +392,24 @@ DROP TABLE t1;
|
|||||||
# BUG 16002: Unsigned partition functions not handled correctly
|
# BUG 16002: Unsigned partition functions not handled correctly
|
||||||
#
|
#
|
||||||
--error ER_RANGE_NOT_INCREASING_ERROR
|
--error ER_RANGE_NOT_INCREASING_ERROR
|
||||||
|
create table t1 (a bigint unsigned)
|
||||||
|
partition by range (a)
|
||||||
|
(partition p0 values less than (10),
|
||||||
|
partition p1 values less than (0));
|
||||||
|
|
||||||
create table t1 (a bigint unsigned)
|
create table t1 (a bigint unsigned)
|
||||||
partition by range (a)
|
partition by range (a)
|
||||||
(partition p0 values less than (0),
|
(partition p0 values less than (0),
|
||||||
partition p1 values less than (10));
|
partition p1 values less than (10));
|
||||||
|
show create table t1;
|
||||||
|
drop table t1;
|
||||||
|
|
||||||
create table t1 (a bigint unsigned)
|
create table t1 (a bigint unsigned)
|
||||||
partition by range (a)
|
partition by range (a)
|
||||||
(partition p0 values less than (2),
|
(partition p0 values less than (2),
|
||||||
partition p1 values less than (10));
|
partition p1 values less than (10));
|
||||||
|
show create table t1;
|
||||||
--error ER_NO_PARTITION_FOR_GIVEN_VALUE
|
--error ER_NO_PARTITION_FOR_GIVEN_VALUE
|
||||||
insert into t1 values (0xFFFFFFFFFFFFFFFF);
|
insert into t1 values (0xFFFFFFFFFFFFFFFF);
|
||||||
|
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
|
@ -444,9 +444,9 @@ bool partition_info::check_engine_mix(handlerton **engine_array, uint no_parts)
|
|||||||
bool partition_info::check_range_constants()
|
bool partition_info::check_range_constants()
|
||||||
{
|
{
|
||||||
partition_element* part_def;
|
partition_element* part_def;
|
||||||
longlong current_largest_int= LONGLONG_MIN;
|
longlong current_largest;
|
||||||
ulonglong current_largest_uint= 0;
|
longlong part_range_value;
|
||||||
longlong part_range_value_int;
|
bool first= TRUE;
|
||||||
uint i;
|
uint i;
|
||||||
List_iterator<partition_element> it(partitions);
|
List_iterator<partition_element> it(partitions);
|
||||||
bool result= TRUE;
|
bool result= TRUE;
|
||||||
@ -465,33 +465,26 @@ bool partition_info::check_range_constants()
|
|||||||
do
|
do
|
||||||
{
|
{
|
||||||
part_def= it++;
|
part_def= it++;
|
||||||
if (signed_flag)
|
if ((i != (no_parts - 1)) || !defined_max_value)
|
||||||
{
|
{
|
||||||
if ((i != (no_parts - 1)) || !defined_max_value)
|
part_range_value= part_def->range_value;
|
||||||
part_range_value_int= part_def->range_value;
|
if (!signed_flag)
|
||||||
else
|
part_range_value-= 0x8000000000000000ULL;
|
||||||
part_range_value_int= LONGLONG_MAX;
|
}
|
||||||
if (likely(current_largest_int < part_range_value_int))
|
else
|
||||||
{
|
part_range_value= LONGLONG_MAX;
|
||||||
current_largest_int= part_range_value_int;
|
if (first)
|
||||||
range_int_array[i]= part_range_value_int;
|
{
|
||||||
}
|
current_largest= part_range_value;
|
||||||
else
|
range_int_array[0]= part_range_value;
|
||||||
{
|
first= FALSE;
|
||||||
my_error(ER_RANGE_NOT_INCREASING_ERROR, MYF(0));
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ulonglong upart_range_value_int;
|
if (likely(current_largest < part_range_value))
|
||||||
if ((i == (no_parts - 1)) && defined_max_value)
|
|
||||||
part_def->range_value= ULONGLONG_MAX;
|
|
||||||
upart_range_value_int= part_def->range_value;
|
|
||||||
if (likely(current_largest_uint < upart_range_value_int))
|
|
||||||
{
|
{
|
||||||
current_largest_uint= upart_range_value_int;
|
current_largest= part_range_value;
|
||||||
range_int_array[i]= part_range_value_int;
|
range_int_array[i]= part_range_value;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -533,18 +526,6 @@ int partition_info::list_part_cmp(const void* a, const void* b)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int partition_info::list_part_cmp_unsigned(const void* a, const void* b)
|
|
||||||
{
|
|
||||||
ulonglong a1= ((LIST_PART_ENTRY*)a)->list_value;
|
|
||||||
ulonglong b1= ((LIST_PART_ENTRY*)b)->list_value;
|
|
||||||
if (a1 < b1)
|
|
||||||
return -1;
|
|
||||||
else if (a1 > b1)
|
|
||||||
return +1;
|
|
||||||
else
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
This routine allocates an array for all list constants to achieve a fast
|
This routine allocates an array for all list constants to achieve a fast
|
||||||
@ -572,7 +553,7 @@ bool partition_info::check_list_constants()
|
|||||||
uint list_index= 0;
|
uint list_index= 0;
|
||||||
part_elem_value *list_value;
|
part_elem_value *list_value;
|
||||||
bool result= TRUE;
|
bool result= TRUE;
|
||||||
longlong curr_value, prev_value;
|
longlong curr_value, prev_value, type_add, calc_value;
|
||||||
partition_element* part_def;
|
partition_element* part_def;
|
||||||
bool found_null= FALSE;
|
bool found_null= FALSE;
|
||||||
List_iterator<partition_element> list_func_it(partitions);
|
List_iterator<partition_element> list_func_it(partitions);
|
||||||
@ -623,13 +604,22 @@ bool partition_info::check_list_constants()
|
|||||||
}
|
}
|
||||||
|
|
||||||
i= 0;
|
i= 0;
|
||||||
|
/*
|
||||||
|
Fix to be able to reuse signed sort functions also for unsigned
|
||||||
|
partition functions.
|
||||||
|
*/
|
||||||
|
type_add= (longlong)(part_expr->unsigned_flag ?
|
||||||
|
0x8000000000000000ULL :
|
||||||
|
0ULL);
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
part_def= list_func_it++;
|
part_def= list_func_it++;
|
||||||
List_iterator<part_elem_value> list_val_it2(part_def->list_val_list);
|
List_iterator<part_elem_value> list_val_it2(part_def->list_val_list);
|
||||||
while ((list_value= list_val_it2++))
|
while ((list_value= list_val_it2++))
|
||||||
{
|
{
|
||||||
list_array[list_index].list_value= list_value->value;
|
calc_value= list_value->value - type_add;
|
||||||
|
list_array[list_index].list_value= calc_value;
|
||||||
list_array[list_index++].partition_id= i;
|
list_array[list_index++].partition_id= i;
|
||||||
}
|
}
|
||||||
} while (++i < no_parts);
|
} while (++i < no_parts);
|
||||||
@ -637,12 +627,8 @@ bool partition_info::check_list_constants()
|
|||||||
if (fixed)
|
if (fixed)
|
||||||
{
|
{
|
||||||
bool first= TRUE;
|
bool first= TRUE;
|
||||||
if (!part_expr->unsigned_flag)
|
qsort((void*)list_array, no_list_values, sizeof(LIST_PART_ENTRY),
|
||||||
qsort((void*)list_array, no_list_values, sizeof(LIST_PART_ENTRY),
|
&list_part_cmp);
|
||||||
&list_part_cmp);
|
|
||||||
else
|
|
||||||
qsort((void*)list_array, no_list_values, sizeof(LIST_PART_ENTRY),
|
|
||||||
&list_part_cmp_unsigned);
|
|
||||||
|
|
||||||
i= prev_value= 0; //prev_value initialised to quiet compiler
|
i= prev_value= 0; //prev_value initialised to quiet compiler
|
||||||
do
|
do
|
||||||
|
@ -1752,8 +1752,7 @@ static int add_partition_options(File fptr, partition_element *p_elem)
|
|||||||
return err + add_engine(fptr,p_elem->engine_type);
|
return err + add_engine(fptr,p_elem->engine_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int add_partition_values(File fptr, partition_info *part_info,
|
static int add_partition_values(File fptr, partition_info *part_info, partition_element *p_elem)
|
||||||
partition_element *p_elem)
|
|
||||||
{
|
{
|
||||||
int err= 0;
|
int err= 0;
|
||||||
|
|
||||||
@ -1766,7 +1765,7 @@ static int add_partition_values(File fptr, partition_info *part_info,
|
|||||||
if (p_elem->signed_flag)
|
if (p_elem->signed_flag)
|
||||||
err+= add_int(fptr, p_elem->range_value);
|
err+= add_int(fptr, p_elem->range_value);
|
||||||
else
|
else
|
||||||
err+= add_uint(fptr, (ulonglong)p_elem->range_value);
|
err+= add_uint(fptr, p_elem->range_value);
|
||||||
err+= add_end_parenthesis(fptr);
|
err+= add_end_parenthesis(fptr);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -2382,6 +2381,7 @@ int get_partition_id_list(partition_info *part_info,
|
|||||||
int min_list_index= 0;
|
int min_list_index= 0;
|
||||||
int max_list_index= part_info->no_list_values - 1;
|
int max_list_index= part_info->no_list_values - 1;
|
||||||
longlong part_func_value= part_val_int(part_info->part_expr);
|
longlong part_func_value= part_val_int(part_info->part_expr);
|
||||||
|
longlong list_value;
|
||||||
bool unsigned_flag= part_info->part_expr->unsigned_flag;
|
bool unsigned_flag= part_info->part_expr->unsigned_flag;
|
||||||
DBUG_ENTER("get_partition_id_list");
|
DBUG_ENTER("get_partition_id_list");
|
||||||
|
|
||||||
@ -2394,50 +2394,25 @@ int get_partition_id_list(partition_info *part_info,
|
|||||||
}
|
}
|
||||||
goto notfound;
|
goto notfound;
|
||||||
}
|
}
|
||||||
|
if (unsigned_flag)
|
||||||
|
part_func_value-= 0x8000000000000000ULL;
|
||||||
*func_value= part_func_value;
|
*func_value= part_func_value;
|
||||||
if (!unsigned_flag)
|
while (max_list_index >= min_list_index)
|
||||||
{
|
{
|
||||||
longlong list_value;
|
list_index= (max_list_index + min_list_index) >> 1;
|
||||||
while (max_list_index >= min_list_index)
|
list_value= list_array[list_index].list_value;
|
||||||
|
if (list_value < part_func_value)
|
||||||
|
min_list_index= list_index + 1;
|
||||||
|
else if (list_value > part_func_value)
|
||||||
{
|
{
|
||||||
list_index= (max_list_index + min_list_index) >> 1;
|
if (!list_index)
|
||||||
list_value= list_array[list_index].list_value;
|
goto notfound;
|
||||||
if (list_value < part_func_value)
|
max_list_index= list_index - 1;
|
||||||
min_list_index= list_index + 1;
|
|
||||||
else if (list_value > part_func_value)
|
|
||||||
{
|
|
||||||
if (!list_index)
|
|
||||||
goto notfound;
|
|
||||||
max_list_index= list_index - 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
*part_id= (uint32)list_array[list_index].partition_id;
|
|
||||||
DBUG_RETURN(0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
else
|
|
||||||
{
|
|
||||||
ulonglong ulist_value;
|
|
||||||
ulonglong upart_func_value= part_func_value;
|
|
||||||
while (max_list_index >= min_list_index)
|
|
||||||
{
|
{
|
||||||
list_index= (max_list_index + min_list_index) >> 1;
|
*part_id= (uint32)list_array[list_index].partition_id;
|
||||||
ulist_value= list_array[list_index].list_value;
|
DBUG_RETURN(0);
|
||||||
if (ulist_value < upart_func_value)
|
|
||||||
min_list_index= list_index + 1;
|
|
||||||
else if (ulist_value > upart_func_value)
|
|
||||||
{
|
|
||||||
if (!list_index)
|
|
||||||
goto notfound;
|
|
||||||
max_list_index= list_index - 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
*part_id= (uint32)list_array[list_index].partition_id;
|
|
||||||
DBUG_RETURN(0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
notfound:
|
notfound:
|
||||||
@ -2496,57 +2471,30 @@ uint32 get_list_array_idx_for_endpoint(partition_info *part_info,
|
|||||||
bool unsigned_flag= part_info->part_expr->unsigned_flag;
|
bool unsigned_flag= part_info->part_expr->unsigned_flag;
|
||||||
DBUG_ENTER("get_list_array_idx_for_endpoint");
|
DBUG_ENTER("get_list_array_idx_for_endpoint");
|
||||||
|
|
||||||
if (!unsigned_flag)
|
if (unsigned_flag)
|
||||||
|
part_func_value-= 0x8000000000000000ULL;
|
||||||
|
longlong list_value;
|
||||||
|
while (max_list_index >= min_list_index)
|
||||||
{
|
{
|
||||||
longlong list_value;
|
list_index= (max_list_index + min_list_index) >> 1;
|
||||||
while (max_list_index >= min_list_index)
|
list_value= list_array[list_index].list_value;
|
||||||
{
|
|
||||||
list_index= (max_list_index + min_list_index) >> 1;
|
|
||||||
list_value= list_array[list_index].list_value;
|
|
||||||
if (list_value < part_func_value)
|
|
||||||
min_list_index= list_index + 1;
|
|
||||||
else if (list_value > part_func_value)
|
|
||||||
{
|
|
||||||
if (!list_index)
|
|
||||||
goto notfound_signed;
|
|
||||||
max_list_index= list_index - 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
DBUG_RETURN(list_index + test(left_endpoint ^ include_endpoint));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
notfound_signed:
|
|
||||||
if (list_value < part_func_value)
|
if (list_value < part_func_value)
|
||||||
list_index++;
|
min_list_index= list_index + 1;
|
||||||
DBUG_RETURN(list_index);
|
else if (list_value > part_func_value)
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ulonglong upart_func_value= part_func_value;
|
|
||||||
ulonglong ulist_value;
|
|
||||||
while (max_list_index >= min_list_index)
|
|
||||||
{
|
{
|
||||||
list_index= (max_list_index + min_list_index) >> 1;
|
if (!list_index)
|
||||||
ulist_value= list_array[list_index].list_value;
|
goto notfound;
|
||||||
if (ulist_value < upart_func_value)
|
max_list_index= list_index - 1;
|
||||||
min_list_index= list_index + 1;
|
}
|
||||||
else if (ulist_value > upart_func_value)
|
else
|
||||||
{
|
{
|
||||||
if (!list_index)
|
DBUG_RETURN(list_index + test(left_endpoint ^ include_endpoint));
|
||||||
goto notfound_unsigned;
|
|
||||||
max_list_index= list_index - 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
DBUG_RETURN(list_index + test(left_endpoint ^ include_endpoint));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
notfound_unsigned:
|
|
||||||
if (ulist_value < upart_func_value)
|
|
||||||
list_index++;
|
|
||||||
DBUG_RETURN(list_index);
|
|
||||||
}
|
}
|
||||||
|
notfound:
|
||||||
|
if (list_value < part_func_value)
|
||||||
|
list_index++;
|
||||||
|
DBUG_RETURN(list_index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2568,52 +2516,26 @@ int get_partition_id_range(partition_info *part_info,
|
|||||||
*part_id= 0;
|
*part_id= 0;
|
||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
|
if (unsigned_flag)
|
||||||
|
part_func_value-= 0x8000000000000000ULL;
|
||||||
*func_value= part_func_value;
|
*func_value= part_func_value;
|
||||||
if (!unsigned_flag)
|
while (max_part_id > min_part_id)
|
||||||
{
|
{
|
||||||
while (max_part_id > min_part_id)
|
loc_part_id= (max_part_id + min_part_id + 1) >> 1;
|
||||||
{
|
if (range_array[loc_part_id] <= part_func_value)
|
||||||
loc_part_id= (max_part_id + min_part_id + 1) >> 1;
|
min_part_id= loc_part_id + 1;
|
||||||
if (range_array[loc_part_id] <= part_func_value)
|
else
|
||||||
min_part_id= loc_part_id + 1;
|
max_part_id= loc_part_id - 1;
|
||||||
else
|
|
||||||
max_part_id= loc_part_id - 1;
|
|
||||||
}
|
|
||||||
loc_part_id= max_part_id;
|
|
||||||
if (part_func_value >= range_array[loc_part_id])
|
|
||||||
if (loc_part_id != max_partition)
|
|
||||||
loc_part_id++;
|
|
||||||
*part_id= (uint32)loc_part_id;
|
|
||||||
if (loc_part_id == max_partition)
|
|
||||||
if (range_array[loc_part_id] != LONGLONG_MAX)
|
|
||||||
if (part_func_value >= range_array[loc_part_id])
|
|
||||||
DBUG_RETURN(HA_ERR_NO_PARTITION_FOUND);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ulonglong upart_func_value= part_func_value;
|
|
||||||
ulonglong urange_value;
|
|
||||||
while (max_part_id > min_part_id)
|
|
||||||
{
|
|
||||||
loc_part_id= (max_part_id + min_part_id + 1) >> 1;
|
|
||||||
urange_value= range_array[loc_part_id];
|
|
||||||
if (urange_value <= upart_func_value)
|
|
||||||
min_part_id= loc_part_id + 1;
|
|
||||||
else
|
|
||||||
max_part_id= loc_part_id - 1;
|
|
||||||
}
|
|
||||||
loc_part_id= max_part_id;
|
|
||||||
urange_value= range_array[loc_part_id];
|
|
||||||
if (upart_func_value >= urange_value)
|
|
||||||
if (loc_part_id != max_partition)
|
|
||||||
loc_part_id++;
|
|
||||||
*part_id= (uint32)loc_part_id;
|
|
||||||
urange_value= range_array[loc_part_id];
|
|
||||||
if (loc_part_id == max_partition)
|
|
||||||
if (urange_value != ULONGLONG_MAX)
|
|
||||||
if (upart_func_value >= urange_value)
|
|
||||||
DBUG_RETURN(HA_ERR_NO_PARTITION_FOUND);
|
|
||||||
}
|
}
|
||||||
|
loc_part_id= max_part_id;
|
||||||
|
if (part_func_value >= range_array[loc_part_id])
|
||||||
|
if (loc_part_id != max_partition)
|
||||||
|
loc_part_id++;
|
||||||
|
*part_id= (uint32)loc_part_id;
|
||||||
|
if (loc_part_id == max_partition)
|
||||||
|
if (range_array[loc_part_id] != LONGLONG_MAX)
|
||||||
|
if (part_func_value >= range_array[loc_part_id])
|
||||||
|
DBUG_RETURN(HA_ERR_NO_PARTITION_FOUND);
|
||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2671,71 +2593,34 @@ uint32 get_partition_id_range_for_endpoint(partition_info *part_info,
|
|||||||
bool unsigned_flag= part_info->part_expr->unsigned_flag;
|
bool unsigned_flag= part_info->part_expr->unsigned_flag;
|
||||||
DBUG_ENTER("get_partition_id_range_for_endpoint");
|
DBUG_ENTER("get_partition_id_range_for_endpoint");
|
||||||
|
|
||||||
if (!unsigned_flag)
|
if (unsigned_flag)
|
||||||
|
part_func_value-= 0x8000000000000000ULL;
|
||||||
|
while (max_part_id > min_part_id)
|
||||||
{
|
{
|
||||||
while (max_part_id > min_part_id)
|
loc_part_id= (max_part_id + min_part_id + 1) >> 1;
|
||||||
{
|
if (range_array[loc_part_id] <= part_func_value)
|
||||||
loc_part_id= (max_part_id + min_part_id + 1) >> 1;
|
min_part_id= loc_part_id + 1;
|
||||||
if (range_array[loc_part_id] <= part_func_value)
|
else
|
||||||
min_part_id= loc_part_id + 1;
|
max_part_id= loc_part_id - 1;
|
||||||
else
|
|
||||||
max_part_id= loc_part_id - 1;
|
|
||||||
}
|
|
||||||
loc_part_id= max_part_id;
|
|
||||||
if (loc_part_id < max_partition &&
|
|
||||||
part_func_value >= range_array[loc_part_id+1])
|
|
||||||
{
|
|
||||||
loc_part_id++;
|
|
||||||
}
|
|
||||||
if (left_endpoint)
|
|
||||||
{
|
|
||||||
if (part_func_value >= range_array[loc_part_id])
|
|
||||||
loc_part_id++;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (part_func_value == range_array[loc_part_id])
|
|
||||||
loc_part_id += test(include_endpoint);
|
|
||||||
else if (part_func_value > range_array[loc_part_id])
|
|
||||||
loc_part_id++;
|
|
||||||
loc_part_id++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
loc_part_id= max_part_id;
|
||||||
|
if (loc_part_id < max_partition &&
|
||||||
|
part_func_value >= range_array[loc_part_id+1])
|
||||||
{
|
{
|
||||||
ulonglong upart_func_value= part_func_value;
|
loc_part_id++;
|
||||||
ulonglong urange_value;
|
}
|
||||||
while (max_part_id > min_part_id)
|
if (left_endpoint)
|
||||||
{
|
{
|
||||||
loc_part_id= (max_part_id + min_part_id + 1) >> 1;
|
if (part_func_value >= range_array[loc_part_id])
|
||||||
urange_value= range_array[loc_part_id];
|
|
||||||
if (urange_value <= upart_func_value)
|
|
||||||
min_part_id= loc_part_id + 1;
|
|
||||||
else
|
|
||||||
max_part_id= loc_part_id - 1;
|
|
||||||
}
|
|
||||||
loc_part_id= max_part_id;
|
|
||||||
urange_value= range_array[loc_part_id+1];
|
|
||||||
if (loc_part_id < max_partition &&
|
|
||||||
upart_func_value >= urange_value)
|
|
||||||
{
|
|
||||||
loc_part_id++;
|
|
||||||
}
|
|
||||||
if (left_endpoint)
|
|
||||||
{
|
|
||||||
urange_value= range_array[loc_part_id];
|
|
||||||
if (upart_func_value >= urange_value)
|
|
||||||
loc_part_id++;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
urange_value= range_array[loc_part_id];
|
|
||||||
if (upart_func_value == urange_value)
|
|
||||||
loc_part_id += test(include_endpoint);
|
|
||||||
else if (upart_func_value > urange_value)
|
|
||||||
loc_part_id++;
|
|
||||||
loc_part_id++;
|
loc_part_id++;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (part_func_value == range_array[loc_part_id])
|
||||||
|
loc_part_id += test(include_endpoint);
|
||||||
|
else if (part_func_value > range_array[loc_part_id])
|
||||||
|
loc_part_id++;
|
||||||
|
loc_part_id++;
|
||||||
}
|
}
|
||||||
DBUG_RETURN(loc_part_id);
|
DBUG_RETURN(loc_part_id);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user