@Test
    public void testConcatWsFunction() throws Exception {
        // case 1: concat_ws('-', 'apple', 'banana', 'cloud')
        String transformSql1 = "select concat_ws('-', string1, string2, string3) from source";
        TransformConfig config1 = new TransformConfig(transformSql1);
        TransformProcessor<String, String> processor1 = TransformProcessor
                .create(config1, SourceDecoderFactory.createCsvDecoder(csvSource),
                        SinkEncoderFactory.createKvEncoder(kvSink));
        List<String> output1 = processor1.transform("apple|banana|cloud|extra", new HashMap<>());
        Assert.assertEquals(1, output1.size());
        Assert.assertEquals(output1.get(0), "result=apple-banana-cloud");

        // case 2: concat_ws('-', 'apple', '', 'cloud')
        String transformSql2 = "select concat_ws('-', string1, string2, string3) from source";
        TransformConfig config2 = new TransformConfig(transformSql2);
        TransformProcessor<String, String> processor2 = TransformProcessor
                .create(config2, SourceDecoderFactory.createCsvDecoder(csvSource),
                        SinkEncoderFactory.createKvEncoder(kvSink));
        List<String> output2 = processor2.transform("apple||cloud|extra", new HashMap<>());
        Assert.assertEquals(1, output2.size());
        Assert.assertEquals(output2.get(0), "result=apple--cloud");

        // case 3: concat_ws('-', 'apple', null, 'cloud')
        String transformSql3 = "select concat_ws('-', string1, stringX, string3) from source";
        TransformConfig config3 = new TransformConfig(transformSql3);
        TransformProcessor<String, String> processor3 = TransformProcessor
                .create(config3, SourceDecoderFactory.createCsvDecoder(csvSource),
                        SinkEncoderFactory.createKvEncoder(kvSink));
        List<String> output3 = processor3.transform("apple|banana|cloud|extra", new HashMap<>());
        Assert.assertEquals(1, output3.size());
        Assert.assertEquals(output3.get(0), "result=apple-cloud");

        // case 4: concat_ws(null, 'apple', 'banana', 'cloud')
        String transformSql4 = "select concat_ws(null, string1, string2, string3) from source";
        TransformConfig config4 = new TransformConfig(transformSql4);
        TransformProcessor<String, String> processor4 = TransformProcessor
                .create(config4, SourceDecoderFactory.createCsvDecoder(csvSource),
                        SinkEncoderFactory.createKvEncoder(kvSink));
        List<String> output4 = processor4.transform("apple|null|cloud|extra", new HashMap<>());
        Assert.assertEquals(1, output4.size());
        Assert.assertEquals(output4.get(0), "result=");

        // case 5: concat_ws('-', '', '', '')
        String transformSql5 = "select concat_ws('-', string1, string2, string3) from source";
        TransformConfig config5 = new TransformConfig(transformSql5);
        TransformProcessor<String, String> processor5 = TransformProcessor
                .create(config5, SourceDecoderFactory.createCsvDecoder(csvSource),
                        SinkEncoderFactory.createKvEncoder(kvSink));
        List<String> output5 = processor5.transform("|||", new HashMap<>());
        Assert.assertEquals(1, output5.size());
        Assert.assertEquals(output5.get(0), "result=--");
    }
TestTransformConcatWsFunctionProcessor
description: test the concat_ws function in transform processor
inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/string/TestConcatWsFunction.java