zratkai commented on code in PR #5014:
URL: https://github.com/apache/hive/pull/5014#discussion_r1474012862
##########
ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFFromUtcTimestamp.java:
##########
@@ -88,18 +90,15 @@ public Object evaluate(DeferredObject[] arguments) throws
HiveException {
Timestamp inputTs = ((TimestampWritableV2) converted_o0).getTimestamp();
String tzStr = textConverter.convert(o1).toString();
- TimeZone timezone = TimeZone.getTimeZone(tzStr);
-
- TimeZone fromTz;
- TimeZone toTz;
- if (invert()) {
- fromTz = timezone;
- toTz = tzUTC;
- } else {
- fromTz = tzUTC;
- toTz = timezone;
+ if(ZoneInfo.getTimeZone(tzStr)==null){
Review Comment:
Fixed.
##########
ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFFromUtcTimestamp.java:
##########
@@ -34,6 +35,7 @@
import
org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import sun.util.calendar.ZoneInfo;
Review Comment:
TimeZone.getTimeZone uses ZoneInfo to get the proper timezone. But if the
input is not a valid timezone, then it gives back the default one, and this is
what this fix is about. Instead of the default it will throw exception to avoid
data inconsistency.
--
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]