Skip to content

Commit a3e49c0

Browse files
committed
MDEV-18501 Partition pruning doesn't work for historical queries (cleanup)
Cleanup removes useless allocation.
1 parent 396da1a commit a3e49c0

File tree

4 files changed

+10
-18
lines changed

4 files changed

+10
-18
lines changed

sql/partition_info.cc

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1473,15 +1473,8 @@ void partition_info::print_no_partition_found(TABLE *table_arg, myf errflag)
14731473
FALSE Success
14741474
*/
14751475

1476-
bool partition_info::set_part_expr(THD *thd, char *start_token, Item *item_ptr,
1477-
char *end_token, bool is_subpart)
1476+
bool partition_info::set_part_expr(THD *thd, Item *item_ptr, bool is_subpart)
14781477
{
1479-
size_t expr_len= end_token - start_token;
1480-
char *func_string= (char*) thd->memdup(start_token, expr_len);
1481-
1482-
if (unlikely(!func_string))
1483-
return TRUE;
1484-
14851478
if (is_subpart)
14861479
{
14871480
list_of_subpart_fields= FALSE;

sql/partition_info.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -366,8 +366,7 @@ class partition_info : public Sql_alloc
366366
void init_col_val(part_column_list_val *col_val, Item *item);
367367
int reorganize_into_single_field_col_val(THD *thd);
368368
part_column_list_val *add_column_value(THD *thd);
369-
bool set_part_expr(THD *thd, char *start_token, Item *item_ptr,
370-
char *end_token, bool is_subpart);
369+
bool set_part_expr(THD *thd, Item *item_ptr, bool is_subpart);
371370
bool set_up_charset_field_preps(THD *thd);
372371
bool check_partition_field_length();
373372
bool init_column_part(THD *thd);

sql/sql_yacc.yy

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5541,20 +5541,20 @@ part_column_list:
55415541

55425542

55435543
part_func:
5544-
'(' remember_name part_func_expr remember_end ')'
5544+
'(' part_func_expr ')'
55455545
{
55465546
partition_info *part_info= Lex->part_info;
5547-
if (unlikely(part_info->set_part_expr(thd, $2 + 1, $3, $4, FALSE)))
5547+
if (unlikely(part_info->set_part_expr(thd, $2, FALSE)))
55485548
MYSQL_YYABORT;
55495549
part_info->num_columns= 1;
55505550
part_info->column_list= FALSE;
55515551
}
55525552
;
55535553

55545554
sub_part_func:
5555-
'(' remember_name part_func_expr remember_end ')'
5555+
'(' part_func_expr ')'
55565556
{
5557-
if (unlikely(Lex->part_info->set_part_expr(thd, $2 + 1, $3, $4, TRUE)))
5557+
if (unlikely(Lex->part_info->set_part_expr(thd, $2, TRUE)))
55585558
MYSQL_YYABORT;
55595559
}
55605560
;

sql/sql_yacc_ora.yy

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5387,20 +5387,20 @@ part_column_list:
53875387

53885388

53895389
part_func:
5390-
'(' remember_name part_func_expr remember_end ')'
5390+
'(' part_func_expr ')'
53915391
{
53925392
partition_info *part_info= Lex->part_info;
5393-
if (unlikely(part_info->set_part_expr(thd, $2 + 1, $3, $4, FALSE)))
5393+
if (unlikely(part_info->set_part_expr(thd, $2, FALSE)))
53945394
MYSQL_YYABORT;
53955395
part_info->num_columns= 1;
53965396
part_info->column_list= FALSE;
53975397
}
53985398
;
53995399

54005400
sub_part_func:
5401-
'(' remember_name part_func_expr remember_end ')'
5401+
'(' part_func_expr ')'
54025402
{
5403-
if (unlikely(Lex->part_info->set_part_expr(thd, $2 + 1, $3, $4, TRUE)))
5403+
if (unlikely(Lex->part_info->set_part_expr(thd, $2, TRUE)))
54045404
MYSQL_YYABORT;
54055405
}
54065406
;

0 commit comments

Comments
 (0)