[MDEV-16842] Extended SELECT list contains unusable Item_func_sum when GROUP BY handler is used Created: 2018-07-27 Updated: 2018-08-30 Resolved: 2018-08-14 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Optimizer |
| Affects Version/s: | 10.2.15 |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Minor |
| Reporter: | Roman | Assignee: | Oleksandr Byelkin |
| Resolution: | Not a Bug | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||
| Description |
|
Given a query
There are two elements in the extended SELECT that GROUP BY handler receives: Item_sum for sum(i) and Item_func_sum for sum(i)+1. Item_func_sum has Item_ref as its first argument. In the moment of the query execution this Item_ref references Item_temptable_field. Item_temptable_field corresponds with Item_sum in the SELECT list. This Item_temptable_field has a name attribute = "sum(i)" if the server code is built w/o DBUG_OFF. If DBUG_OFF is present there is no way to correlate this Item_temptable_field with Item_sum that is used by Columnstore semantic parser. Here is the place in sql_select.cc that populates the name attribute in a debug build. Columnstore symantic parser needs a way to correlate this two fields while parsing a query. My suggestion is to remove preprocessor condition if this is cheap in terms of processing overhead. |
| Comments |
| Comment by Oleksandr Byelkin [ 2018-08-06 ] |
|
It is not a bug, it is how split_sum_func work, it add hidden fields and put reference on them. |
| Comment by Oleksandr Byelkin [ 2018-08-06 ] |
|
Please reopen if you still think that something is wrong, but than I need more explanations what is wrong, |
| Comment by Roman [ 2018-08-13 ] |
|
Please tell me how to find a corresponding Item_func_sum in an extended SELECT list for the mentioned query select sum |
| Comment by Roman [ 2018-08-14 ] |
|
Got an explanation how to correlate Item_field that represents aggregate function with an actual field in an extended SELECT list. |