Commit a3e49c0d authored by Aleksey Midenkov's avatar Aleksey Midenkov

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

Cleanup removes useless allocation.
parent 396da1a7
...@@ -1473,15 +1473,8 @@ void partition_info::print_no_partition_found(TABLE *table_arg, myf errflag) ...@@ -1473,15 +1473,8 @@ void partition_info::print_no_partition_found(TABLE *table_arg, myf errflag)
FALSE Success FALSE Success
*/ */
bool partition_info::set_part_expr(THD *thd, char *start_token, Item *item_ptr, bool partition_info::set_part_expr(THD *thd, Item *item_ptr, bool is_subpart)
char *end_token, 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) if (is_subpart)
{ {
list_of_subpart_fields= FALSE; list_of_subpart_fields= FALSE;
......
...@@ -366,8 +366,7 @@ class partition_info : public Sql_alloc ...@@ -366,8 +366,7 @@ class partition_info : public Sql_alloc
void init_col_val(part_column_list_val *col_val, Item *item); void init_col_val(part_column_list_val *col_val, Item *item);
int reorganize_into_single_field_col_val(THD *thd); int reorganize_into_single_field_col_val(THD *thd);
part_column_list_val *add_column_value(THD *thd); part_column_list_val *add_column_value(THD *thd);
bool set_part_expr(THD *thd, char *start_token, Item *item_ptr, bool set_part_expr(THD *thd, Item *item_ptr, bool is_subpart);
char *end_token, bool is_subpart);
bool set_up_charset_field_preps(THD *thd); bool set_up_charset_field_preps(THD *thd);
bool check_partition_field_length(); bool check_partition_field_length();
bool init_column_part(THD *thd); bool init_column_part(THD *thd);
......
...@@ -5541,10 +5541,10 @@ part_column_list: ...@@ -5541,10 +5541,10 @@ part_column_list:
part_func: part_func:
'(' remember_name part_func_expr remember_end ')' '(' part_func_expr ')'
{ {
partition_info *part_info= Lex->part_info; 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; MYSQL_YYABORT;
part_info->num_columns= 1; part_info->num_columns= 1;
part_info->column_list= FALSE; part_info->column_list= FALSE;
...@@ -5552,9 +5552,9 @@ part_func: ...@@ -5552,9 +5552,9 @@ part_func:
; ;
sub_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; MYSQL_YYABORT;
} }
; ;
......
...@@ -5387,10 +5387,10 @@ part_column_list: ...@@ -5387,10 +5387,10 @@ part_column_list:
part_func: part_func:
'(' remember_name part_func_expr remember_end ')' '(' part_func_expr ')'
{ {
partition_info *part_info= Lex->part_info; 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; MYSQL_YYABORT;
part_info->num_columns= 1; part_info->num_columns= 1;
part_info->column_list= FALSE; part_info->column_list= FALSE;
...@@ -5398,9 +5398,9 @@ part_func: ...@@ -5398,9 +5398,9 @@ part_func:
; ;
sub_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; MYSQL_YYABORT;
} }
; ;
......
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