[MCOL-719] Unexpected results using LEAST or GREATEST on aggregate Created: 2017-05-16  Updated: 2017-05-31  Resolved: 2017-05-31

Status: Closed
Project: MariaDB ColumnStore
Component/s: None
Affects Version/s: 1.0.8
Fix Version/s: 1.0.10, 1.1.0

Type: Bug Priority: Minor
Reporter: Geoff Cleaves Assignee: Daniel Lee (Inactive)
Resolution: Fixed Votes: 0
Labels: None

Sprint: 2017-10, 2017-11

 Description   

select least(min(action_date),cast('2000-01-01' as datetime)) from test; 

results in 0000-00-00 00:00:00 when it should be '1999-01-01'.

CREATE TABLE `test` (
  `action_date` date NOT NULL
) ENGINE=InfiniDB;
insert into test (action_date) values ('1999-01-01');
insert into test (action_date) values ('2020-01-01');
select least(min(action_date),cast('2000-01-01' as datetime)) from test; 

This did not happen on InfiniDB.



 Comments   
Comment by Andrew Hutchings (Inactive) [ 2017-05-16 ]

Cause appears to be ColumnStore's func_least / func_greatest have no date/datetime handling in them. I'll add the missing code.

Comment by Andrew Hutchings (Inactive) [ 2017-05-17 ]

Added the required support. Pull requests for 1.0 and 1.1

Comment by Daniel Lee (Inactive) [ 2017-05-31 ]

Build verified: Github source 1.0.10 and 1.1.0

1.1.0

[root@localhost mariadb-columnstore-server]# git show
commit 349cae544b6bc71910267a3b3b0fa3fb57b0a587
Merge: bd13090 2ecb85c
Author: benthompson15 <ben.thompson@mariadb.com>
Date: Thu May 4 16:06:16 2017 -0500

[root@localhost mariadb-columnstore-engine]# git show
commit 2cc5fc7195a76ce6ff475ba85f67123ec94b9fbe
Author: david hill <david.hill@mariadb.com>
Date: Tue May 30 15:12:50 2017 -0500

1.0.10

[root@localhost mariadb-columnstore-server]# git show
commit 478209c9d58e0c34d0a177b39b42ed865ad30ccf
Author: David Hill <david.hill@mariadb.com>
Date: Thu May 18 15:11:05 2017 -0500

[root@localhost mariadb-columnstore-engine]# git show
commit 22191d908890ecf6dc4e911d70c14b8336bc693a
Author: david hill <david.hill@mariadb.com>
Date: Tue May 30 14:33:21 2017 -0500

MariaDB [mytest]> CREATE TABLE `test` (
-> `action_date` date NOT NULL
-> ) ENGINE=InfiniDB;
Query OK, 0 rows affected (0.43 sec)

MariaDB [mytest]> insert into test (action_date) values ('1999-01-01');
Query OK, 1 row affected (0.15 sec)

MariaDB [mytest]> insert into test (action_date) values ('2020-01-01');
Query OK, 1 row affected (0.09 sec)

MariaDB [mytest]> select least(min(action_date),cast('2000-01-01' as datetime)) from test;
--------------------------------------------------------

least(min(action_date),cast('2000-01-01' as datetime))

--------------------------------------------------------

1999-01-01 00:00:00

--------------------------------------------------------
1 row in set (0.12 sec)

Generated at Thu Feb 08 02:23:19 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.