private static Slice dateFormat(
      ISOChronology chronology, Locale locale, long timestamp, Slice formatString) {
    DateTimeFormatter formatter =
        DATETIME_FORMATTER_CACHE.get(formatString).withChronology(chronology).withLocale(locale);

    return Slices.copiedBuffer(formatter.print(timestamp), Charsets.UTF_8);
  }
  @ScalarFunction
  @SqlType(TimestampType.class)
  public static long dateParse(
      ConnectorSession session,
      @SqlType(VarcharType.class) Slice dateTime,
      @SqlType(VarcharType.class) Slice formatString) {
    DateTimeFormatter formatter =
        DATETIME_FORMATTER_CACHE
            .get(formatString)
            .withChronology(getChronology(session.getTimeZoneKey()))
            .withLocale(session.getLocale());

    try {
      return formatter.parseMillis(dateTime.toString(Charsets.UTF_8));
    } catch (IllegalArgumentException e) {
      throw new PrestoException(StandardErrorCode.INVALID_FUNCTION_ARGUMENT.toErrorCode(), e);
    }
  }