MDEV-26013 distinct not work properly in some cases for spider tables
The bug is caused by the following reasons: * spider_group_by_handler::init_scan() generates a query for a data node. * The function adds DISTINCT if and only if spider_group_by_handler::query::distinct is TRUE. * spider_group_by_handler::query::distinct is set to the value of JOIN::select_distinct in JOIN::make_aggr_tables_info(). * In the test case, DISTINCT is not added because JOIN::select_distinct is FALSE at the call of JOIN::make_aggr_tables_info(). Why JOIN::select_distinct is set to FALSE? That is because the function JOIN::optimize_stage2() convert DISTINCT into GROUP BY and then optimizes away GROUP BY.
Showing
Please register or sign in to comment