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


##########
flink-table/flink-table-common/src/main/java/org/apache/flink/table/utils/DateTimeUtils.java:
##########
@@ -587,43 +587,49 @@ public static int parseDate(String dateStr, String 
fromFormat) {
     }
 
     public static Integer parseDate(String s) {
-        // allow timestamp str to date, e.g. 2017-12-12 09:30:00.0
-        int ws1 = s.indexOf(" ");
-        if (ws1 > 0) {
-            s = s.substring(0, ws1);
+        // allow timestamp str to date, e.g. 2017-12-12 09:30:00.0: the date 
ends at the first space
+        int end = s.indexOf(' ');
+        if (end <= 0) {
+            end = s.length();

Review Comment:
   ```suggestion
   final int space = s.indexOf(' ');
   // allow timestamp str to date, e.g. 2017-12-12 09:30:00.0: the date ends at 
the first space
   final int dateEnd = space > 0 ? space : s.length();
   ```



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