diff options
author | Igor Babaev <igor@askmonty.org> | 2013-11-24 20:45:16 -0800 |
---|---|---|
committer | Igor Babaev <igor@askmonty.org> | 2013-11-24 20:45:16 -0800 |
commit | 998ed51497ae46b2478d490e22cccd16295701f8 (patch) | |
tree | 31d7a46a062af97b59c7aab8c5d17c664ae74866 | |
parent | 59f099dda1d8dfae2a2f49c189d7e23ac73de016 (diff) | |
download | mariadb-git-998ed51497ae46b2478d490e22cccd16295701f8.tar.gz |
Made sure that JOIN::cond_equal is correctly set after the call of
remove_eq_conds() in the function make_join_statistics().
-rw-r--r-- | sql/sql_select.cc | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 1d919d78508..43f70b80557 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -3543,6 +3543,21 @@ make_join_statistics(JOIN *join, List<TABLE_LIST> &tables_list, conds=new Item_int((longlong) 0,1); } join->conds= conds; + join->cond_equal= NULL; + if (conds) + { + if (conds->type() == Item::COND_ITEM && + ((Item_cond*) conds)->functype() == Item_func::COND_AND_FUNC) + join->cond_equal= (&((Item_cond_and *) conds)->cond_equal); + else if (conds->type() == Item::FUNC_ITEM && + ((Item_func*) conds)->functype() == Item_func::MULT_EQUAL_FUNC) + { + if (!join->cond_equal) + join->cond_equal= new COND_EQUAL; + join->cond_equal->current_level.empty(); + join->cond_equal->current_level.push_back((Item_equal*) conds); + } + } } /* Calc how many (possible) matched records in each table */ @@ -3656,6 +3671,19 @@ make_join_statistics(JOIN *join, List<TABLE_LIST> &tables_list, if (join->const_tables != join->table_count) optimize_keyuse(join, keyuse_array); + DBUG_ASSERT(!join->conds || !join->cond_equal || + !join->cond_equal->current_level.elements || + (join->conds->type() == Item::COND_ITEM && + ((Item_cond*) (join->conds))->functype() == + Item_func::COND_AND_FUNC && + join->cond_equal == + &((Item_cond_and *) (join->conds))->cond_equal) || + (join->conds->type() == Item::FUNC_ITEM && + ((Item_func*) (join->conds))->functype() == + Item_func::MULT_EQUAL_FUNC && + join->cond_equal->current_level.elements == 1 && + join->cond_equal->current_level.head() == join->conds)); + if (optimize_semijoin_nests(join, all_table_map)) DBUG_RETURN(TRUE); /* purecov: inspected */ |