[MCOL-1676] AVG as Window function with OVER(sort by) gives bad answer. Created: 2018-08-27 Updated: 2018-12-22 Resolved: 2018-12-22 |
|
| Status: | Closed |
| Project: | MariaDB ColumnStore |
| Component/s: | ExeMgr |
| Affects Version/s: | 1.1.5 |
| Fix Version/s: | 1.1.7 |
| Type: | Bug | Priority: | Major |
| Reporter: | David Hall (Inactive) | Assignee: | Patrick LeBlanc (Inactive) |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Sprint: | 2018-16, 2018-17, 2018-18, 2018-19, 2018-20, 2018-21 |
| Description |
|
Consider the following from a ref database:
--------------------
-------------------- From Columnstore 1.2:
--------------------
-------------------- From Columnstore 1.1:
--------------------
-------------------- |
| Comments |
| Comment by David Hall (Inactive) [ 2018-11-29 ] |
|
Setting the value into the output row involves typecasting a portion of the buffer to the type being set. So no compiler type conversions are applied. WindowFunctionType::setValue() sets the value based on the input data type. If the output data type is different, then the assignment puts the bits in the wrong place. In the case of INT and UINT, this isn't a problem because regardless of the int size, by the time it gets here it's either int64_t or uint64_t and it works. However, aggregates like to put floating point values into double, so we have an input of float and an output of double. Since all this is templated based on the input data type, we need to override the template type in WindowFunctionType::setValue() to call the proper setvalue(i, v) templated type. Fine, but a separate specialization must be made for string, or the compiler barfs. |
| Comment by David Hall (Inactive) [ 2018-12-11 ] |
|
The problem has been around since InfiniDB 3.3. It only manifests if an aggregate as Window function is applied to a FLOAT. |
| Comment by David Hall (Inactive) [ 2018-12-11 ] |
|
Test. You can apply any aggregate as WIndow Function to a FLOAT type and check against a know reference. Example: (This query has been added to the regression tests) |
| Comment by David Hall (Inactive) [ 2018-12-13 ] |
|
Added ref file |