Commit 07521851 authored by Galina Shalygina's avatar Galina Shalygina

Cleaned tests, added new tests.

Removed additional is_deterministic() checks.
Added check: subquery used in ON expression.
parent 89bbb745
This diff is collapsed.
This diff is collapsed.
...@@ -10623,7 +10623,5 @@ bool Item::is_deterministic_arg() ...@@ -10623,7 +10623,5 @@ bool Item::is_deterministic_arg()
(collation.collation->state & MY_CS_NOPAD)))) (collation.collation->state & MY_CS_NOPAD))))
return false; return false;
} }
if (field_type() == MYSQL_TYPE_FLOAT)
return false;
return true; return true;
} }
...@@ -2389,12 +2389,6 @@ class Item: public Value_source, ...@@ -2389,12 +2389,6 @@ class Item: public Value_source,
Checks if this item consists in the left part of arg IN subquery predicate Checks if this item consists in the left part of arg IN subquery predicate
*/ */
bool pushable_equality_checker_for_subquery(uchar *arg); bool pushable_equality_checker_for_subquery(uchar *arg);
bool is_number()
{
return (cmp_type() == INT_RESULT ||
cmp_type() == DECIMAL_RESULT ||
cmp_type() == REAL_RESULT);
}
bool is_deterministic_arg(); bool is_deterministic_arg();
}; };
......
...@@ -1027,22 +1027,6 @@ class Item_num_op :public Item_func_numhybrid ...@@ -1027,22 +1027,6 @@ class Item_num_op :public Item_func_numhybrid
set_handler(type_handler_long_or_longlong()); set_handler(type_handler_long_or_longlong());
} }
bool need_parentheses_in_default() { return true; } bool need_parentheses_in_default() { return true; }
bool is_deterministic_func()
{
Item *args0= args[0];
for (uint i= 0; i < arg_count; i++)
{
if (args[i]->field_type() == MYSQL_TYPE_FLOAT ||
args[i]->field_type() == MYSQL_TYPE_GEOMETRY ||
(args0->field_type() != MYSQL_TYPE_BIT &&
i != 0 &&
args[i]->field_type() == MYSQL_TYPE_BIT) ||
(args[i]->cmp_type() != args0->cmp_type() &&
(!args0->is_number() || !args[i]->is_number())))
return false;
}
return true;
}
}; };
......
...@@ -605,6 +605,8 @@ class Item_func_ltrim :public Item_func_trim ...@@ -605,6 +605,8 @@ class Item_func_ltrim :public Item_func_trim
const char *mode_name() const { return "leading"; } const char *mode_name() const { return "leading"; }
Item *get_copy(THD *thd) Item *get_copy(THD *thd)
{ return get_item_copy<Item_func_ltrim>(thd, this); } { return get_item_copy<Item_func_ltrim>(thd, this); }
bool is_deterministic_func()
{ return Item_args::has_deterministic_args(); }
}; };
......
...@@ -74,6 +74,7 @@ ...@@ -74,6 +74,7 @@
2. Contain non IS or FD fields from the left LEFT JOIN tables. 2. Contain non IS or FD fields from the left LEFT JOIN tables.
3. Contain no IS or FD fields from the left LEFT JOIN tables if the 3. Contain no IS or FD fields from the left LEFT JOIN tables if the
considered LEFT JOIN is not the most outer LEFT JOIN. considered LEFT JOIN is not the most outer LEFT JOIN.
4. Contain subquery.
3. From Virtual column definition. 3. From Virtual column definition.
...@@ -664,10 +665,11 @@ bool check_on_expr_and_get_equalities_info(FD_select_info *sl_info, ...@@ -664,10 +665,11 @@ bool check_on_expr_and_get_equalities_info(FD_select_info *sl_info,
return false; return false;
} }
if ((!sl_info->top_level && // 2 if ((!sl_info->top_level && // 2
!(on_expr->used_tables() & (~sl_info->cur_level_tabs))) || !(on_expr->used_tables() & (~sl_info->cur_level_tabs))) ||
((on_expr->used_tables() & (~sl_info->cur_level_tabs)) && // 3 ((on_expr->used_tables() & (~sl_info->cur_level_tabs)) && // 3
on_expr->walk(&Item::check_reject_fd_extraction_processor, 0, on_expr->walk(&Item::check_reject_fd_extraction_processor, 0,
&sl_info->cur_level_tabs))) &sl_info->cur_level_tabs)) ||
on_expr->with_subquery())
{ {
/* /*
Check that this ON expression doesn't contain Check that this ON expression doesn't contain
...@@ -1075,11 +1077,12 @@ bool are_select_fields_fd(st_select_lex *sl, List<Item> *gb_items, ...@@ -1075,11 +1077,12 @@ bool are_select_fields_fd(st_select_lex *sl, List<Item> *gb_items,
bool st_select_lex::check_func_dep() bool st_select_lex::check_func_dep()
{ {
DBUG_ENTER("st_select_lex::check_func_dep");
/* Stop if no tables are used or fake SELECT is processed. */ /* Stop if no tables are used or fake SELECT is processed. */
if (leaf_tables.is_empty() || if (leaf_tables.is_empty() ||
select_number == UINT_MAX || select_number == UINT_MAX ||
select_number == INT_MAX) select_number == INT_MAX)
return false; DBUG_RETURN(0);
bool need_check= (group_list.elements > 0) || bool need_check= (group_list.elements > 0) ||
(master_unit()->outer_select() && (master_unit()->outer_select() &&
...@@ -1097,7 +1100,8 @@ bool st_select_lex::check_func_dep() ...@@ -1097,7 +1100,8 @@ bool st_select_lex::check_func_dep()
} }
set_update_table_fields(this); /* UPDATE query processing. */ set_update_table_fields(this); /* UPDATE query processing. */
if (group_list.elements == 0 && !having) if (group_list.elements == 0 &&
!having && !agg_func_used())
{ {
/* /*
This SELECT has no GROUP BY clause and HAVING. This SELECT has no GROUP BY clause and HAVING.
...@@ -1111,31 +1115,29 @@ bool st_select_lex::check_func_dep() ...@@ -1111,31 +1115,29 @@ bool st_select_lex::check_func_dep()
bitmap_set_all(&tbl->table->tmp_set); bitmap_set_all(&tbl->table->tmp_set);
} }
if (!need_check) if (!need_check)
return false; DBUG_RETURN(0);
} }
List<Item> gb_items; List<Item> gb_items;
/* Collect fields from the GROUP BY of this SELECT. */ /* Collect fields from the GROUP BY of this SELECT. */
if (collect_gb_items(this, gb_items)) if (collect_gb_items(this, gb_items))
return true; DBUG_RETURN(1);
if (olap != UNSPECIFIED_OLAP_TYPE) if (olap != UNSPECIFIED_OLAP_TYPE)
{ {
table_map map= 0; table_map map= 0;
/* If ROLLUP is used don't expand FD fields set. */ /* If ROLLUP is used don't expand FD fields set. */
if (!are_select_fields_fd(this, &gb_items, map)) if (!are_select_fields_fd(this, &gb_items, map))
return true; DBUG_RETURN(1);
return false; DBUG_RETURN(0);
} }
List<Item_equal_fd_info> eq_info; List<Item_equal_fd_info> eq_info;
FD_select_info *sl_info= FD_select_info *sl_info=
new (join->thd->mem_root) FD_select_info(this, &eq_info, "WHERE clause"); new (join->thd->mem_root) FD_select_info(this, &eq_info, "WHERE clause");
if (expand_fdfs_with_top_join_tables_fields(sl_info)) if (expand_fdfs_with_top_join_tables_fields(sl_info) ||
return true; !are_select_fields_fd(this, &gb_items, sl_info->forbid_fd_expansion))
DBUG_RETURN(1);
if (!are_select_fields_fd(this, &gb_items, sl_info->forbid_fd_expansion))
return true;
return false; DBUG_RETURN(0);
} }
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