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


##########
flink-cdc-runtime/src/test/java/org/apache/flink/cdc/runtime/operators/transform/PostTransformOperatorTest.java:
##########
@@ -780,6 +795,76 @@ void testTimestampTransform() throws Exception {
         transformFunctionEventEventOperatorTestHarness.close();
     }
 
+    @Test
+    void testUnixTimestampTransform() throws Exception {
+        PostTransformOperator transform =
+                PostTransformOperator.newBuilder()
+                        .addTransform(
+                                UNIX_TIMESTAMP_TABLEID.identifier(),
+                                "col1, FROM_UNIXTIME(44) as from_unixtime,"
+                                        + " FROM_UNIXTIME(44, 'yyyy/MM/dd 
HH:mm:ss') as from_unixtime_format,"
+                                        + " IF(UNIX_TIMESTAMP() = 
UNIX_TIMESTAMP(DATE_FORMAT(LOCALTIMESTAMP, 'yyyy-MM-dd HH:mm:ss')), 1, 0) as 
current_unix_timestamp,"
+                                        + " UNIX_TIMESTAMP('1970-01-01 
08:00:01') as unix_timestamp,"
+                                        + " UNIX_TIMESTAMP('1970-01-01 
08:00:01.001 +0800', 'yyyy-MM-dd HH:mm:ss.SSS X') as unix_timestamp_format_tz,"
+                                        + " UNIX_TIMESTAMP('1970-01-01 
08:00:01.001 +0800', 'yyyy-MM-dd HH:mm:ss.SSS') as unix_timestamp_format,"
+                                        + " UNIX_TIMESTAMP('1970-01-01 
08:00:01.001', 'yyyy-MM-dd HH:mm:ss.SSS X') as unix_timestamp_format_error",
+                                null)
+                        //                        .addTimezone("UTC")
+                        .addTimezone("Europe/Berlin")
+                        .build();
+        RegularEventOperatorTestHarness<PostTransformOperator, Event>
+                transformFunctionEventEventOperatorTestHarness =
+                        RegularEventOperatorTestHarness.with(transform, 1);
+        // Initialization
+        transformFunctionEventEventOperatorTestHarness.open();
+        // Create table
+        CreateTableEvent createTableEvent =
+                new CreateTableEvent(UNIX_TIMESTAMP_TABLEID, 
UNIX_TIMESTAMP_SCHEMA);
+        BinaryRecordDataGenerator recordDataGenerator =
+                new BinaryRecordDataGenerator(((RowType) 
UNIX_TIMESTAMP_SCHEMA.toRowDataType()));
+        // Insert
+        DataChangeEvent insertEvent =
+                DataChangeEvent.insertEvent(
+                        UNIX_TIMESTAMP_TABLEID,
+                        recordDataGenerator.generate(
+                                new Object[] {
+                                    new BinaryStringData("1"),
+                                    null,
+                                    null,
+                                    null,
+                                    null,
+                                    null,
+                                    null,
+                                    null
+                                }));

Review Comment:
   I wonder what's the point to use the same schema in the source and sink? 
These fields are all `null` in sources anyway, and all test data are 
hard-encoded in transform rules.



-- 
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: issues-unsubscr...@flink.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to