[ https://issues.apache.org/jira/browse/HIVE-24701?focusedWorklogId=543895&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-543895 ]
ASF GitHub Bot logged work on HIVE-24701: ----------------------------------------- Author: ASF GitHub Bot Created on: 28/Jan/21 21:42 Start Date: 28/Jan/21 21:42 Worklog Time Spent: 10m Work Description: miklosgergely commented on a change in pull request #1927: URL: https://github.com/apache/hive/pull/1927#discussion_r566425919 ########## File path: common/src/java/org/apache/hadoop/hive/common/type/TimestampTZUtil.java ########## @@ -125,11 +125,6 @@ public static TimestampTZ parseOrNull(String s, ZoneId defaultTimeZone) { } } - // Converts Date to TimestampTZ. - public static TimestampTZ convert(Date date, ZoneId defaultTimeZone) { - return parse(date.toString(), defaultTimeZone); - } - // Converts Timestamp to TimestampTZ. public static TimestampTZ convert(Timestamp ts, ZoneId defaultTimeZone) { Review comment: Nice catch, this is indeed an unnecessarily slow solution! This other convert function right next to it has the same issue, please fix that too in the same patch! ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking ------------------- Worklog Id: (was: 543895) Time Spent: 20m (was: 10m) > Remove String Manipulation from Date Parsing TimestampTZUtil > ------------------------------------------------------------ > > Key: HIVE-24701 > URL: https://issues.apache.org/jira/browse/HIVE-24701 > Project: Hive > Issue Type: Improvement > Reporter: David Mollitor > Assignee: David Mollitor > Priority: Major > Labels: pull-request-available > Time Spent: 20m > Remaining Estimate: 0h > > This operation is pretty slow: > {code:java} > // Converts Date to TimestampTZ. > public static TimestampTZ convert(Date date, ZoneId defaultTimeZone) { > return parse(date.toString(), defaultTimeZone); > } > {code} > To convert from Date to TimestampTZ, it creates a string, then parses it. > Should be able to just look at the epoch time and do the conversion without > all the string manipulation/parsing. -- This message was sent by Atlassian Jira (v8.3.4#803005)