mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 12:02:42 +01:00
A clean-up for c8141f5314
MDEV-7950 Item_func::type() takes 0.26% in OLTP RO (Step#2) - Item_ref was doing unnecessary extra job after the "MDEV-7950 Step#2" patch. Fallback to Item::build_equal_items() if real_type() is not FIELD_ITEM. Note, Item_ref::build_equal_items() will most likely be further simplified. Waiting for Sanja and Igor to check a possibly dead code. - Safety: Adding Item_sum::build_equal_items() with ASSERT, as Item_sum should never appear in build_equal_items() context.
This commit is contained in:
parent
9cdf5c2bfd
commit
499deca7fc
2 changed files with 27 additions and 0 deletions
16
sql/item.h
16
sql/item.h
|
@ -3575,6 +3575,22 @@ public:
|
|||
Item *get_tmp_table_item(THD *thd);
|
||||
table_map used_tables() const;
|
||||
void update_used_tables();
|
||||
COND *build_equal_items(THD *thd, COND_EQUAL *inherited,
|
||||
bool link_item_fields)
|
||||
{
|
||||
/*
|
||||
Item_ref cannot refer to Item_field when build_equal_items() is called,
|
||||
because all "WHERE/HAVING field" are already replaced to
|
||||
"WHERE/HAVING field<>0" by this time. See normalize_cond().
|
||||
TODO: make sure with Igor and Sanja, perhaps the below expression
|
||||
can be simplified just to a Item::build_equal_items() call.
|
||||
*/
|
||||
return real_type() == FIELD_ITEM ?
|
||||
Item_ident_or_func_or_sum::build_equal_items(thd, inherited,
|
||||
link_item_fields) :
|
||||
Item::build_equal_items(thd, inherited,
|
||||
link_item_fields);
|
||||
}
|
||||
bool const_item() const
|
||||
{
|
||||
return (*ref)->const_item();
|
||||
|
|
|
@ -444,6 +444,17 @@ public:
|
|||
*/
|
||||
table_map used_tables() const { return used_tables_cache; }
|
||||
void update_used_tables ();
|
||||
COND *build_equal_items(THD *thd, COND_EQUAL *inherited,
|
||||
bool link_item_fields)
|
||||
{
|
||||
/*
|
||||
Item_sum (and derivants) of the original WHERE/HAVING clauses
|
||||
should already be replaced to Item_aggregate_ref by the time when
|
||||
build_equal_items() is called. See Item::split_sum_func2().
|
||||
*/
|
||||
DBUG_ASSERT(0);
|
||||
return Item::build_equal_items(thd, inherited, link_item_fields);
|
||||
}
|
||||
bool is_null() { return null_value; }
|
||||
void make_const ()
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue