mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Fix LP BUG#680058
Analysis: The send_data method of the result sink class used to collect data statistics about materialized subqueries incorrectly assumed that duplicate rows are removed prior to calling send_data. As a result the collected statistics was wrong, which resulted in an incorrect maximal number of keys in the Ordered_key buffer. Solution: Try to insert each row into the materialized temp table before collecting statistics, and if the insertion results in a duplicate row, do not count the current row.
This commit is contained in:
@ -3057,6 +3057,13 @@ bool select_materialize_with_stats::send_data(List<Item> &items)
|
||||
Column_statistics *cur_col_stat= col_stat;
|
||||
uint nulls_in_row= 0;
|
||||
|
||||
if (select_union::send_data(items))
|
||||
return 1;
|
||||
/* Skip duplicate rows. */
|
||||
if (write_err == HA_ERR_FOUND_DUPP_KEY ||
|
||||
write_err == HA_ERR_FOUND_DUPP_UNIQUE)
|
||||
return 0;
|
||||
|
||||
++count_rows;
|
||||
|
||||
while ((cur_item= item_it++))
|
||||
@ -3074,7 +3081,7 @@ bool select_materialize_with_stats::send_data(List<Item> &items)
|
||||
if (nulls_in_row > max_nulls_in_row)
|
||||
max_nulls_in_row= nulls_in_row;
|
||||
|
||||
return select_union::send_data(items);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user