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


##########
docs/content/docs/core-concept/transform.md:
##########
@@ -131,18 +131,18 @@ Flink CDC uses [Calcite](https://calcite.apache.org/) to 
parse expressions and [
 
 ## Temporal Functions
 
-| Function             | Janino Code              | Description                
                       |
-| -------------------- | ------------------------ | 
------------------------------------------------- |
-| LOCALTIME | localtime() | Returns the current SQL time in the local time 
zone, the return type is TIME(0). |
-| LOCALTIMESTAMP | localtimestamp() | Returns the current SQL timestamp in 
local time zone, the return type is TIMESTAMP(3). |
-| CURRENT_TIME | currentTime() | Returns the current SQL time in the local 
time zone, this is a synonym of LOCAL_TIME. |
-| CURRENT_DATE                                         | currentDate() | 
Returns the current SQL date in the local time zone. |
-| CURRENT_TIMESTAMP | currentTimestamp() | Returns the current SQL timestamp 
in the local time zone, the return type is TIMESTAMP_LTZ(3). |
-| NOW() | now() | Returns the current SQL timestamp in the local time zone, 
this is a synonym of CURRENT_TIMESTAMP. |
-| DATE_FORMAT(timestamp, string) | dateFormat(timestamp, string) | Converts 
timestamp to a value of string in the format specified by the date format 
string. The format string is compatible with Java's SimpleDateFormat. |
-| TIMESTAMPDIFF(timepointunit, timepoint1, timepoint2) | 
timestampDiff(timepointunit, timepoint1, timepoint2) | Returns the (signed) 
number of timepointunit between timepoint1 and timepoint2. The unit for the 
interval is given by the first argument, which should be one of the following 
values: SECOND, MINUTE, HOUR, DAY, MONTH, or YEAR. |
-| TO_DATE(string1[, string2]) | toDate(string1[, string2]) | Converts a date 
string string1 with format string2 (by default 'yyyy-MM-dd') to a date. |
-| TO_TIMESTAMP(string1[, string2]) | toTimestamp(string1[, string2]) | 
Converts date time string string1 with format string2 (by default: 'yyyy-MM-dd 
HH:mm:ss') to a timestamp, without time zone. |
+| Function                                              | Janino Code          
    | Description                                       |
+|-------------------------------------------------------| 
------------------------ | ------------------------------------------------- |
+| LOCALTIME                                             | localtime() | 
Returns the current SQL time in the local time zone, the return type is 
TIME(0). |
+| LOCALTIMESTAMP                                        | localtimestamp() | 
Returns the current SQL timestamp in local time zone, the return type is 
TIMESTAMP(3). |
+| CURRENT_TIME                                          | currentTime() | 
Returns the current SQL time in the local time zone, this is a synonym of 
LOCAL_TIME. |
+| CURRENT_DATE                                          | currentDate() | 
Returns the current SQL date in the local time zone. |
+| CURRENT_TIMESTAMP                                     | currentTimestamp() | 
Returns the current SQL timestamp in the local time zone, the return type is 
TIMESTAMP_LTZ(3). |
+| NOW()                                                 | now() | Returns the 
current SQL timestamp in the local time zone, this is a synonym of 
CURRENT_TIMESTAMP. |
+| DATE_FORMAT(timestamp, string)                        | 
dateFormat(timestamp, string) | Converts timestamp to a value of string in the 
format specified by the date format string. The format string is compatible 
with Java's SimpleDateFormat. |
+| TIMESTAMP_DIFF(timepointunit, timepoint1, timepoint2) | 
timestampDiff(timepointunit, timepoint1, timepoint2) | Returns the (signed) 
number of timepointunit between timepoint1 and timepoint2. The unit for the 
interval is given by the first argument, which should be one of the following 
values: SECOND, MINUTE, HOUR, DAY, MONTH, or YEAR. |

Review Comment:
   Ditto



##########
flink-cdc-runtime/src/main/java/org/apache/flink/cdc/runtime/functions/SystemFunctionUtils.java:
##########
@@ -645,4 +645,32 @@ private static String castObjectIntoString(Object object) {
         }
         return String.valueOf(object);
     }
+
+    public static boolean greater(Comparable comparable1, Comparable 
comparable2) {

Review Comment:
   To keep consistency with 
[Flink](https://github.com/apache/flink/blob/ed50ae21fc78fa98b015566303f9a80c88278df1/flink-table/flink-table-common/src/main/java/org/apache/flink/table/functions/BuiltInFunctionDefinitions.java#L579)
 and function names, maybe we can use `greaterThan`, `greaterThanOrEqual`, 
`lessThan`, `lessThanOrEqual`?



##########
flink-cdc-runtime/src/test/java/org/apache/flink/cdc/runtime/operators/transform/PostTransformOperatorTest.java:
##########
@@ -1483,6 +1496,107 @@ void testCastErrorTransform() throws Exception {
                 .hasRootCauseMessage("For input string: \"1.0\"");
     }
 
+    @Test
+    void testCompareTransform() throws Exception {
+        PostTransformOperator transform =
+                PostTransformOperator.newBuilder()
+                        .addTransform(
+                                COMPARE_TABLEID.identifier(),
+                                "col1, 2.1 > CAST(1 AS DOUBLE) as 
numerical_equal,"

Review Comment:
   It would be nice if we could construct the test case as follows:
   
   * Create upstream schema containing comparable objects, like `(id INT, c1 
FLOAT, c2 DOUBLE, c3 TIMESTAMP, ...)`
   * Write projection expressions like `id, c1 < 5, c2 > 2.5, c3 <= 
TO_TIMESTAMP('2024-01-01 00:00:00') ...`
   * Post multiple rows into test harness, and checking if results are as 
expected. For example, row `(1, 4, 3.5, 2023-01-01)` should yield `(1, true, 
true, true)` and row `(2, 10, 0, '2024-11-01)` should yield `(2, false, false, 
false)`.



##########
docs/content.zh/docs/core-concept/transform.md:
##########
@@ -131,18 +131,18 @@ Flink CDC uses [Calcite](https://calcite.apache.org/) to 
parse expressions and [
 
 ## Temporal Functions
 
-| Function             | Janino Code              | Description                
                       |
-| -------------------- | ------------------------ | 
------------------------------------------------- |
-| LOCALTIME | localtime() | Returns the current SQL time in the local time 
zone, the return type is TIME(0). |
-| LOCALTIMESTAMP | localtimestamp() | Returns the current SQL timestamp in 
local time zone, the return type is TIMESTAMP(3). |
-| CURRENT_TIME | currentTime() | Returns the current SQL time in the local 
time zone, this is a synonym of LOCAL_TIME. |
-| CURRENT_DATE                                         | currentDate() | 
Returns the current SQL date in the local time zone. |
-| CURRENT_TIMESTAMP | currentTimestamp() | Returns the current SQL timestamp 
in the local time zone, the return type is TIMESTAMP_LTZ(3). |
-| NOW() | now() | Returns the current SQL timestamp in the local time zone, 
this is a synonym of CURRENT_TIMESTAMP. |
-| DATE_FORMAT(timestamp, string) | dateFormat(timestamp, string) | Converts 
timestamp to a value of string in the format specified by the date format 
string. The format string is compatible with Java's SimpleDateFormat. |
-| TIMESTAMPDIFF(timepointunit, timepoint1, timepoint2) | 
timestampDiff(timepointunit, timepoint1, timepoint2) | Returns the (signed) 
number of timepointunit between timepoint1 and timepoint2. The unit for the 
interval is given by the first argument, which should be one of the following 
values: SECOND, MINUTE, HOUR, DAY, MONTH, or YEAR. |
-| TO_DATE(string1[, string2]) | toDate(string1[, string2]) | Converts a date 
string string1 with format string2 (by default 'yyyy-MM-dd') to a date. |
-| TO_TIMESTAMP(string1[, string2]) | toTimestamp(string1[, string2]) | 
Converts date time string string1 with format string2 (by default: 'yyyy-MM-dd 
HH:mm:ss') to a timestamp, without time zone. |
+| Function                                              | Janino Code          
    | Description                                       |
+|-------------------------------------------------------| 
------------------------ | ------------------------------------------------- |
+| LOCALTIME                                             | localtime() | 
Returns the current SQL time in the local time zone, the return type is 
TIME(0). |
+| LOCALTIMESTAMP                                        | localtimestamp() | 
Returns the current SQL timestamp in local time zone, the return type is 
TIMESTAMP(3). |
+| CURRENT_TIME                                          | currentTime() | 
Returns the current SQL time in the local time zone, this is a synonym of 
LOCAL_TIME. |
+| CURRENT_DATE                                          | currentDate() | 
Returns the current SQL date in the local time zone. |
+| CURRENT_TIMESTAMP                                     | currentTimestamp() | 
Returns the current SQL timestamp in the local time zone, the return type is 
TIMESTAMP_LTZ(3). |
+| NOW()                                                 | now() | Returns the 
current SQL timestamp in the local time zone, this is a synonym of 
CURRENT_TIMESTAMP. |
+| DATE_FORMAT(timestamp, string)                        | 
dateFormat(timestamp, string) | Converts timestamp to a value of string in the 
format specified by the date format string. The format string is compatible 
with Java's SimpleDateFormat. |
+| TIMESTAMP_DIFF(timepointunit, timepoint1, timepoint2) | 
timestampDiff(timepointunit, timepoint1, timepoint2) | Returns the (signed) 
number of timepointunit between timepoint1 and timepoint2. The unit for the 
interval is given by the first argument, which should be one of the following 
values: SECOND, MINUTE, HOUR, DAY, MONTH, or YEAR. |

Review Comment:
   Maybe we can leave changes of `TIMESTAMP_DIFF` in FLINK-36647



-- 
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