vernedeng commented on code in PR #10863: URL: https://github.com/apache/inlong/pull/10863#discussion_r1732093057
########## inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/TestTransformStringFunctionsProcessor.java: ########## @@ -200,4 +200,31 @@ public void testToBase64Function() throws Exception { Assert.assertEquals(1, output2.size()); Assert.assertEquals(output2.get(0), "result=aGVsbG8gd29ybGQ="); } + + @Test + public void testTranslateFunction() throws Exception { + String transformSql1 = "select translate(string1, string2, string3) from source"; + TransformConfig config1 = new TransformConfig(transformSql1); + TransformProcessor<String, String> processor1 = TransformProcessor + .create(config1, SourceDecoderFactory.createCsvDecoder(csvSource), + SinkEncoderFactory.createKvEncoder(kvSink)); + // case1: translate("hello word!", "el", "EL") + List<String> output1 = processor1.transform("hello word!|el|EL|2|1|3", new HashMap<>()); + Assert.assertEquals(1, output1.size()); + Assert.assertEquals(output1.get(0), "result=hELLo word!"); + String transformSql2 = "select translate(string3, string1, string2) from source"; + TransformConfig config2 = new TransformConfig(transformSql2); + TransformProcessor<String, String> processor2 = TransformProcessor + .create(config2, SourceDecoderFactory.createCsvDecoder(csvSource), + SinkEncoderFactory.createKvEncoder(kvSink)); + // case2: translate("hello word!", "el", "EL") + List<String> output2 = processor2.transform("el|EL|hello word!|1|1|3", new HashMap<>()); Review Comment: it seems like translate(string3, string1, string2) instead of translate(string1, string2, string3) -- 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: commits-unsubscr...@inlong.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org