[MCOL-77] FROM_DAYS() function returned incorrect values Created: 2016-05-23  Updated: 2016-06-21  Resolved: 2016-06-21

Status: Closed
Project: MariaDB ColumnStore
Component/s: ExeMgr
Affects Version/s: None
Fix Version/s: 1.0.1

Type: Bug Priority: Minor
Reporter: Daniel Lee (Inactive) Assignee: Daniel Lee (Inactive)
Resolution: Not a Bug Votes: 0
Labels: None

Sprint: 1.0.2-1

 Description   

Build tested:

InfiniDB> getcalpontsoft
getcalpontsoftwareinfo Mon May 23 16:47:57 2016

Name : infinidb-platform Relocations: (not relocatable)
Version : 5.0 Vendor: MariaDB, Inc.
Release : 0 Build Date: Sun 15 May 2016 07:24:29 PM CDT
Install Date: Mon 16 May 2016 05:21:51 PM CDT Build Host: srvbuilder
Group : Applications Source RPM: infinidb-5.0-0.src.rpm

ColumnStore returns:

select cidx, CDECIMAL4, FROM_DAYS(CDECIMAL4) from datatypetestm order by cidx

cidx CDECIMAL4 FROM_DAYS(CDECIMAL4)
1 -999 0000-00-00
2 -998 0000-00-00
3 -997 0000-00-00
4 -996 0000-00-00
5 -995 0000-00-00
6 995 0000-00-00
7 996 0000-00-00
8 997 0000-00-00
9 998 0000-00-00
10 999 0000-00-00
11 0 0000-00-00
11 rows in set

MySQL and MariaDB returns:

select cidx, CDECIMAL4, FROM_DAYS(CDECIMAL4) from datatypetestm order by cidx

cidx CDECIMAL4 FROM_DAYS(CDECIMAL4)
1 -999 0000-00-00
2 -998 0000-00-00
3 -997 0000-00-00
4 -996 0000-00-00
5 -995 0000-00-00
6 995 0002-09-22
7 996 0002-09-23
8 997 0002-09-24
9 998 0002-09-25
10 999 0002-09-26
11 0 0000-00-00
11 rows in set



 Comments   
Comment by David Hall (Inactive) [ 2016-06-20 ]

This is not a bug. Columnstore has a minimum date of 1400-01-01 and a max of 9999-12-31, so the viable range of numbers to get a date using from_days() is 511340-3652424. All other values return 0.

This is different behaviour than MariaDB, as it can handle dates smaller. I don't know the reason why InfiniDB changed to 1400-01-01, but it was a conscious decision and should not be reversed lightly.

In order for this test to be useful, values within the legal range should be added to the table, or perhaps the following could be used:
select cidx, CDECIMAL4, FROM_DAYS(CDECIMAL4+510345) from datatypetestm order by cidx;

Comment by David Hall (Inactive) [ 2016-06-20 ]

Not a bug. Revise test.

Comment by Dipti Joshi (Inactive) [ 2016-06-20 ]

dleeyh Please close with "Not a Bug" as reason cause

Comment by Daniel Lee (Inactive) [ 2016-06-21 ]

This the expected result according to Mr. Hall's investigation result.

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