diff options
author | Sergey Petrunya <psergey@askmonty.org> | 2010-01-17 17:51:10 +0300 |
---|---|---|
committer | Sergey Petrunya <psergey@askmonty.org> | 2010-01-17 17:51:10 +0300 |
commit | b83cb52e9e78a0d07c05f6515aa7811deabe434c (patch) | |
tree | aa289e64cb57964bd08fc79d326136cb801e1da7 /sql/item_cmpfunc.h | |
parent | 1a490f2da492f2e5698b244341696c6dd9d8db4c (diff) | |
download | mariadb-git-b83cb52e9e78a0d07c05f6515aa7811deabe434c.tar.gz |
Backport of subquery optimizations to 5.3.
There are still test failures because of:
- Wrong query results in outer join + semi join
- EXPLAIN output differences
Diffstat (limited to 'sql/item_cmpfunc.h')
-rw-r--r-- | sql/item_cmpfunc.h | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index 23f505182dd..d093cf613f8 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -460,13 +460,23 @@ public: class Item_func_eq :public Item_bool_rowready_func2 { public: - Item_func_eq(Item *a,Item *b) :Item_bool_rowready_func2(a,b) {} + Item_func_eq(Item *a,Item *b) : + Item_bool_rowready_func2(a,b), in_equality_no(UINT_MAX) + {} longlong val_int(); enum Functype functype() const { return EQ_FUNC; } enum Functype rev_functype() const { return EQ_FUNC; } cond_result eq_cmp_result() const { return COND_TRUE; } const char *func_name() const { return "="; } Item *negated_item(); + /* + - If this equality is created from the subquery's IN-equality: + number of the item it was created from, e.g. for + (a,b) IN (SELECT c,d ...) a=c will have in_equality_no=0, + and b=d will have in_equality_no=1. + - Otherwise, UINT_MAX + */ + uint in_equality_no; }; class Item_func_equal :public Item_bool_rowready_func2 @@ -1462,6 +1472,7 @@ public: bool add_at_head(Item *item) { return list.push_front(item); } void add_at_head(List<Item> *nlist) { list.prepand(nlist); } bool fix_fields(THD *, Item **ref); + void fix_after_pullout(st_select_lex *new_parent, Item **ref); enum Type type() const { return COND_ITEM; } List<Item>* argument_list() { return &list; } @@ -1595,6 +1606,9 @@ public: virtual void print(String *str, enum_query_type query_type); CHARSET_INFO *compare_collation() { return fields.head()->collation.collation; } + friend Item *eliminate_item_equal(COND *cond, COND_EQUAL *upper_levels, + Item_equal *item_equal); + friend bool setup_sj_materialization(struct st_join_table *tab); }; class COND_EQUAL: public Sql_alloc |