mirror of
https://github.com/MariaDB/server.git
synced 2026-04-28 11:15:33 +02:00
merge
This commit is contained in:
commit
4aa1ad2b6d
18 changed files with 413 additions and 234 deletions
|
|
@ -1798,6 +1798,8 @@ Item *Item_in_optimizer::expr_cache_insert_transformer(uchar *thd_arg)
|
|||
{
|
||||
THD *thd= (THD*) thd_arg;
|
||||
DBUG_ENTER("Item_in_optimizer::expr_cache_insert_transformer");
|
||||
if (args[1]->type() != Item::SUBSELECT_ITEM)
|
||||
DBUG_RETURN(this); // MAX/MIN transformed => do nothing
|
||||
List<Item*> &depends_on= ((Item_subselect *)args[1])->depends_on;
|
||||
|
||||
if (expr_cache)
|
||||
|
|
@ -1901,7 +1903,15 @@ longlong Item_in_optimizer::val_int()
|
|||
DBUG_ASSERT(fixed == 1);
|
||||
cache->store(args[0]);
|
||||
cache->cache_value();
|
||||
|
||||
|
||||
if (args[1]->type() != Item::SUBSELECT_ITEM)
|
||||
{
|
||||
/* MAX/MIN transformed => pass through */
|
||||
longlong res= args[1]->val_int();
|
||||
null_value= args[1]->null_value;
|
||||
return (res);
|
||||
}
|
||||
|
||||
if (cache->null_value)
|
||||
{
|
||||
/*
|
||||
|
|
@ -2050,24 +2060,35 @@ Item *Item_in_optimizer::transform(Item_transformer transformer, uchar *argument
|
|||
if ((*args) != new_item)
|
||||
current_thd->change_item_tree(args, new_item);
|
||||
|
||||
/*
|
||||
Transform the right IN operand which should be an Item_in_subselect or a
|
||||
subclass of it. The left operand of the IN must be the same as the left
|
||||
operand of this Item_in_optimizer, so in this case there is no further
|
||||
transformation, we only make both operands the same.
|
||||
TODO: is it the way it should be?
|
||||
*/
|
||||
DBUG_ASSERT((args[1])->type() == Item::SUBSELECT_ITEM &&
|
||||
(((Item_subselect*)(args[1]))->substype() ==
|
||||
Item_subselect::IN_SUBS ||
|
||||
((Item_subselect*)(args[1]))->substype() ==
|
||||
Item_subselect::ALL_SUBS ||
|
||||
((Item_subselect*)(args[1]))->substype() ==
|
||||
Item_subselect::ANY_SUBS));
|
||||
|
||||
Item_in_subselect *in_arg= (Item_in_subselect*)args[1];
|
||||
in_arg->left_expr= args[0];
|
||||
if (args[1]->type() != Item::SUBSELECT_ITEM)
|
||||
{
|
||||
/* MAX/MIN transformed => pass through */
|
||||
new_item= args[1]->transform(transformer, argument);
|
||||
if (!new_item)
|
||||
return 0;
|
||||
if (args[1] != new_item)
|
||||
current_thd->change_item_tree(args, new_item);
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
Transform the right IN operand which should be an Item_in_subselect or a
|
||||
subclass of it. The left operand of the IN must be the same as the left
|
||||
operand of this Item_in_optimizer, so in this case there is no further
|
||||
transformation, we only make both operands the same.
|
||||
TODO: is it the way it should be?
|
||||
*/
|
||||
DBUG_ASSERT((args[1])->type() == Item::SUBSELECT_ITEM &&
|
||||
(((Item_subselect*)(args[1]))->substype() ==
|
||||
Item_subselect::IN_SUBS ||
|
||||
((Item_subselect*)(args[1]))->substype() ==
|
||||
Item_subselect::ALL_SUBS ||
|
||||
((Item_subselect*)(args[1]))->substype() ==
|
||||
Item_subselect::ANY_SUBS));
|
||||
|
||||
Item_in_subselect *in_arg= (Item_in_subselect*)args[1];
|
||||
in_arg->left_expr= args[0];
|
||||
}
|
||||
return (this->*transformer)(argument);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue