Uploaded image for project: 'Hive'
  1. Hive
  2. HIVE-17998

Use FastDateFormat instead of SimpleDateFormat for TimestampWritable

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Trivial
    • Resolution: Duplicate
    • 2.4.0, 3.0.0
    • None
    • None
    • Patch

    Description

      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.

      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");
              }
            };
      

      Attachments

        1. HIVE-17998.1.patch
          2 kB
          David Mollitor

        Issue Links

          Activity

            People

              belugabehr David Mollitor
              belugabehr David Mollitor
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: