[MCOL-297] CHARACTER_LENGTH(datetime) returns wrong length Created: 2016-09-14  Updated: 2016-10-05  Resolved: 2016-10-05

Status: Closed
Project: MariaDB ColumnStore
Component/s: PrimProc
Affects Version/s: None
Fix Version/s: 1.0.4

Type: Task Priority: Trivial
Reporter: David Hall (Inactive) Assignee: Daniel Lee (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Environment:

Centos 6.5


Issue Links:
PartOf
is part of MCOL-280 Beta issues Closed
Sprint: 2016-19

 Description   

A date time returns a string similar to "1997-01-01 00:00:00", which has 19 characters, yet the function CHARACTER_LENGTH when passed a date-time object returns 7 fewer. This is because of the following specific code in the function:

//adjust for microseconds not counted
return (int64_t)date.size() - 7;

Not sure why this is there as microseconds have nothing to do with it.



 Comments   
Comment by David Hall (Inactive) [ 2016-09-14 ]

Removed the offending -7. I would really like to know what was going through the author's mind when s/he wrote that.

Comment by Daniel Lee (Inactive) [ 2016-10-05 ]

Build verified: 1.0.4-1

mcsadmin> getsoft
getsoftwareinfo Tue Oct 4 22:29:41 2016

Name : mariadb-columnstore-platform
Version : 1.0.4
Release : 1
Architecture: x86_64
Install Date: Tue 04 Oct 2016 01:38:36 PM CDT
Group : Applications/Databases
Size : 11506458
License : Copyright (c) 2016 MariaDB Corporation Ab., all rights reserved; redistributable under the terms of the GPL, see the file COPYING for details.
Signature : (none)
Source RPM : mariadb-columnstore-platform-1.0.4-1.src.rpm
Build Date : Fri 30 Sep 2016 01:02:40 PM CDT

MariaDB [mytest]> select cdate, character_length(cdate), cdatetime, character_length( cdatetime) from datatypetestm;
----------------------------------------------------------------------------------+

cdate character_length(cdate) cdatetime character_length( cdatetime)

----------------------------------------------------------------------------------+

1997-01-01 10 1997-01-01 00:00:00 19
1997-01-01 10 1997-01-01 00:00:01 19
1997-01-02 10 1997-01-02 00:00:01 19
1997-01-03 10 1997-01-03 00:00:02 19
1997-01-04 10 1997-01-04 00:00:03 19
2009-12-28 10 2009-12-31 23:59:56 19
2009-12-29 10 2009-12-31 23:59:57 19
2009-12-30 10 2009-12-31 23:59:58 19
2009-12-31 10 2009-12-31 23:59:59 19
2009-12-31 10 2009-12-31 23:59:59 19
2009-12-31 10 2009-12-31 23:59:59 19

----------------------------------------------------------------------------------+
11 rows in set (0.01 sec)

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