raminqaf commented on code in PR #28146:
URL: https://github.com/apache/flink/pull/28146#discussion_r3234344395


##########
flink-table/flink-table-common/src/main/java/org/apache/flink/table/utils/DateTimeUtils.java:
##########
@@ -391,18 +408,29 @@ public static long toEpochValue(Instant instant, int 
precision) {
     }
 
     /**
-     * Infers fractional second precision from a format pattern by counting 
trailing 'S' characters.
-     * Returns at least {@link #DEFAULT_PRECISION} (3) and at most 9.
+     * Infers fractional second precision from a format pattern by finding the 
longest run of 'S'
+     * characters outside quoted literal sections. Returns at least {@link 
#DEFAULT_PRECISION} (3)
+     * and at most 9.
      */
     public static int precisionFromFormat(String format) {
-        int sCount = 0;
-        for (int i = format.length() - 1; i >= 0; i--) {
-            if (format.charAt(i) != 'S') {
-                break;
+        int maxRun = 0;
+        int run = 0;
+        boolean inQuotes = false;

Review Comment:
   Added more IT Cases that cover the edge-case patterns



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