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


##########
core/src/main/java/org/apache/calcite/util/format/postgresql/TimeZoneHoursFormatPattern.java:
##########
@@ -29,14 +30,57 @@
  */
 public class TimeZoneHoursFormatPattern extends StringFormatPattern {
   public TimeZoneHoursFormatPattern() {
-    super("TZH");
+    super(ChronoUnitEnum.TIMEZONE_HOURS, "TZH");
   }
 
-  @Override String dateTimeToString(ZonedDateTime dateTime, boolean 
haveFillMode,
+  @Override protected int parseValue(final ParsePosition inputPosition, final 
String input,
+      final Locale locale, final boolean haveFillMode, boolean enforceLength) 
throws Exception {
+
+    int inputOffset = inputPosition.getIndex();
+    String inputTrimmed = input.substring(inputOffset);
+
+    boolean isPositive = true;
+    if (inputTrimmed.charAt(0) == '-') {
+      isPositive = false;
+    } else if (inputTrimmed.charAt(0) != '+') {
+      throw new Exception();
+    }
+
+    inputOffset++;
+    inputTrimmed = inputTrimmed.substring(inputOffset);
+
+    if (!Character.isDigit(inputTrimmed.charAt(0))) {
+      throw new Exception();

Review Comment:
   No longer throwing `Exception`. Changed to ParseException and added messages.



-- 
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