[MDEV-14520] Custom aggregate functions work incorrectly with WITH ROLLUP clause Created: 2017-11-28 Updated: 2018-05-19 Resolved: 2018-05-19 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Data Definition - Procedure, Stored routines |
| Affects Version/s: | 10.3 |
| Fix Version/s: | 10.3.7 |
| Type: | Bug | Priority: | Critical |
| Reporter: | Elena Stepanova | Assignee: | Varun Gupta (Inactive) |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||
| Sprint: | 10.3.6-1 | ||||||||
| Description |
|
Note: The agg_sum function definition is taken as is from main.aggregate_functions test.
|
| Comments |
| Comment by Varun Gupta (Inactive) [ 2017-11-30 ] | |||||||
|
Currently the main reason for the incorrect results in case of use of rollup in custom aggregate functions that in the function JOIN::rollup_make_fields, it says that create copies of item_sum items for each sum level, currently copy_or_same() function is missing from custom aggregate functions. This function would basically create a copy of custom aggregate functions Item_sum_sp object when we do rollup | |||||||
| Comment by Varun Gupta (Inactive) [ 2018-05-17 ] | |||||||
|
Patch | |||||||
| Comment by Vicențiu Ciorbaru [ 2018-05-18 ] | |||||||
|
One comment then OK to push once buildbot clears the tests:
init_result_field should take ©_item->null_value and ©_item->name, otherwise we're using the previous item's fields null_value. There is no apparent bug as the with rollup execution happens after the parent's item values have been computed, but you are reusing the parent item's null_value field instead of the child's. | |||||||
| Comment by Vicențiu Ciorbaru [ 2018-05-18 ] | |||||||
|
OK to push once the comment has been addressed. |