@Test
    public void testSplitIndexFunction() throws Exception {
        EnvironmentSettings settings = EnvironmentSettings
                .newInstance()
                .inStreamingMode()
                .build();
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
        env.setParallelism(1);
        env.enableCheckpointing(10000);
        StreamTableEnvironment tableEnv = StreamTableEnvironment.create(env, settings);
        List<Row> data = new ArrayList<>();
        data.add(Row.of("2022-05-01"));
        TypeInformation<?>[] types = {
                BasicTypeInfo.STRING_TYPE_INFO};
        String[] names = {"f1"};
        RowTypeInfo typeInfo = new RowTypeInfo(types, names);
        SplitIndexFunction splitIndexFunction = new SplitIndexFunction(new FieldInfo("f1",
                new StringFormatInfo()), new StringConstantParam("-"), new ConstantParam(0));
        DataStream<Row> dataStream = env.fromCollection(data).returns(typeInfo);
        Table tempView = tableEnv.fromDataStream(dataStream).as("f1");
        tableEnv.createTemporaryView("temp_view", tempView);
        String sqlQuery = String.format("SELECT %s as f1 FROM temp_view", splitIndexFunction.format());
        Table outputTable = tableEnv.sqlQuery(sqlQuery);
        DataStream<Row> resultSet = tableEnv.toAppendStream(outputTable, Row.class);
        List<String> result = new ArrayList<>();
        for (CloseableIterator<String> it = resultSet.map(s -> s.getField(0).toString()).executeAndCollect(); it
                .hasNext();) {
            String ss = it.next();
            result.add(ss);
        }
        String expect = "2022";
        Assert.assertEquals(expect, result.get(0));
    }
Test SplitIndexFunction

@throws Exception The exception that may throws when test SplitIndexFunction
inlong-sort/sort-core/src/test/java/org/apache/inlong/sort/function/SplitIndexFunctionTest.java