protected final T getFormatter(String pattern) {
    Objects.requireNonNull(pattern);
    if (!pattern.equals(lastPattern)) {
      lastPattern = pattern;
      formatter = loader.apply(pattern);
    }
    return formatter;
  }
Formatter that supports caching of patterns to avoid compilation overhead.
<p>
At its current state, the cache is very simplistic and just holds the last used pattern in memory.
</p>
@param <T> the type of the underlying datetime formatter
ql/src/java/org/apache/hadoop/hive/ql/udf/generic/InstantFormatterCache.java