[MCOL-979] Crash with LEAD function in ColumnStore with 'char' field type Created: 2017-10-19 Updated: 2017-10-26 Resolved: 2017-10-26 |
|
| Status: | Closed |
| Project: | MariaDB ColumnStore |
| Component/s: | None |
| Affects Version/s: | 1.0.11 |
| Fix Version/s: | 1.0.12, 1.1.1 |
| Type: | Bug | Priority: | Major |
| Reporter: | Vicențiu Ciorbaru | Assignee: | Daniel Lee (Inactive) |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Sprint: | 2017-21 |
| Description |
|
Steps to reproduce: Install base columnstore package mariadb-columnstore-1.0.11-1-x86_64-stretch
|
| Comments |
| Comment by David Thompson (Inactive) [ 2017-10-24 ] |
|
verify if this is broken in 1.1 as may behave differently. |
| Comment by David Hall (Inactive) [ 2017-10-24 ] |
|
In the develop (which at this time equates to 1.1), the query does not crash, but it does throw an error: MariaDB [dhall]> select lead(b) over (order by a) from ct1; I thought this was affected by the presence of NULL in column b, but it turns out to throw regardless of the existence of a NULL value. |
| Comment by David Hall (Inactive) [ 2017-10-25 ] |
|
The error thrown in 1.1 is a further bug, preventing the execution of the crashing code. It was introduced to theoretically prevent a use of an uninitialized variable, but there is no use case yet for it. When LEAD(<char type>) is used, the default for un-found values is NULL, but assigning NULL to a string is not supported by std:string, at least not in the way it was used. So, the crash is still in 1.1, but masked. Removing the line that set the default (revert) is the best line of action here. The crash is caused by assigning an integer type to a void pointer and then reassigning the void pointer as a std::string. Not good. The function
checks for NULL and calls getNullValueByType(). Unfortunately setValue() expects a std::string for strings shorter than 9 bytes, but getNullValueByType() returns a 1,2,4, or 8 byte fixed buffer set to the NULL value for strings shorter than 9 bytes. getNullValueByType() is called from no where else, so modifying it to always return a string for all character types is safe and appears to work. |
| Comment by David Hall (Inactive) [ 2017-10-26 ] |
|
Pull requests |
| Comment by Andrew Hutchings (Inactive) [ 2017-10-26 ] |
|
Merged into 1.0 and 1.1. Also merged new regression test. |
| Comment by Daniel Lee (Inactive) [ 2017-10-26 ] |
|
Build verified: Github source for 1.0.12 /root/columnstore/mariadb-columnstore-server Merge pull request #69 from mariadb-corporation/ /root/columnstore/mariadb-columnstore-server/mariadb-columnstore-engine Merge pull request #304 from mariadb-corporation/ Build verified: Github source for 1.1.1 /root/columnstore/mariadb-columnstore-server Merge pull request #72 from mariadb-corporation/ /root/columnstore/mariadb-columnstore-server/mariadb-columnstore-engine Merge branch 'develop-1.1' of https://github.com/mariadb-corporation/mariadb-columnstore-engine into develop-1.1 Both crashing queries fixed in 1.0.12, but not in 1.1.1. In 1.1.1 The following query worked: But this query returned a syntax error. MariaDB [mytest]> select lead(b, 1, NULL) over (order by a) from ct1; We need to 1) Fix the syntax error |
| Comment by Daniel Lee (Inactive) [ 2017-10-26 ] |
|
Reopen per my last comment |
| Comment by David Hall (Inactive) [ 2017-10-26 ] |
|
For version 1.1, the third parameter (default value) is no longer supported. It was removed because of a merge with MariaDB 10.2, which doesn't support this parameter. Hopefully it will be supported by MariaDB in the near future, perhaps as soon as MariaDB 10.3. See |
| Comment by Daniel Lee (Inactive) [ 2017-10-26 ] |
|
Closed per last comments from Mr. Hall and myself. |