[MDEV-8456] Dead code in Item_cond::fix_fields() and Item_func_between::fix_fields() Created: 2015-07-13  Updated: 2015-07-13  Resolved: 2015-07-13

Status: Closed
Project: MariaDB Server
Component/s: Optimizer
Affects Version/s: 10.0, 10.1
Fix Version/s: 10.1.6

Type: Bug Priority: Major
Reporter: Alexander Barkov Assignee: Alexander Barkov
Resolution: Fixed Votes: 0
Labels: None


 Description   

Item_cond::fix_fields() and Item_func_between::fix_fields() update these optimizer related SELECT_LEX members:

thd->lex->current_select->cond_count and
thd->lex->current_select->between_count

The purpose of these members is to allocate optimizer related buffers in:

  • update_ref_and_keys() in sql_select.cc and
  • check_func_dependency() in opt_table_elimination,cc
    and it seems they have no any other purposes..

This looks like a dead code and the collected values are never used:

  • cond_count and_between_count are later always initialized to 0 before the walk(count_sargable_conds) call in update_ref_and_keys().
  • moreover, using the values collected during fix_fields() would not be correct to allocate optimized related buffers, because the code in fix_fields() does not distinguish between different query parts, so the items can be just a part of the SELECT list rather than a part of WHERE/HAVING/ON.


 Comments   
Comment by Alexander Barkov [ 2015-07-13 ]

Monty approved the patch by email.

Generated at Thu Feb 08 07:27:17 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.