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

Use FastDateFormat instead of SimpleDateFormat for TimestampWritable

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Trivial
    • Resolution: Duplicate
    • Affects Version/s: 3.0.0, 2.4.0
    • Fix Version/s: None
    • Labels:
      None
    • Flags:
      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

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

                Dates

                • Created:
                  Updated:
                  Resolved: