[MCOL-683] ADDDATE & DATE_FORMAT combo breaks datetime Created: 2017-04-25 Updated: 2017-05-15 Resolved: 2017-05-04 |
|
| Status: | Closed |
| Project: | MariaDB ColumnStore |
| Component/s: | None |
| Affects Version/s: | 1.0.8 |
| Fix Version/s: | 1.0.9, 1.1.0 |
| Type: | Bug | Priority: | Major |
| Reporter: | Geoff Cleaves | Assignee: | Daniel Lee (Inactive) |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Environment: |
centos7 |
||
| Sprint: | 2017-9 |
| Description |
|
Tableau generated queries which manipulate dates are broken in Columnstore but worked in InfiniDB. In the query below you can see that the first column "breaks" in that the returned value is not a date. Query example:
|
| Comments |
| Comment by Andrew Hutchings (Inactive) [ 2017-04-25 ] | ||||||||||||
|
Cause is MariaDB tells the engine DATE_ADD/ADDDATE is 3 byte UTF8 and we are handling the length as if it is 1 byte. So we truncate at 1/3rd of the length. | ||||||||||||
| Comment by Andrew Hutchings (Inactive) [ 2017-04-25 ] | ||||||||||||
|
Pull requests open for develop and develop-1.0 as well as regression suite. For testing:
Then the queries in the example, on failure the first column will have a date truncated at 6 chars. Also regression suite changes cover this. | ||||||||||||
| Comment by Daniel Lee (Inactive) [ 2017-05-04 ] | ||||||||||||
|
[root@localhost mariadb-columnstore-server]# git show Reproduced the issue in 1.0.8-1
-------------
------------- The same query in 1.1.0-1 returned:
--------------------
-------------------- | ||||||||||||
| Comment by Daniel Lee (Inactive) [ 2017-05-04 ] | ||||||||||||
|
Build verified: Github source [root@localhost mariadb-columnstore-server]# git show Merge pull request #49 from mariadb-corporation/ [root@localhost mariadb-columnstore-server]# cd mariadb-columnstore-engine/ Merge pull request #159 from mariadb-corporation/ Also verified the fix in 1.0.9-1 Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [mytest]> CREATE TABLE `columnstore_table` ( MariaDB [mytest]> INSERT INTO columnstore_table values (1, '2017-04-25'); MariaDB [mytest]> SELECT ADDDATE(DATE_FORMAT(datecol, '%Y-%m-%d %H:00:00'), INTERVAL 0 SECOND) AS `tableau_date`, cast(ADDDATE(DATE_FORMAT(datecol, '%Y-%m-%d %H:00:00'), INTERVAL 0 SECOND) as datetime) AS `casted_date`, datecol as raw_date FROM columnstore_table WHERE datecol <= CURRENT_DATE();
--------------------
-------------------- | ||||||||||||
| Comment by Geoff Cleaves [ 2017-05-15 ] | ||||||||||||
|
Just noticed a problem which may be related: select least(max(datefield),cast('2000-01-01' as datetime)) from cstable when the expected value is the maximum date in the column. | ||||||||||||
| Comment by Andrew Hutchings (Inactive) [ 2017-05-15 ] | ||||||||||||
|
Hi Geoff, That will be a completely separate problem. Can you please file a new bug report for this with some test data? |