snuyanzin commented on code in PR #30214:
URL: https://github.com/apache/flink/pull/30214#discussion_r4754542760
##########
flink-table/flink-table-common/src/main/java/org/apache/flink/table/utils/DateTimeUtils.java:
##########
@@ -764,23 +770,61 @@ private static boolean isValidTime(int hour, int minute,
int second) {
&& second <= 59;
}
+ /**
+ * The number in {@code v[from, to)}, without the whitespace around it
that {@link String#trim}
+ * removes, or -1 when it is empty or has a character other than a digit.
Reads it in place, so
+ * that parsing a date or a time makes no strings.
+ */
Review Comment:
i simplified both method and javadoc
##########
flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/functions/casting/CastRulesTest.java:
##########
@@ -689,6 +724,46 @@ Stream<CastTestSpecBuilder> testCases() {
STRING(),
fromString("23:45"),
DateTimeUtils.toInternal(LocalTime.of(23, 45,
0)))
+ .fromCase(
+ STRING(),
+ fromString(" 12 : 30 : 45 "),
+ DateTimeUtils.toInternal(LocalTime.of(12, 30,
45)))
+ .fromCase(
+ STRING(),
+ fromString("12:30:45+02"),
+ DateTimeUtils.toInternal(LocalTime.of(14, 30,
45)))
+ .fromCase(
+ STRING(),
+ fromString("12:30:45+02:00"),
+ DateTimeUtils.toInternal(LocalTime.of(14, 30,
45)))
+ .fromCase(
+ STRING(),
+ fromString("12:30:45-02:30"),
+ DateTimeUtils.toInternal(LocalTime.of(10, 0,
45)))
Review Comment:
moved
--
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]