-
Steinar H. Gunderson authored
Bug #30921780: ROLLUP OUTPUT IS NOT REASONABLE WHEN SAME FIELDS EXIST IN THE GROUP BY SYNTAX Bug #26227613: REPEATING COLUMN IN GROUP BY WITH ROLLUP YIELDS WRONG RESULT Bug #29134467: REFACTOR RECURSION IN RESOLVE_ROLLUP_ITEM TO USE ITEM_TRANSFORM Bug #30967158: THE ROLLUP SUPER-AGGREGATE ROW OUTPUT IS NOT CORRECT Reimplement rollup without using any slices at all. This is both an important step on the way towards removing the slice system entirely, and a simplification in its own right. Instead of using slices and refs, we introduce special items during resolving that operate differently depending on which rollup level we are on; there is one for group items and one for sums. (The AggregateIterator has a list of relevant Items, and signals them when switching rollup level.) The biggest challenge is keeping these correct during creation of temporary tables; the techniques we introduce (mostly various walks down the Item trees) may very well be important to remove slices in other places, too. There are some rollup items that are left in the lower temporary tables where they could have been removed, but they are generally harmless. The concepts of overlapping arrays of sum_funcs (with sum_func_end) is no longer needed and has been removed. Similarly, the special item for rollup constants is gone. copy_sum_funcs() was only ever used by AggregateIterator, and has been moved into a private member function. Since we now explicitly resolve fields in the SELECT list to group items, and have a central place for doing so (SELECT_LEX::find_in_group_list), it is easy to change the resolver rules. We use this to change the resolving of aliases to prioritize matches to group items to the same alias, to give slightly more logical behavior when there are repeated group items; there are illegal queries as per the SQL standard, and we explicitly make no guarantee as of future behavior, but we now match what 5.7 did, after 8.0.11 changed the behavior. Change-Id: I3485d18f3f0671f9dcda8509322f313b4b10307a
Steinar H. Gunderson authoredBug #30921780: ROLLUP OUTPUT IS NOT REASONABLE WHEN SAME FIELDS EXIST IN THE GROUP BY SYNTAX Bug #26227613: REPEATING COLUMN IN GROUP BY WITH ROLLUP YIELDS WRONG RESULT Bug #29134467: REFACTOR RECURSION IN RESOLVE_ROLLUP_ITEM TO USE ITEM_TRANSFORM Bug #30967158: THE ROLLUP SUPER-AGGREGATE ROW OUTPUT IS NOT CORRECT Reimplement rollup without using any slices at all. This is both an important step on the way towards removing the slice system entirely, and a simplification in its own right. Instead of using slices and refs, we introduce special items during resolving that operate differently depending on which rollup level we are on; there is one for group items and one for sums. (The AggregateIterator has a list of relevant Items, and signals them when switching rollup level.) The biggest challenge is keeping these correct during creation of temporary tables; the techniques we introduce (mostly various walks down the Item trees) may very well be important to remove slices in other places, too. There are some rollup items that are left in the lower temporary tables where they could have been removed, but they are generally harmless. The concepts of overlapping arrays of sum_funcs (with sum_func_end) is no longer needed and has been removed. Similarly, the special item for rollup constants is gone. copy_sum_funcs() was only ever used by AggregateIterator, and has been moved into a private member function. Since we now explicitly resolve fields in the SELECT list to group items, and have a central place for doing so (SELECT_LEX::find_in_group_list), it is easy to change the resolver rules. We use this to change the resolving of aliases to prioritize matches to group items to the same alias, to give slightly more logical behavior when there are repeated group items; there are illegal queries as per the SQL standard, and we explicitly make no guarantee as of future behavior, but we now match what 5.7 did, after 8.0.11 changed the behavior. Change-Id: I3485d18f3f0671f9dcda8509322f313b4b10307a
Loading