normanj-bitquill commented on code in PR #3833:
URL: https://github.com/apache/calcite/pull/3833#discussion_r1667195089


##########
core/src/main/java/org/apache/calcite/util/format/postgresql/PostgresqlDateTimeFormatter.java:
##########
@@ -38,90 +45,164 @@ public class PostgresqlDateTimeFormatter {
   @SuppressWarnings("TemporalAccessorGetChronoField")
   private static final FormatPattern[] FORMAT_PATTERNS = new FormatPattern[] {
       new NumberFormatPattern(
-          dt -> {
-            final int hour = dt.get(ChronoField.HOUR_OF_AMPM);
-            return String.format(Locale.ROOT, "%02d", hour == 0 ? 12 : hour);
-          },
-          "HH12"),
-      new NumberFormatPattern(
+          ChronoUnitEnum.HOURS_IN_DAY,
+          0,
+          23,
+          2,
           dt -> String.format(Locale.ROOT, "%02d", dt.getHour()),
           "HH24"),
       new NumberFormatPattern(
+          ChronoUnitEnum.HOURS_IN_HALF_DAY,
+          1,
+          12,
+          2,
           dt -> {
             final int hour = dt.get(ChronoField.HOUR_OF_AMPM);
             return String.format(Locale.ROOT, "%02d", hour == 0 ? 12 : hour);
           },
-          "HH"),
+          "HH12", "HH"),
       new NumberFormatPattern(
+          ChronoUnitEnum.MINUTES_IN_HOUR,
+          0,
+          59,
+          2,
           dt -> String.format(Locale.ROOT, "%02d", dt.getMinute()),
           "MI"),
       new NumberFormatPattern(
+          ChronoUnitEnum.SECONDS_IN_DAY,
+          0,
+          24 * 60 * 60 - 1,
+          5,
           dt -> Integer.toString(dt.get(ChronoField.SECOND_OF_DAY)),
-          "SSSSS", "SSSS"),
+          "SSSSS"),
       new NumberFormatPattern(
+          ChronoUnitEnum.SECONDS_IN_DAY,
+          0,
+          9999,

Review Comment:
   A mistake on my part. This should be parsed the same as `SSSSS`. Updated.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to