JingsongLi 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_r362366754
##########
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:
I'm OK with `try...catch` if there is no better solution because:
- It is a corner case, should not be normal.
- Cast string to timestamp is a slow operation previous. `try...catch`
should not be a big performance impact on it.
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services