Browse Source

MDEV-18501 Partition pruning doesn't work for historical queries (cleanup)

Cleanup removes useless allocation.
bb-10.3-MDEV-20485
Aleksey Midenkov 6 years ago
parent
commit
a3e49c0d36
  1. 9
      sql/partition_info.cc
  2. 3
      sql/partition_info.h
  3. 8
      sql/sql_yacc.yy
  4. 8
      sql/sql_yacc_ora.yy

9
sql/partition_info.cc

@ -1473,15 +1473,8 @@ void partition_info::print_no_partition_found(TABLE *table_arg, myf errflag)
FALSE Success
*/
bool partition_info::set_part_expr(THD *thd, char *start_token, Item *item_ptr,
char *end_token, bool is_subpart)
bool partition_info::set_part_expr(THD *thd, Item *item_ptr, bool is_subpart)
{
size_t expr_len= end_token - start_token;
char *func_string= (char*) thd->memdup(start_token, expr_len);
if (unlikely(!func_string))
return TRUE;
if (is_subpart)
{
list_of_subpart_fields= FALSE;

3
sql/partition_info.h

@ -366,8 +366,7 @@ public:
void init_col_val(part_column_list_val *col_val, Item *item);
int reorganize_into_single_field_col_val(THD *thd);
part_column_list_val *add_column_value(THD *thd);
bool set_part_expr(THD *thd, char *start_token, Item *item_ptr,
char *end_token, bool is_subpart);
bool set_part_expr(THD *thd, Item *item_ptr, bool is_subpart);
bool set_up_charset_field_preps(THD *thd);
bool check_partition_field_length();
bool init_column_part(THD *thd);

8
sql/sql_yacc.yy

@ -5541,10 +5541,10 @@ part_column_list:
part_func:
'(' remember_name part_func_expr remember_end ')'
'(' part_func_expr ')'
{
partition_info *part_info= Lex->part_info;
if (unlikely(part_info->set_part_expr(thd, $2 + 1, $3, $4, FALSE)))
if (unlikely(part_info->set_part_expr(thd, $2, FALSE)))
MYSQL_YYABORT;
part_info->num_columns= 1;
part_info->column_list= FALSE;
@ -5552,9 +5552,9 @@ part_func:
;
sub_part_func:
'(' remember_name part_func_expr remember_end ')'
'(' part_func_expr ')'
{
if (unlikely(Lex->part_info->set_part_expr(thd, $2 + 1, $3, $4, TRUE)))
if (unlikely(Lex->part_info->set_part_expr(thd, $2, TRUE)))
MYSQL_YYABORT;
}
;

8
sql/sql_yacc_ora.yy

@ -5387,10 +5387,10 @@ part_column_list:
part_func:
'(' remember_name part_func_expr remember_end ')'
'(' part_func_expr ')'
{
partition_info *part_info= Lex->part_info;
if (unlikely(part_info->set_part_expr(thd, $2 + 1, $3, $4, FALSE)))
if (unlikely(part_info->set_part_expr(thd, $2, FALSE)))
MYSQL_YYABORT;
part_info->num_columns= 1;
part_info->column_list= FALSE;
@ -5398,9 +5398,9 @@ part_func:
;
sub_part_func:
'(' remember_name part_func_expr remember_end ')'
'(' part_func_expr ')'
{
if (unlikely(Lex->part_info->set_part_expr(thd, $2 + 1, $3, $4, TRUE)))
if (unlikely(Lex->part_info->set_part_expr(thd, $2, TRUE)))
MYSQL_YYABORT;
}
;

Loading…
Cancel
Save