diff --git a/dbcon/mysql/ha_calpont_execplan.cpp b/dbcon/mysql/ha_calpont_execplan.cpp index ec886bd54..5e0905596 100644 --- a/dbcon/mysql/ha_calpont_execplan.cpp +++ b/dbcon/mysql/ha_calpont_execplan.cpp @@ -348,16 +348,13 @@ bool sortItemIsInGrouping(Item* sort_item, ORDER* groupcol) found = true; } - // An "if" function that contains an aggregate function + // A function that contains an aggregate function // can be included in the ORDER BY clause // e.g. select a, if (sum(b) > 1, 2, 1) from t1 group by 1 order by 2; if (sort_item->type() == Item::FUNC_ITEM) { Item_func *ifp = reinterpret_cast(sort_item); - if (string(ifp->func_name()) == "if") - { - ifp->traverse_cond(check_sum_func_item, &found, Item::POSTFIX); - } + ifp->traverse_cond(check_sum_func_item, &found, Item::POSTFIX); } for (; !found && groupcol; groupcol = groupcol->next) diff --git a/dbcon/mysql/ha_mcs_pushdown.cpp b/dbcon/mysql/ha_mcs_pushdown.cpp index d88e88738..659749e44 100644 --- a/dbcon/mysql/ha_mcs_pushdown.cpp +++ b/dbcon/mysql/ha_mcs_pushdown.cpp @@ -26,7 +26,8 @@ void mutate_optimizer_flags(THD *thd_) set_original_optimizer_flags(thd_->variables.optimizer_switch, thd_); thd_->variables.optimizer_switch = OPTIMIZER_SWITCH_IN_TO_EXISTS | OPTIMIZER_SWITCH_EXISTS_TO_IN | - OPTIMIZER_SWITCH_COND_PUSHDOWN_FOR_DERIVED; + OPTIMIZER_SWITCH_COND_PUSHDOWN_FOR_DERIVED | + OPTIMIZER_SWITCH_COND_PUSHDOWN_FROM_HAVING; } void restore_optimizer_flags(THD *thd_)