snuyanzin commented on code in PR #20846:
URL: https://github.com/apache/flink/pull/20846#discussion_r976395111
##########
flink-table/flink-table-common/src/main/java/org/apache/flink/table/utils/DateTimeUtils.java:
##########
@@ -1400,6 +1401,25 @@ public static String formatUnixTimestamp(long unixtime,
TimeZone tz) {
return formatUnixTimestamp(unixtime, TIMESTAMP_FORMAT_STRING, tz);
}
+ /** Add offset to string (like '1970-01-01') and return new date For
String support. */
+ public static Integer dateAdd(BinaryStringData binaryStringData, int
offset) {
+
+ if (binaryStringData == null) {
+ return null;
+ }
+ try {
+ int days = parseDate(binaryStringData.toString());
+ return days + offset;
+ } catch (NullPointerException e) {
Review Comment:
Isn't it possible to prevent NullPointerException with some extrachecks
rather than catching 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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]