
# string_split
string_split函数，根据指定的分隔符将目标字符串拆分为子字符串，并返回子字符串列表。
#### 语法说明
```
string_split(target, separator)
```
表1string_split参数说明 
| 参数        | 数据类型    | 说明                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
|:---|:---|:---|
| target    | STRING  | 待处理的目标字符串。 说明： - 如果target为NULL，则返回一个空行。  - 如果target包含两个或多个连续出现的分隔符时，则返回长度为零的空子字符串。  - 如果target未包含指定分隔符，则返回目标字符串。   |
| separator | VARCHAR | 指定的分隔符，当前仅支持单字符分隔。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
   
#### 示例
1. 准备测试输入数据
   表2测试源表disSource数据和分隔符 
   | target（STRING）   | separator （VARCHAR） |
   |:---|:---|
   | test-flink       | -                   |
   | flink            | -                   |
   | one-two-ww-three | -                   |
      
   
2. 输入测试SQL语句
   ```
   create table disSource(
     target STRING,
     separator  VARCHAR
   ) with (
     "connector.type" = "dis",
     "connector.region" = "xxx",
     "connector.channel" = "ygj-dis-in",
     "format.type" = 'csv'
   );
   create table disSink(
     target STRING,
     item STRING
   ) with (
     'connector.type' = 'dis',
     'connector.region' = 'xxx',
     'connector.channel' = 'ygj-dis-out',
     'format.type' = 'csv'
   );
   insert into
     disSink
   select
     target,
     item
   from
     disSource,
   lateral table(string_split(target, separator)) as T(item);
   ```
   
3. 查看测试结果
   表3disSink结果表数据 
   | target（STRING）   | item（STRING） |
   |:---|:---|
   | test-flink       | test         |
   | test-flink       | flink        |
   | flink            | flink        |
   | one-two-ww-three | one          |
   | one-two-ww-three | two          |
   | one-two-ww-three | ww           |
   | one-two-ww-three | three        |
      
   
 
