diff --git a/inlong-sdk/transform-sdk/src/main/java/org/apache/inlong/sdk/transform/process/function/ReplicateFunction.java b/inlong-sdk/transform-sdk/src/main/java/org/apache/inlong/sdk/transform/process/function/RepeatFunction.java similarity index 90% rename from inlong-sdk/transform-sdk/src/main/java/org/apache/inlong/sdk/transform/process/function/ReplicateFunction.java rename to inlong-sdk/transform-sdk/src/main/java/org/apache/inlong/sdk/transform/process/function/RepeatFunction.java index 82755a5baaf..6e5261e0f13 100644 --- a/inlong-sdk/transform-sdk/src/main/java/org/apache/inlong/sdk/transform/process/function/ReplicateFunction.java +++ b/inlong-sdk/transform-sdk/src/main/java/org/apache/inlong/sdk/transform/process/function/RepeatFunction.java @@ -27,17 +27,17 @@ import java.util.List; /** - * ReplicateFunction - * description: replicate(string, numeric)--Repeat the string numeric times and return a new string + * RepeatFunction + * description: repeat(string, numeric)--Repeat the string numeric times and return a new string */ -@TransformFunction(names = {"replicate"}) -public class ReplicateFunction implements ValueParser { +@TransformFunction(names = {"repeat"}) +public class RepeatFunction implements ValueParser { private ValueParser stringParser; private ValueParser countParser; - public ReplicateFunction(Function expr) { + public RepeatFunction(Function expr) { List expressions = expr.getParameters().getExpressions(); stringParser = OperatorTools.buildParser(expressions.get(0)); countParser = OperatorTools.buildParser(expressions.get(1)); diff --git a/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/string/TestReplicateFunction.java b/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/string/TestRepeatFunction.java similarity index 89% rename from inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/string/TestReplicateFunction.java rename to inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/string/TestRepeatFunction.java index 9da3f98a6e1..e5f0d2d0fc0 100644 --- a/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/string/TestReplicateFunction.java +++ b/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/string/TestRepeatFunction.java @@ -28,11 +28,11 @@ import java.util.HashMap; import java.util.List; -public class TestReplicateFunction extends AbstractFunctionStringTestBase { +public class TestRepeatFunction extends AbstractFunctionStringTestBase { @Test - public void testReplicateFunction() throws Exception { - String transformSql1 = "select replicate(string1, numeric1) from source"; + public void testRepeatFunction() throws Exception { + String transformSql1 = "select repeat(string1, numeric1) from source"; TransformConfig config1 = new TransformConfig(transformSql1); TransformProcessor processor1 = TransformProcessor .create(config1, SourceDecoderFactory.createCsvDecoder(csvSource), @@ -41,7 +41,7 @@ public void testReplicateFunction() throws Exception { List output1 = processor1.transform("apple|banana|cloud|2|1|3", new HashMap<>()); Assert.assertEquals(1, output1.size()); Assert.assertEquals(output1.get(0), "result=appleapple"); - String transformSql2 = "select replicate(string2, numeric2) from source"; + String transformSql2 = "select repeat(string2, numeric2) from source"; TransformConfig config2 = new TransformConfig(transformSql2); TransformProcessor processor2 = TransformProcessor .create(config2, SourceDecoderFactory.createCsvDecoder(csvSource), @@ -55,7 +55,7 @@ public void testReplicateFunction() throws Exception { Assert.assertEquals(1, output2.size()); Assert.assertEquals(output3.get(0), "result=banana"); // case3: replicate('cloud', 0) - String transformSql3 = "select replicate(string3, numeric3) from source"; + String transformSql3 = "select repeat(string3, numeric3) from source"; TransformConfig config3 = new TransformConfig(transformSql3); TransformProcessor processor3 = TransformProcessor .create(config3, SourceDecoderFactory.createCsvDecoder(csvSource), diff --git a/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/string/TestStringFunctionsProcessor.java b/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/string/TestStringFunctionsProcessor.java index 40447d9a10c..618736697f3 100644 --- a/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/string/TestStringFunctionsProcessor.java +++ b/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/string/TestStringFunctionsProcessor.java @@ -26,7 +26,7 @@ @RunWith(Suite.class) @Suite.SuiteClasses({TestInsertFunction.class, TestLeftFunction.class, TestLengthFunction.class, TestLocateFunction.class, TestLowerFunction.class, TestLpadFunction.class, TestReplaceFunction.class, - TestReplicateFunction.class, TestReverseFunction.class, TestRightFunction.class, TestRpadFunction.class, + TestRepeatFunction.class, TestReverseFunction.class, TestRightFunction.class, TestRpadFunction.class, TestSpaceFunction.class, TestStrcmpFunction.class, TestSubstringFunction.class, TestToBase64Function.class, TestTranslateFunction.class, TestTrimFunction.class, TestUpperFunction.class, TestContainsFunction.class, TestFromBase64Function.class