aloyszhang commented on code in PR #10615:
URL: https://github.com/apache/inlong/pull/10615#discussion_r1675492494
##########
inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/TestTransformArithmeticFunctionsProcessor.java:
##########
@@ -117,4 +117,72 @@ public void testLnFunction() throws Exception {
Assert.assertTrue(output2.size() == 1);
Assert.assertEquals(output2.get(0), "result=2.302585092994046");
}
+
+ @Test
+ public void testLog10Function() throws Exception {
+ String transformSql = "select log10(numeric1) from source";
+ TransformConfig config = new TransformConfig(csvSource, kvSink,
transformSql);
+ // case1: log10(1)
+ TransformProcessor processor = new TransformProcessor(config);
+ List<String> output1 = processor.transform("1|4|6|8", new HashMap<>());
+ Assert.assertTrue(output1.size() == 1);
+ Assert.assertEquals(output1.get(0), "result=0.0");
+ // case2: log10(1000)
+ List<String> output2 = processor.transform("1000|4|6|8", new
HashMap<>());
+ Assert.assertTrue(output2.size() == 1);
+ Assert.assertEquals(output2.get(0), "result=3.0");
+ }
+
+ @Test
+ public void testLog2Function() throws Exception {
+ String transformSql = "select log2(numeric1) from source";
+ TransformConfig config = new TransformConfig(csvSource, kvSink,
transformSql);
+ // case1: log2(1)
+ TransformProcessor processor = new TransformProcessor(config);
+ List<String> output1 = processor.transform("1|4|6|8", new HashMap<>());
+ Assert.assertTrue(output1.size() == 1);
+ Assert.assertEquals(output1.get(0), "result=0.0");
+ // case2: log2(32)
+ List<String> output2 = processor.transform("32|4|6|8", new
HashMap<>());
+ Assert.assertTrue(output2.size() == 1);
+ Assert.assertEquals(output2.get(0), "result=5.0");
+ }
+
+ @Test
+ public void testLogFunction() throws Exception {
+ String transformSql1 = "select log(numeric1) from source";
+ TransformConfig config1 = new TransformConfig(csvSource, kvSink,
transformSql1);
+ // case1: ln(1)
+ TransformProcessor processor1 = new TransformProcessor(config1);
+ List<String> output1 = processor1.transform("1|4|6|8", new
HashMap<>());
+ Assert.assertTrue(output1.size() == 1);
Review Comment:
```suggestion
Assert.assertEquals(1, output1.size());
```
--
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]