[MCOL-807] HOUR() function returns NULL when it should not Created: 2017-07-10 Updated: 2018-06-14 Resolved: 2018-06-14 |
|
| Status: | Closed |
| Project: | MariaDB ColumnStore |
| Component/s: | MariaDB Server |
| Affects Version/s: | 1.0.9 |
| Fix Version/s: | 1.2.0 |
| Type: | Bug | Priority: | Major |
| Reporter: | Marc Ballarin | Assignee: | Daniel Lee (Inactive) |
| Resolution: | Fixed | Votes: | 1 |
| Labels: | None | ||
| Issue Links: |
|
||||||||
| Epic Link: | ColumnStore Compatibility Improvements | ||||||||
| Sprint: | 2018-12 | ||||||||
| Description |
|
Hi, the following query returns NULL when run on a table with engine Columnstore and the correct result when run on an identical table with engine Aria:
Strangely, omitting HOUR() works correctly:
|
| Comments |
| Comment by David Thompson (Inactive) [ 2017-07-12 ] | ||||||||||||
|
The columnstore distributed version of timediff currently returns the value as a string since the time datatype is not yet supported. The columnstore distributed hour function assumes a string should be converted as a datetime value and so a time values is not considered valid so it ends up null. Likely this should be fixed when time datatype is added. As a workaround you could potentially instead use string manipulation functions to extract the hour portion? | ||||||||||||
| Comment by Marc Ballarin [ 2017-07-18 ] | ||||||||||||
|
FYI, I ended up using SUBSTRING_INDEX(TIMEDIFF(...), ':', 1). This works in both cases. | ||||||||||||
| Comment by Andrew Hutchings (Inactive) [ 2018-05-01 ] | ||||||||||||
|
This is fixed as part of | ||||||||||||
| Comment by Daniel Lee (Inactive) [ 2018-05-29 ] | ||||||||||||
|
Build tested: 1.2.0-1 source /root/columnstore/mariadb-columnstore-server Merge pull request #107 from mariadb-corporation/dev-merge-up-20180409 Dev merge up 20180409 /root/columnstore/mariadb-columnstore-server/mariadb-columnstore-engine Merge pull request #472 from drrtuy/ ColumnStore returned negative hours and both aris and innodb return a positive hour numbers. All three table types did return a negative time stamp by TIMEDIFF(MAX(ts), now()). So is it a bug in the server or in the Columnstore? From what I read, it is pointing to a bug in ColumnStore. [root@localhost ~]# mcsmysql mytest Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [mytest]> CREATE TABLE test_stats1 ( MariaDB [mytest]> CREATE TABLE test_stats2 ( MariaDB [mytest]> MariaDB [mytest]> INSERT INTO test_stats2 VALUES ('2017-07-07 12:00:00'); MariaDB [mytest]> SELECT HOUR(TIMEDIFF(MAX(ts), now())) FROM test_stats1;
--------------------------------
-------------------------------- MariaDB [mytest]> SELECT HOUR(TIMEDIFF(MAX(ts), now())) FROM test_stats2;
--------------------------------
-------------------------------- MariaDB [mytest]> SELECT MAX(ts), TIMEDIFF(MAX(ts), now()) FROM test_stats2;
--------------------
-------------------- MariaDB [mytest]> SELECT MAX(ts), TIMEDIFF(MAX(ts), now()) FROM test_stats1;
--------------------
-------------------- Tried query from the literal date and it also returned positive numbers. That's because the front end evaluated the hour(). | ||||||||||||
| Comment by Andrew Hutchings (Inactive) [ 2018-06-04 ] | ||||||||||||
|
Pull request for engine and regression suite. Now HOUR() returns positive time only. Also updated MariaDB Server's documentation to express this behaviour. | ||||||||||||
| Comment by Daniel Lee (Inactive) [ 2018-06-14 ] | ||||||||||||
|
Build verified: 1.2.0-1 source /root/columnstore/mariadb-columnstore-server Merge pull request #119 from mariadb-corporation/1.1-merge-up-20180531 Merge develop-1.1 into develop /root/columnstore/mariadb-columnstore-server/mariadb-columnstore-engine Merge pull request #494 from mariadb-corporation/ |