emptyOVO commented on code in PR #10904:
URL: https://github.com/apache/inlong/pull/10904#discussion_r1734358519
##########
inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/TestTransformArithmeticFunctionsProcessor.java:
##########
@@ -619,4 +619,33 @@ public void testRandFunction() throws Exception {
Assert.assertTrue(result >= 0.0 && result < 1.0);
}
+ @Test
+ public void testHexFunction() throws Exception {
+ String transformSql1 = "select hex(numeric1) from source";
+ TransformConfig config1 = new TransformConfig(transformSql1);
+ TransformProcessor<String, String> processor1 = TransformProcessor
+ .create(config1,
SourceDecoderFactory.createCsvDecoder(csvSource),
+ SinkEncoderFactory.createKvEncoder(kvSink));
+ // case: hex(1007)
+ List<String> output1 = processor1.transform("1007|4|6|8", new
HashMap<>());
+ Assert.assertEquals(1, output1.size());
+ Assert.assertEquals(output1.get(0), "result=3EF");
+ // case: hex(3.14)
+ List<String> output2 = processor1.transform("3.14|4|6|8", new
HashMap<>());
+ Assert.assertEquals(1, output2.size());
+ Assert.assertEquals(output2.get(0), "result=3");
+ // case: hex(3.141592653589793)
+ List<String> output3 = processor1.transform("3.141592653589793|4|6|8",
new HashMap<>());
+ Assert.assertEquals(1, output3.size());
+ Assert.assertEquals(output3.get(0), "result=3");
+ // case: hex(9223372036854775807)
Review Comment:
done
--
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]