simhadri-g commented on code in PR #5241:
URL: https://github.com/apache/hive/pull/5241#discussion_r1595470239
##########
common/src/java/org/apache/hadoop/hive/ql/ErrorMsg.java:
##########
@@ -529,6 +529,7 @@ public enum ErrorMsg {
PARQUET_FOOTER_ERROR(20022, "Failed to read parquet footer:"),
PARQUET_UNHANDLED_TYPE(20023, "Unhandled type {0}", true),
ORC_FOOTER_ERROR(20024, "Failed to read orc footer:"),
+ NOT_A_LEAP_YEAR(20025, "not a leap year", true),
Review Comment:
Thanks @deniskuzZ for the review ! :)
Fixed
##########
ql/src/java/org/apache/hadoop/hive/ql/io/parquet/timestamp/NanoTimeUtils.java:
##########
@@ -119,7 +135,11 @@ public static Timestamp getTimestamp(NanoTime nt, ZoneId
targetZone, boolean leg
calendar.set(Calendar.SECOND, seconds);
Timestamp ts = Timestamp.ofEpochMilli(calendar.getTimeInMillis(), (int)
nanos);
- ts = TimestampTZUtil.convertTimestampToZone(ts, ZoneOffset.UTC,
targetZone, legacyConversion);
+ if(notLeapYear){
Review Comment:
Fixed
##########
common/src/java/org/apache/hadoop/hive/common/type/TimestampTZUtil.java:
##########
@@ -213,4 +205,26 @@ public static Timestamp convertTimestampToZone(Timestamp
ts, ZoneId fromZone, Zo
public static double convertTimestampTZToDouble(TimestampTZ timestampTZ) {
return timestampTZ.getEpochSecond() + timestampTZ.getNanos() /
DateUtils.NANOS_PER_SEC;
}
+
+ public static Timestamp legacyLeapYearConversions(Timestamp ts, ZoneId
fromZone, ZoneId toZone) {
+ DateTimeFormatter dtf = FORMATTER;
+ Timestamp result = Timestamp.valueOf(
+
dtf.format(dtf.withResolverStyle(ResolverStyle.LENIENT).parse(formatDate(ts,
fromZone, toZone))));
+ result.setNanos(ts.getNanos());
+ return result;
+ }
+
+ private static String formatDate(Timestamp ts, ZoneId fromZone, ZoneId
toZone) {
+ DateFormat formatter = getLegacyDateFormatter();
+ formatter.setTimeZone(TimeZone.getTimeZone(fromZone));
+ java.util.Date date = null;
Review Comment:
Fixed
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]