Chun Chang created DRILL-1051:
---------------------------------
Summary: casting timestamp as date gives wrong result for dates
earlier than 1797
Key: DRILL-1051
URL: https://issues.apache.org/jira/browse/DRILL-1051
Project: Apache Drill
Issue Type: Bug
Components: Functions - Drill
Reporter: Chun Chang
Assignee: Mehant Baid
#Wed Jun 18 10:27:23 PDT 2014
git.commit.id.abbrev=894037a
It appears casting dates earlier than year 1797 gives wrong result:
0: jdbc:drill:schema=dfs> select cast(c_timestamp as varchar(20)),
cast(c_timestamp as date) from data where c_row <> 12;
+------------+------------+
| EXPR$0 | EXPR$1 |
+------------+------------+
| 1997-01-02 03:04:05 | 1997-01-02 |
| 1997-01-02 00:00:00 | 1997-01-02 |
| 2001-09-22 18:19:20 | 2001-09-22 |
| 1997-02-10 17:32:01 | 1997-02-10 |
| 1997-02-10 17:32:00 | 1997-02-10 |
| 1997-02-11 17:32:01 | 1997-02-11 |
| 1997-02-12 17:32:01 | 1997-02-12 |
| 1997-02-13 17:32:01 | 1997-02-13 |
| 1997-02-14 17:32:01 | 1997-02-14 |
| 1997-02-15 17:32:01 | 1997-02-15 |
| 1997-02-16 17:32:01 | 1997-02-16 |
| 0097-02-16 17:32:01 | 0097-02-17 |
| 0597-02-16 17:32:01 | 0597-02-13 |
| 1097-02-16 17:32:01 | 1097-02-09 |
| 1697-02-16 17:32:01 | 1697-02-15 |
| 1797-02-16 17:32:01 | 1797-02-15 |
| 1897-02-16 17:32:01 | 1897-02-16 |
| 1997-02-16 17:32:01 | 1997-02-16 |
| 2097-02-16 17:32:01 | 2097-02-16 |
| 1996-02-28 17:32:01 | 1996-02-28 |
| 1996-02-29 17:32:01 | 1996-02-29 |
| 1996-03-01 17:32:01 | 1996-03-01 |
+------------+------------+
22 rows selected (0.201 seconds)
--
This message was sent by Atlassian JIRA
(v6.2#6252)