public static TimestampData parseTimestampData(String dateStr, String format) {
    DateTimeFormatter formatter = DATETIME_FORMATTER_CACHE.get(format);

    try {
      TemporalAccessor accessor = formatter.parse(dateStr);
      // Precision is hardcoded to match signature of TO_TIMESTAMP
      //  https://issues.apache.org/jira/browse/FLINK-14925
      LocalDateTime ldt = fromTemporalAccessor(accessor, 3);
      return TimestampData.fromLocalDateTime(ldt);
    } catch (DateTimeParseException e) {
      // fall back to support cases like '1999-9-10 05:20:10' or '1999-9-10'
      try {
        dateStr = dateStr.trim();
        int space = dateStr.indexOf(' ');
        if (space >= 0) {
          Timestamp ts = Timestamp.valueOf(dateStr);
          return TimestampData.fromTimestamp(ts);
        } else {
          java.sql.Date dt = java.sql.Date.valueOf(dateStr);
          return TimestampData.fromLocalDateTime(
              LocalDateTime.of(dt.toLocalDate(), LocalTime.MIDNIGHT));
        }
      } catch (IllegalArgumentException ie) {
        return null;
      }
    }
  }
Converts the Java type used for UDF parameters of SQL TIMESTAMP type ({@link Timestamp}) to
internal representation (long).

<p>Converse of {@link #toSQLTimestamp(long)}.
amoro-format-mixed/amoro-mixed-flink/amoro-mixed-flink-common/src/main/java/org/apache/amoro/flink/util/DateTimeUtils.java