yfsn666 commented on code in PR #10772:
URL: https://github.com/apache/inlong/pull/10772#discussion_r1716276678
##########
inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/TestTransformTemporalFunctionsProcessor.java:
##########
@@ -183,4 +183,37 @@ public void testDateExtractFunction() throws Exception {
Assert.assertEquals(1, output6.size());
Assert.assertEquals(output6.get(0), "result=29");
}
+
+ @Test
+ public void testTimestampExtractFunction() throws Exception {
+ String transformSql1 = "select hour(string1) from source";
+ TransformConfig config1 = new TransformConfig(transformSql1);
+ TransformProcessor<String, String> processor1 = TransformProcessor
+ .create(config1,
SourceDecoderFactory.createCsvDecoder(csvSource),
+ SinkEncoderFactory.createKvEncoder(kvSink));
+ // case1: hour(2024-08-12 12:23:34)
+ List<String> output1 = processor1.transform("2024-08-12 12:23:34", new
HashMap<>());
+ Assert.assertEquals(1, output1.size());
+ Assert.assertEquals(output1.get(0), "result=12");
Review Comment:
the ouput format is kv,the key is "result" and the value is the transformed
value, so the transform result is a string "result=12"
--
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]