1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-08-07 03:22:57 +03:00

MCOL-2165 This disables correlated subqueries processing in group_by_nahdler

handing the query back to the server.
This commit is contained in:
Roman Nozdrin
2019-02-14 13:58:48 +03:00
parent e849af0ce6
commit eef813982c

View File

@@ -1231,11 +1231,14 @@ void check_walk(const Item* item, void* arg)
* logical OR in the filter predicates * logical OR in the filter predicates
* Impossible WHERE * Impossible WHERE
* Impossible HAVING * Impossible HAVING
* Valid queries with the last two crashes the server if processed. * and there is either GROUP BY or aggregation function
* exists at the top level.
* Valid queries with the last two crashes the server if
* processed.
* Details are in server/sql/group_by_handler.h * Details are in server/sql/group_by_handler.h
* PARAMETERS: * PARAMETERS:
* thd - THD pointer. * thd - THD pointer
* query - Query structure, that describes the pushdowned query. * query - Query structure LFM in group_by_handler.h
* RETURN: * RETURN:
* group_by_handler if success * group_by_handler if success
* NULL in other case * NULL in other case
@@ -1254,15 +1257,22 @@ create_calpont_group_by_handler(THD* thd, Query* query)
&& ( query->group_by || select_lex->with_sum_func ) ) && ( query->group_by || select_lex->with_sum_func ) )
{ {
bool unsupported_feature = false; bool unsupported_feature = false;
// revisit SELECT_LEX for all units
for(TABLE_LIST* tl = query->from; !unsupported_feature && tl; tl = tl->next_global)
{
select_lex = tl->select_lex;
// Correlation subquery. Comming soon so fail on this yet.
unsupported_feature = select_lex->is_correlated;
// Impossible HAVING or WHERE // Impossible HAVING or WHERE
if ( ( query->having && select_lex->having_value == Item::COND_FALSE ) if ( ( !unsupported_feature && query->having && select_lex->having_value == Item::COND_FALSE )
|| ( select_lex->cond_count > 0 || ( select_lex->cond_count > 0
&& select_lex->cond_value == Item::COND_FALSE ) ) && select_lex->cond_value == Item::COND_FALSE ) )
{ {
unsupported_feature = true; unsupported_feature = true;
} }
// Unsupported conditions check. // Unsupported JOIN conditions
if ( !unsupported_feature ) if ( !unsupported_feature )
{ {
JOIN *join = select_lex->join; JOIN *join = select_lex->join;
@@ -1276,8 +1286,20 @@ create_calpont_group_by_handler(THD* thd, Query* query)
{ {
icp->traverse_cond(check_walk, &unsupported_feature, Item::POSTFIX); icp->traverse_cond(check_walk, &unsupported_feature, Item::POSTFIX);
} }
// Optimizer could move some join conditions into where
if (select_lex->where != 0)
icp = reinterpret_cast<Item_cond*>(select_lex->where);
if ( unsupported_feature == false
&& icp )
{
icp->traverse_cond(check_walk, &unsupported_feature, Item::POSTFIX);
} }
}
} // unsupported features check ends here
if ( !unsupported_feature ) if ( !unsupported_feature )
{ {
handler = new ha_calpont_group_by_handler(thd, query); handler = new ha_calpont_group_by_handler(thd, query);