mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
MDEV-26337: subquery with groupby and ROLLUP returns incorrect results on LEFT JOIN on INDEXED values
Disable LATERAL DERIVED optimization for subqueries that have WITH ROLLUP. This bug could affect queries with grouping derived tables / views / CTEs with ROLLUP. The bug could manifest itself if the corresponding materialized derived tables are subject to split optimization. The current implementation of the split optimization produces rows from the derived table in an arbitrary order. So these rows must be accumulated in another temporary table and sorted according to the used GROUP BY clause in order to be able to generate the additional ROLLUP rows. This patch prohibits to use split optimization for grouping derived tables / views / CTEs with ROLLUP.
This commit is contained in:
@ -310,6 +310,8 @@ struct SplM_field_ext_info: public SplM_field_info
|
||||
occurred also in the select list of this join
|
||||
9. There are defined some keys usable for ref access of fields from C
|
||||
with available statistics.
|
||||
10. The select doesn't use WITH ROLLUP (This limitation can probably be
|
||||
lifted)
|
||||
|
||||
@retval
|
||||
true if the answer is positive
|
||||
@ -326,7 +328,8 @@ bool JOIN::check_for_splittable_materialized()
|
||||
(unit->first_select()->next_select()) || // !(3)
|
||||
(derived->prohibit_cond_pushdown) || // !(4)
|
||||
(derived->is_recursive_with_table()) || // !(5)
|
||||
(table_count == 0 || const_tables == top_join_tab_count)) // !(6)
|
||||
(table_count == 0 || const_tables == top_join_tab_count) || // !(6)
|
||||
rollup.state != ROLLUP::STATE_NONE) // (10)
|
||||
return false;
|
||||
if (group_list) // (7.1)
|
||||
{
|
||||
|
Reference in New Issue
Block a user