BUG#16002: After review fixes

Fixes for NDB
parent bda7c1fd
...@@ -9499,6 +9499,7 @@ int ha_ndbcluster::set_range_data(void *tab_ref, partition_info *part_info) ...@@ -9499,6 +9499,7 @@ int ha_ndbcluster::set_range_data(void *tab_ref, partition_info *part_info)
MYF(0)); MYF(0));
uint i; uint i;
int error= 0; int error= 0;
bool unsigned_flag= part_info->part_expr->unsigned_flag;
DBUG_ENTER("set_range_data"); DBUG_ENTER("set_range_data");
if (!range_data) if (!range_data)
...@@ -9509,6 +9510,8 @@ int ha_ndbcluster::set_range_data(void *tab_ref, partition_info *part_info) ...@@ -9509,6 +9510,8 @@ int ha_ndbcluster::set_range_data(void *tab_ref, partition_info *part_info)
for (i= 0; i < part_info->no_parts; i++) for (i= 0; i < part_info->no_parts; i++)
{ {
longlong range_val= part_info->range_int_array[i]; longlong range_val= part_info->range_int_array[i];
if (unsigned_flag)
range_val-= 0x8000000000000000ULL;
if (range_val < INT_MIN32 || range_val >= INT_MAX32) if (range_val < INT_MIN32 || range_val >= INT_MAX32)
{ {
if ((i != part_info->no_parts - 1) || if ((i != part_info->no_parts - 1) ||
...@@ -9535,6 +9538,7 @@ int ha_ndbcluster::set_list_data(void *tab_ref, partition_info *part_info) ...@@ -9535,6 +9538,7 @@ int ha_ndbcluster::set_list_data(void *tab_ref, partition_info *part_info)
* sizeof(int32), MYF(0)); * sizeof(int32), MYF(0));
uint32 *part_id, i; uint32 *part_id, i;
int error= 0; int error= 0;
bool unsigned_flag= part_info->part_expr->unsigned_flag;
DBUG_ENTER("set_list_data"); DBUG_ENTER("set_list_data");
if (!list_data) if (!list_data)
...@@ -9546,6 +9550,8 @@ int ha_ndbcluster::set_list_data(void *tab_ref, partition_info *part_info) ...@@ -9546,6 +9550,8 @@ int ha_ndbcluster::set_list_data(void *tab_ref, partition_info *part_info)
{ {
LIST_PART_ENTRY *list_entry= &part_info->list_array[i]; LIST_PART_ENTRY *list_entry= &part_info->list_array[i];
longlong list_val= list_entry->list_value; longlong list_val= list_entry->list_value;
if (unsigned_flag)
list_val-= 0x8000000000000000ULL;
if (list_val < INT_MIN32 || list_val > INT_MAX32) if (list_val < INT_MIN32 || list_val > INT_MAX32)
{ {
my_error(ER_LIMITED_PART_RANGE, MYF(0), "NDB"); my_error(ER_LIMITED_PART_RANGE, MYF(0), "NDB");
......
...@@ -2394,9 +2394,9 @@ int get_partition_id_list(partition_info *part_info, ...@@ -2394,9 +2394,9 @@ int get_partition_id_list(partition_info *part_info,
} }
goto notfound; goto notfound;
} }
*func_value= part_func_value;
if (unsigned_flag) if (unsigned_flag)
part_func_value-= 0x8000000000000000ULL; part_func_value-= 0x8000000000000000ULL;
*func_value= part_func_value;
while (max_list_index >= min_list_index) while (max_list_index >= min_list_index)
{ {
list_index= (max_list_index + min_list_index) >> 1; list_index= (max_list_index + min_list_index) >> 1;
...@@ -2509,16 +2509,16 @@ int get_partition_id_range(partition_info *part_info, ...@@ -2509,16 +2509,16 @@ int get_partition_id_range(partition_info *part_info,
uint loc_part_id; uint loc_part_id;
longlong part_func_value= part_val_int(part_info->part_expr); longlong part_func_value= part_val_int(part_info->part_expr);
bool unsigned_flag= part_info->part_expr->unsigned_flag; bool unsigned_flag= part_info->part_expr->unsigned_flag;
DBUG_ENTER("get_partition_id_int_range"); DBUG_ENTER("get_partition_id_range");
if (part_info->part_expr->null_value) if (part_info->part_expr->null_value)
{ {
*part_id= 0; *part_id= 0;
DBUG_RETURN(0); DBUG_RETURN(0);
} }
*func_value= part_func_value;
if (unsigned_flag) if (unsigned_flag)
part_func_value-= 0x8000000000000000ULL; part_func_value-= 0x8000000000000000ULL;
*func_value= part_func_value;
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; loc_part_id= (max_part_id + min_part_id + 1) >> 1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment