Commit c14a724a authored by Yuchen Pei's avatar Yuchen Pei

MDEV-29363 Add with_subquery_processor

parent c2da55ac
......@@ -2208,6 +2208,11 @@ class Item :public Value_source,
virtual bool view_used_tables_processor(void *arg) { return 0; }
virtual bool eval_not_null_tables(void *arg) { return 0; }
virtual bool is_subquery_processor(void *arg) { return 0; }
virtual bool with_subquery_processor(void *arg)
{
with_flags= with_flags & ~item_with_t::SUBQUERY;
return 0;
}
virtual bool count_sargable_conds(void *arg) { return 0; }
virtual bool limit_index_condition_pushdown_processor(void *arg) { return 0; }
virtual bool exists2in_processor(void *arg) { return 0; }
......@@ -5484,6 +5489,19 @@ class Item_func_or_sum: public Item_result_field,
return true;
return (this->*processor)(arg);
}
bool with_subquery_processor (void *opt_arg) override
{
for (uint i= 0; i < arg_count; i++)
{
if (args[i]->with_subquery())
{
with_flags|= item_with_t::SUBQUERY;
return FALSE;
}
}
with_flags&= ~item_with_t::SUBQUERY;
return FALSE;
}
/*
Built-in schema, e.g. mariadb_schema, oracle_schema, maxdb_schema
*/
......
......@@ -265,6 +265,11 @@ class Item_subselect :public Item_result_field,
bool expr_cache_is_needed(THD *) override;
void get_cache_parameters(List<Item> &parameters) override;
bool is_subquery_processor (void *opt_arg) override { return 1; }
bool with_subquery_processor (void *opt_arg) override
{
with_flags|= item_with_t::SUBQUERY;
return FALSE;
}
bool exists2in_processor(void *opt_arg) override { return 0; }
bool limit_index_condition_pushdown_processor(void *opt_arg) override
{
......
......@@ -17992,6 +17992,7 @@ static COND *build_equal_items(JOIN *join, COND *cond,
{
cond= cond->build_equal_items(thd, inherited, link_equal_fields,
cond_equal_ref);
cond->walk(&Item::with_subquery_processor, 1, 0);
if (*cond_equal_ref)
{
(*cond_equal_ref)->upper_levels= inherited;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment