1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-30 19:23:07 +03:00

chore(connector): remove unused and disabled group by handler (#3481)

This commit is contained in:
drrtuy
2025-04-04 21:27:07 +01:00
committed by GitHub
parent 72480e512c
commit 6b8adb822b
10 changed files with 2 additions and 2763 deletions

View File

@ -360,101 +360,6 @@ bool check_user_var(SELECT_LEX* select_lex)
return is_user_var_func;
}
/*@brief create_columnstore_group_by_handler- Creates handler*/
/***********************************************************
* DESCRIPTION:
* Creates a group_by pushdown handler if there is no:
* non-equi JOIN, e.g * t1.c1 > t2.c2
* logical OR in the filter predicates
* Impossible WHERE
* Impossible HAVING
* 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
* PARAMETERS:
* thd - THD pointer
* query - Query structure LFM in group_by_handler.h
* RETURN:
* group_by_handler if success
* NULL in other case
***********************************************************/
group_by_handler* create_columnstore_group_by_handler(THD* thd, Query* query)
{
ha_mcs_group_by_handler* handler = NULL;
// Disable GBH.
return handler;
// same as thd->lex->current_select
SELECT_LEX* select_lex = query->from->select_lex;
// MCOL-2178 Disable SP support in the group_by_handler for now
// Check the session variable value to enable/disable use of
// group_by_handler. There is no GBH if SH works for the query.
if ((get_select_handler_mode(thd) == mcs_select_handler_mode_t::ON) || !get_group_by_handler(thd) ||
(thd->lex)->sphead)
{
return handler;
}
// Create a handler if query is valid. See comments for details.
if (query->group_by || select_lex->with_sum_func)
{
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
if (!unsupported_feature &&
(select_lex->having_value == Item::COND_FALSE || select_lex->cond_value == Item::COND_FALSE))
{
unsupported_feature = true;
}
// Unsupported JOIN conditions
if (!unsupported_feature)
{
JOIN* join = select_lex->join;
if (unsupported_feature == false && join && join->conds)
{
join->conds->traverse_cond(check_walk, &unsupported_feature, Item::POSTFIX);
}
if (unsupported_feature == false && select_lex->where)
{
select_lex->where->traverse_cond(check_walk, &unsupported_feature, Item::POSTFIX);
}
}
// Iterate and traverse through the item list and the JOIN cond
// and do not create GBH if the unsupported (set_user_var)
// function is present.
if (check_user_var(select_lex))
{
return handler;
}
} // unsupported features check ends here
if (!unsupported_feature)
{
handler = new ha_mcs_group_by_handler(thd, query);
// Notify the server, that CS handles GROUP BY, ORDER BY and HAVING clauses.
query->group_by = NULL;
query->order_by = NULL;
query->having = NULL;
}
}
return handler;
}
/*@brief create_columnstore_derived_handler- Creates handler*/
/************************************************************
* DESCRIPTION:
@ -644,79 +549,6 @@ void ha_columnstore_derived_handler::print_error(int, unsigned long)
{
}
/***********************************************************
* DESCRIPTION:
* GROUP BY handler constructor
* PARAMETERS:
* thd - THD pointer.
* query - Query describing structure
***********************************************************/
ha_mcs_group_by_handler::ha_mcs_group_by_handler(THD* thd_arg, Query* query)
: group_by_handler(thd_arg, mcs_hton)
, select(query->select)
, table_list(query->from)
, distinct(query->distinct)
, where(query->where)
, group_by(query->group_by)
, order_by(query->order_by)
, having(query->having)
{
const char* timeZone = thd_arg->variables.time_zone->get_name()->ptr();
dataconvert::timeZoneToOffset(timeZone, strlen(timeZone), &time_zone);
}
/***********************************************************
* DESCRIPTION:
* GROUP BY destructor
***********************************************************/
ha_mcs_group_by_handler::~ha_mcs_group_by_handler()
{
}
/***********************************************************
* DESCRIPTION:
* Makes the plan and prepares the data
* RETURN:
* int rc
***********************************************************/
int ha_mcs_group_by_handler::init_scan()
{
DBUG_ENTER("ha_mcs_group_by_handler::init_scan");
mcs_handler_info mhi = mcs_handler_info(reinterpret_cast<void*>(this), GROUP_BY);
int rc = ha_mcs_impl_group_by_init(&mhi, table);
DBUG_RETURN(rc);
}
/***********************************************************
* DESCRIPTION:
* Fetches a row and saves it to a temporary table.
* RETURN:
* int rc
***********************************************************/
int ha_mcs_group_by_handler::next_row()
{
DBUG_ENTER("ha_mcs_group_by_handler::next_row");
int rc = ha_mcs_impl_group_by_next(table, time_zone);
DBUG_RETURN(rc);
}
/***********************************************************
* DESCRIPTION:
* Shuts the scan down.
* RETURN:
* int rc
***********************************************************/
int ha_mcs_group_by_handler::end_scan()
{
DBUG_ENTER("ha_mcs_group_by_handler::end_scan");
int rc = ha_mcs_impl_group_by_end(table);
DBUG_RETURN(rc);
}
/*@brief create_columnstore_select_handler_- Creates handler
************************************************************
* DESCRIPTION: