private Token parseTemporalToken(String originalPattern, String candidate, boolean fillMode,
      int begin) {
    // for AM/PM, keep original case
    if (NUMERIC_TEMPORAL_TOKENS.get(candidate) == ChronoField.AMPM_OF_DAY) {
      int subStringEnd = begin + candidate.length();
      candidate = originalPattern.substring(begin, subStringEnd);
    }
    Token lastAddedToken = new Token(TokenType.NUMERIC_TEMPORAL,
        NUMERIC_TEMPORAL_TOKENS.get(candidate.toLowerCase()), candidate,
        getTokenStringLength(candidate), fillMode);
    tokens.add(lastAddedToken);
    return lastAddedToken;
  }
Parse pattern to list of tokens.
common/src/java/org/apache/hadoop/hive/common/format/datetime/HiveSqlDateTimeFormatter.java