Hello Tim Armstrong,

I'd like you to reexamine a change.  Please visit

    http://gerrit.cloudera.org:8080/7530

to look at the new patch set (#11).

Change subject: IMPALA-3894: Change the behavior parsing date "YY"
......................................................................

IMPALA-3894: Change the behavior parsing date "YY"

This patch change the behavor when running unix_timestamp(string, string)
function. Before the change Impala directly adds 2000 to the year parsed.
Behavior after change is the same as Hive's, shifting the parsed date
into the interval [current time - 80 years, current time + 20 years).
In 2017, given query
> select from_unixtime(unix_timestamp('31-AUG-94', 'dd-MMM-yy'),'yyyyMMdd');
Impala would output 20940831 before the change and 19940831 with this
patch applied. unix_timestamp function with other forms of parameters
is not affected.
Hive's impelentation can be found at:
https://github.com/apache/hive/blob/39d66a439c02ea2b5c7501b362c0d8f9b8d22cc0/hplsql/src/main/java/org/apache/hive/hplsql/functions/FunctionDatetime.java#L159
It uses SimpleDateFormat, documented at:
https://docs.oracle.com/javase/6/docs/api/java/text/SimpleDateFormat.html

Test: add 4 test cases to timestamp-test.cc, testing the edge cases of
2-year format.

Change-Id: I5da761255915dc741f1dcc488fd4ef6ecc385896
---
M be/src/exprs/timestamp-functions.cc
M be/src/runtime/timestamp-parse-util.cc
M be/src/runtime/timestamp-parse-util.h
M be/src/runtime/timestamp-test.cc
M be/src/runtime/timestamp-value.h
5 files changed, 52 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/30/7530/11
-- 
To view, visit http://gerrit.cloudera.org:8080/7530
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I5da761255915dc741f1dcc488fd4ef6ecc385896
Gerrit-PatchSet: 11
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: Tianyi Wang <tw...@cloudera.com>
Gerrit-Reviewer: Greg Rahn <gr...@cloudera.com>
Gerrit-Reviewer: Matthew Jacobs <m...@cloudera.com>
Gerrit-Reviewer: Tianyi Wang <tw...@cloudera.com>
Gerrit-Reviewer: Tim Armstrong <tarmstr...@cloudera.com>

Reply via email to