Skip to content
Permalink
Browse files

MDEV-18501 Partition pruning doesn't work for historical queries (cle…

…anup)

Cleanup removes useless allocation.
  • Loading branch information...
midenok committed Aug 27, 2019
1 parent 396da1a commit a3e49c0d36c0347e9dee43f9996ca7c407836a51
Showing with 10 additions and 18 deletions.
  1. +1 −8 sql/partition_info.cc
  2. +1 −2 sql/partition_info.h
  3. +4 −4 sql/sql_yacc.yy
  4. +4 −4 sql/sql_yacc_ora.yy
@@ -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;
@@ -366,8 +366,7 @@ class partition_info : public Sql_alloc
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);
@@ -5541,20 +5541,20 @@ 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;
}
;

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;
}
;
@@ -5387,20 +5387,20 @@ 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;
}
;

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;
}
;

0 comments on commit a3e49c0

Please sign in to comment.
You can’t perform that action at this time.