yuxiqian commented on code in PR #3698:
URL: https://github.com/apache/flink-cdc/pull/3698#discussion_r1913993565


##########
flink-cdc-runtime/src/main/java/org/apache/flink/cdc/runtime/functions/SystemFunctionUtils.java:
##########
@@ -108,83 +108,203 @@ public static TimestampData toTimestamp(String str, 
String format, String timezo
         }
     }
 
-    public static int timestampDiff(
-            String symbol,
+    public static Integer timestampDiff(
+            String timeIntervalUnit,
             LocalZonedTimestampData fromTimestamp,
-            LocalZonedTimestampData toTimestamp) {
+            LocalZonedTimestampData toTimestamp,
+            String timezone) {
+        if (fromTimestamp == null || toTimestamp == null) {
+            return null;
+        }
         return timestampDiff(
-                symbol, fromTimestamp.getEpochMillisecond(), 
toTimestamp.getEpochMillisecond());
+                timeIntervalUnit,
+                fromTimestamp.getEpochMillisecond(),
+                timezone,
+                toTimestamp.getEpochMillisecond(),
+                timezone);
     }
 
-    public static int timestampDiff(
-            String symbol, TimestampData fromTimestamp, TimestampData 
toTimestamp) {
-        return timestampDiff(symbol, fromTimestamp.getMillisecond(), 
toTimestamp.getMillisecond());
+    public static Integer timestampdiff(
+            String timeIntervalUnit,
+            LocalZonedTimestampData fromTimestamp,
+            LocalZonedTimestampData toTimestamp,
+            String timezone) {
+        return timestampDiff(timeIntervalUnit, fromTimestamp, toTimestamp, 
timezone);
     }
 
-    public static int timestampDiff(
-            String symbol, TimestampData fromTimestamp, 
LocalZonedTimestampData toTimestamp) {
+    public static Integer timestampDiff(
+            String timeIntervalUnit,
+            TimestampData fromTimestamp,
+            TimestampData toTimestamp,
+            String timezone) {
+        if (fromTimestamp == null || toTimestamp == null) {
+            return null;
+        }
         return timestampDiff(
-                symbol, fromTimestamp.getMillisecond(), 
toTimestamp.getEpochMillisecond());
-    }
-
-    public static int timestampDiff(
-            String symbol, LocalZonedTimestampData fromTimestamp, 
TimestampData toTimestamp) {
+                timeIntervalUnit,
+                fromTimestamp.getMillisecond(),
+                "UTC",
+                toTimestamp.getMillisecond(),
+                "UTC");
+    }
+
+    public static Integer timestampdiff(
+            String timeIntervalUnit,
+            TimestampData fromTimestamp,
+            TimestampData toTimestamp,
+            String timezone) {
+        return timestampDiff(timeIntervalUnit, fromTimestamp, toTimestamp, 
timezone);
+    }
+
+    public static Integer timestampDiff(
+            String timeIntervalUnit,
+            TimestampData fromTimestamp,
+            LocalZonedTimestampData toTimestamp,
+            String timezone) {
+        if (fromTimestamp == null || toTimestamp == null) {
+            return null;
+        }
         return timestampDiff(
-                symbol, fromTimestamp.getEpochMillisecond(), 
toTimestamp.getMillisecond());
+                timeIntervalUnit,
+                fromTimestamp.getMillisecond(),
+                "UTC",
+                toTimestamp.getEpochMillisecond(),
+                timezone);
     }
 
-    public static int timestampDiff(
-            String symbol, ZonedTimestampData fromTimestamp, 
ZonedTimestampData toTimestamp) {
-        return timestampDiff(symbol, fromTimestamp.getMillisecond(), 
toTimestamp.getMillisecond());
+    public static Integer timestampdiff(
+            String timeIntervalUnit,
+            TimestampData fromTimestamp,
+            LocalZonedTimestampData toTimestamp,
+            String timezone) {
+        return timestampDiff(timeIntervalUnit, fromTimestamp, toTimestamp, 
timezone);
     }
 
-    public static int timestampDiff(
-            String symbol, LocalZonedTimestampData fromTimestamp, 
ZonedTimestampData toTimestamp) {
+    public static Integer timestampDiff(
+            String timeIntervalUnit,
+            LocalZonedTimestampData fromTimestamp,
+            TimestampData toTimestamp,
+            String timezone) {
+        if (fromTimestamp == null || toTimestamp == null) {
+            return null;
+        }
         return timestampDiff(
-                symbol, fromTimestamp.getEpochMillisecond(), 
toTimestamp.getMillisecond());
+                timeIntervalUnit,
+                fromTimestamp.getEpochMillisecond(),
+                timezone,
+                toTimestamp.getMillisecond(),
+                "UTC");
     }
 
-    public static int timestampDiff(
-            String symbol, ZonedTimestampData fromTimestamp, 
LocalZonedTimestampData toTimestamp) {
-        return timestampDiff(
-                symbol, fromTimestamp.getMillisecond(), 
toTimestamp.getEpochMillisecond());
+    public static Integer timestampdiff(
+            String timeIntervalUnit,
+            LocalZonedTimestampData fromTimestamp,
+            TimestampData toTimestamp,
+            String timezone) {
+        return timestampDiff(timeIntervalUnit, fromTimestamp, toTimestamp, 
timezone);
+    }
+
+    public static Integer timestampDiff(

Review Comment:
   nit: Will this method be directly invoked by generated expressions? If not, 
maybe we can mark it `private` and change its name (or move it to 
`DateTimeUtils`) to avoid adding another overloading version into 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]

Reply via email to