You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2020/01/02 03:07:50 UTC

[GitHub] [flink] wuchong commented on a change in pull request #10727: [FLINK-15420][table-planner-blink] Cast string to timestamp will loos…

wuchong commented on a change in pull request #10727: [FLINK-15420][table-planner-blink] Cast string to timestamp will loos…
URL: https://github.com/apache/flink/pull/10727#discussion_r362362423
 
 

 ##########
 File path: flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/functions/SqlDateTimeUtils.java
 ##########
 @@ -253,7 +254,13 @@ public static SqlTimestamp toSqlTimestamp(String dateStr, String format) {
 				return SqlTimestamp.fromLocalDateTime(ldt);
 			}
 		} catch (DateTimeParseException e) {
-			return null;
+			// fall back to support cases like '1999-9-10 05:20:10'
+			try {
+				Timestamp ts = Timestamp.valueOf(dateStr);
 
 Review comment:
   My concern is using try catch is not performance-friendly.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services