diff --git a/ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFToUnixTimestamp.java b/ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFToUnixTimestamp.java index 6f427ac0cfbc..9fc16c160e4e 100644 --- a/ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFToUnixTimestamp.java +++ b/ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFToUnixTimestamp.java @@ -18,6 +18,7 @@ package org.apache.hadoop.hive.ql.udf.generic; +import java.text.SimpleDateFormat; import java.time.ZoneId; import org.apache.hadoop.hive.common.type.Date; import org.apache.hadoop.hive.common.type.Timestamp; @@ -167,7 +168,8 @@ public void testStringArg2() throws HiveException { runAndVerify(udf2, new Text("1400-02-01 00:00:00 ICT"), new Text("yyyy-MM-dd HH:mm:ss z"), - new LongWritable(TimestampTZUtil.parse("1400-01-31 09:00:22", ZoneId.systemDefault()).getEpochSecond())); + new LongWritable(-17984788924L)); + runAndVerify(udf2, new Text("1400-02-01 00:00:00 UTC"), new Text("yyyy-MM-dd HH:mm:ss z"), diff --git a/ql/src/test/resources/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFDateFormatEvaluate.csv b/ql/src/test/resources/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFDateFormatEvaluate.csv index 401e1ef7dec5..afd9dd6d22d3 100644 --- a/ql/src/test/resources/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFDateFormatEvaluate.csv +++ b/ql/src/test/resources/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFDateFormatEvaluate.csv @@ -15,7 +15,7 @@ Input datetime;Input pattern;Local timezone;Formatter type;Expected output 1800-01-01 00:00:00;yyyy-MM-dd HH:mm:ss;Asia/Kolkata;SIMPLE;1799-12-31 23:36:32 Jul 9 2023;MMM dd yyyy;Etc/GMT;DATETIME;null Jul 9 2023;MMM dd yyyy;Etc/GMT;SIMPLE;null -2023-07-21;DD;Etc/GMT;DATETIME;null +2023-07-21;DD;Etc/GMT;DATETIME;202 2023-07-21;DD;Etc/GMT;SIMPLE;202 2023-07-21;DDD;Etc/GMT;DATETIME;202 2023-07-21;DDD;Etc/GMT;SIMPLE;202 diff --git a/ql/src/test/resources/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFFromUnixTimeEvaluate.csv b/ql/src/test/resources/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFFromUnixTimeEvaluate.csv index 8198c33eee6b..a69df0a8f744 100644 --- a/ql/src/test/resources/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFFromUnixTimeEvaluate.csv +++ b/ql/src/test/resources/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFFromUnixTimeEvaluate.csv @@ -22,7 +22,7 @@ Jul 09 2023;MMM dd yyyy;Etc/GMT;DATETIME;1688860800 Jul 09 2023;MMM dd yyyy;Etc/GMT;SIMPLE;1688860800 Jul 21 2023;MMM dd yyyy;Etc/GMT;DATETIME;1689897600 Jul 21 2023;MMM dd yyyy;Etc/GMT;SIMPLE;1689897600 -Field DayOfYear cannot be printed as the value 202 exceeds the maximum print width of 2;YYYY-MM-DD;Etc/GMT;DATETIME;1689897600 +2023-07-21;YYYY-MM-dd;Etc/GMT;DATETIME;1689897600 2023-07-202;YYYY-MM-DD;Etc/GMT;SIMPLE;1689897600 Jul 21 2023 09:13;MMM dd yyyy HH:mm;Etc/GMT;DATETIME;1689930780 Jul 21 2023 09:13;MMM dd yyyy HH:mm;Etc/GMT;SIMPLE;1689930780 @@ -32,7 +32,7 @@ Jul 21 2023 9:13;MMM dd yyyy H:mm;Etc/GMT;SIMPLE;1689930780 2023-07-21 09:13;yyyy-MM-dd HH:mm;Etc/GMT;SIMPLE;1689930780 2023-07-21 9:13;yyyy-MM-dd H:mm;Etc/GMT;DATETIME;1689930780 2023-07-21 9:13;yyyy-MM-dd H:mm;Etc/GMT;SIMPLE;1689930780 -Field MilliOfDay cannot be printed as the value 33180000 exceeds the maximum print width of 2;yyyy-MM-dd HH:mmAA;Etc/GMT;DATETIME;1689930780 +2023-07-21 09:1333180000;yyyy-MM-dd HH:mmAA;Etc/GMT;DATETIME;1689930780 Illegal pattern character 'A';yyyy-MM-dd HH:mmAA;Etc/GMT;SIMPLE;1689930780 Too many pattern letters: a;yyyy-MM-dd HH:mmaa;Etc/GMT;DATETIME;1689930780 2023-07-21 09:13AM;yyyy-MM-dd HH:mmaa;Etc/GMT;SIMPLE;1689930780