You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hive.apache.org by "Prasanth Jayachandran (JIRA)" <ji...@apache.org> on 2017/11/07 17:35:00 UTC
[jira] [Commented] (HIVE-17998) Use FastDateFormat instead of
SimpleDateFormat for TimestampWritable
[ https://issues.apache.org/jira/browse/HIVE-17998?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16242479#comment-16242479 ]
Prasanth Jayachandran commented on HIVE-17998:
----------------------------------------------
[~belugabehr] I benchmarked this in HIVE-17417 and it turned out JodaTime formatter was fastest (JDK 8's formatter is also pretty close). Since we already have jodatime dependency I added that in HIVE-17417.
> Use FastDateFormat instead of SimpleDateFormat for TimestampWritable
> --------------------------------------------------------------------
>
> Key: HIVE-17998
> URL: https://issues.apache.org/jira/browse/HIVE-17998
> Project: Hive
> Issue Type: Improvement
> Components: Serializers/Deserializers
> Affects Versions: 3.0.0, 2.4.0
> Reporter: BELUGA BEHR
> Assignee: BELUGA BEHR
> Priority: Trivial
> Attachments: HIVE-17998.1.patch
>
>
> Currently Hive is using this ThreadLocal/SimpleDateFormat setup to work around the thread-safety limitations of SimpleDateFormat.
> Let us simply drink the Apache Commons champagne and use thread-safe {{org.apache.commons.lang.time.FastDateFormat}} instead.
> {code:java|title=org.apache.hadoop.hive.serde2.io.TimestampWritable}
> private static final ThreadLocal<DateFormat> threadLocalDateFormat =
> new ThreadLocal<DateFormat>() {
> @Override
> protected DateFormat initialValue() {
> return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
> }
> };
> {code}
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)