Carter Shanklin created HIVE-12835: -------------------------------------- Summary: BC dates not properly documented / handled Key: HIVE-12835 URL: https://issues.apache.org/jira/browse/HIVE-12835 Project: Hive Issue Type: Bug Reporter: Carter Shanklin Priority: Minor
Minor issue IMO, but since I saw it I'm filing it to document it. There's something screwy with date types. Documentation says they run from year 0 to year 9999 ("depending on Java support"). Tests I have done are consistent with supporting BC dates, but not identifying the dates as BC dates. Also there is some incorrect boundary handling. This is Hive 1.2.1 and Java 1.7.0_91. To reproduce, create some table with 1 record and run these. {code} hive> select cast('2000-01-01' as date) - interval '2000' year from date_test; OK 0001-01-01 {code} So far so good {code} Time taken: 0.067 seconds, Fetched: 1 row(s) hive> select cast('2000-01-01' as date) - interval '2100' year from date_test; OK 0101-01-01 Time taken: 0.055 seconds, Fetched: 1 row(s) hive> select cast('2000-01-01' as date) - interval '2200' year from date_test; OK 0201-01-01 Time taken: 0.153 seconds, Fetched: 1 row(s) {code} Consistent with BC dates, but not identified as such. {code} hive> select cast('2000-01-01' as date) - interval '9999' year from date_test; OK 8000-01-01 Time taken: 0.062 seconds, Fetched: 1 row(s) hive> select cast('2000-01-01' as date) - interval '10000' year from date_test; OK 8001-01-01 Time taken: 0.056 seconds, Fetched: 1 row(s) hive> select cast('2000-01-01' as date) - interval '12000' year from date_test; OK 001-01-01 Time taken: 0.054 seconds, Fetched: 1 row(s) hive> select cast('2000-01-01' as date) - interval '14000' year from date_test; OK 001-01-01 Time taken: 0.057 seconds, Fetched: 1 row(s) hive> select cast('2000-01-01' as date) - interval '50000' year from date_test; OK 001-01-01 Time taken: 0.06 seconds, Fetched: 1 row(s) {code} Everything from here out collapses down to 001-01-01. -- This message was sent by Atlassian JIRA (v6.3.4#6332)