You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-29 08:21:15 +03:00
MCOL-4665 Move outer join to inner join conversion into the engine.
This is a subtask of MCOL-4525 Implement select_handler=AUTO. Server performs outer join to inner join conversion using simplify_joins() in sql/sql_select.cc, by updating the TABLE_LIST::outer_join variable. In order to perform this conversion, permanent changes are made in some cases to the SELECT_LEX::JOIN::conds and/or TABLE_LIST::on_expr. This is undesirable for MCOL-4525 which will attemp to fallback and execute the query inside the server, in case the query execution fails in ColumnStore using the select_handler. For a query such as: SELECT * FROM t1 LEFT JOIN t2 ON expr1 LEFT JOIN t3 ON expr2 In some cases, server can update the original SELECT_LEX::JOIN::conds and/or TABLE_LIST::on_expr and create new Item_cond_and objects (e.g. with 2 Item's expr1 and expr2 in Item_cond_and::list). Instead of making changes to the original query structs, we use gp_walk_info::tableOnExprList and gp_walk_info::condList. 2 Item's, expr1 and expr2, in the condList, mean Item_cond_and(expr1, expr2), and hence avoid permanent transformations to the SELECT_LEX. We also define a new member variable ha_columnstore_select_handler::tableOuterJoinMap which saves the original TABLE_LIST::outer_join values before they are updated. This member variable will be used later on to restore to the original state of TABLE_LIST::outer_join in case of a query fallback to server execution. The original simplify_joins() implementation in the server also performs a flattening of the JOIN nest, however we don't perform this operation in convertOuterJoinToInnerJoin() since it is not required for ColumnStore.
This commit is contained in:
@ -4679,8 +4679,8 @@ int ha_mcs_impl_pushdown_init(mcs_handler_info* handler_info, TABLE* table)
|
||||
sm::cpsm_conhdl_t* hndl;
|
||||
SCSEP csep;
|
||||
// Declare handlers ptrs in this scope for future use.
|
||||
select_handler* sh = nullptr;
|
||||
derived_handler* dh = nullptr;
|
||||
ha_columnstore_select_handler* sh = nullptr;
|
||||
ha_columnstore_derived_handler* dh = nullptr;
|
||||
|
||||
// update traceFlags according to the autoswitch state.
|
||||
ci->traceFlags = (ci->traceFlags | CalpontSelectExecutionPlan::TRACE_TUPLE_OFF)^
|
||||
@ -4774,12 +4774,12 @@ int ha_mcs_impl_pushdown_init(mcs_handler_info* handler_info, TABLE* table)
|
||||
int status = 42;
|
||||
if (handler_info->hndl_type == mcs_handler_types_t::SELECT)
|
||||
{
|
||||
sh = reinterpret_cast<select_handler*>(handler_info->hndl_ptr);
|
||||
sh = reinterpret_cast<ha_columnstore_select_handler*>(handler_info->hndl_ptr);
|
||||
status = cs_get_select_plan(sh, thd, csep, gwi);
|
||||
}
|
||||
else if (handler_info->hndl_type == DERIVED)
|
||||
{
|
||||
dh = reinterpret_cast<derived_handler*>(handler_info->hndl_ptr);
|
||||
dh = reinterpret_cast<ha_columnstore_derived_handler*>(handler_info->hndl_ptr);
|
||||
status = cs_get_derived_plan(dh, thd, csep, gwi);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user