You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@hive.apache.org by "zratkai (via GitHub)" <gi...@apache.org> on 2024/03/07 13:50:40 UTC

Re: [PR] HIVE-27741 handle Invalid timezone value in to_utc_timestamp() UDF [hive]

zratkai commented on code in PR #5014:
URL: https://github.com/apache/hive/pull/5014#discussion_r1516186663


##########
ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFFromUtcTimestamp.java:
##########
@@ -88,31 +88,42 @@ 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;
-    }
 
-    // inputTs is the year/month/day/hour/minute/second in the local timezone.
-    // For this UDF we want it in the timezone represented by fromTz
-    TimestampTZ fromTs = TimestampTZUtil.parse(inputTs.toString(), fromTz.toZoneId());
+    ZoneId zoneId;
+    try{

Review Comment:
   Done.



-- 
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: gitbox-unsubscribe@hive.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org