[
https://issues.apache.org/jira/browse/HIVE-24811?focusedWorklogId=556359&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-556359
]
ASF GitHub Bot logged work on HIVE-24811:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 23/Feb/21 14:34
Start Date: 23/Feb/21 14:34
Worklog Time Spent: 10m
Work Description: belugabehr commented on a change in pull request #2007:
URL: https://github.com/apache/hive/pull/2007#discussion_r581086539
##########
File path:
serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/primitive/PrimitiveObjectInspectorUtils.java
##########
@@ -1124,33 +1125,25 @@ public static Date getDate(Object o,
PrimitiveObjectInspector oi) {
case STRING:
StringObjectInspector soi = (StringObjectInspector) oi;
String s = soi.getPrimitiveJavaObject(o).trim();
- try {
- if (s.length() == DATE_LENGTH) {
- result = Date.valueOf(s);
- } else {
- Timestamp ts = getTimestampFromString(s);
- if (ts != null) {
- result = Date.ofEpochMilli(ts.toEpochMilli());
- }
+ if (s.length() == DATE_LENGTH) {
+ result = DateParser.parseDate(s);
+ } else {
+ Timestamp ts = getTimestampFromString(s);
+ if (ts != null) {
+ result = Date.ofEpochMilli(ts.toEpochMilli());
}
- } catch (IllegalArgumentException e) {
- // Do nothing
Review comment:
The net effect here for `Do nothing` is to return a `null` value.
`DateParser#parseDate` returns a `null` value instead of an Exception, so can
remove this confusing try/catch block.
----------------------------------------------------------------
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:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 556359)
Time Spent: 0.5h (was: 20m)
> Extend Cached Dates to Other Areas
> ----------------------------------
>
> Key: HIVE-24811
> URL: https://issues.apache.org/jira/browse/HIVE-24811
> Project: Hive
> Issue Type: Improvement
> Reporter: David Mollitor
> Assignee: David Mollitor
> Priority: Minor
> Labels: pull-request-available
> Time Spent: 0.5h
> Remaining Estimate: 0h
>
> Based on my work on [HIVE-24808], I noticed other places that call
> {{Date#valueOf}} that can probably also benefit from using a cache mechanism.
> Locate those places and change calls to use the {{Parser}} cache.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)