The string_split function splits a target string into substrings based on the specified separator and returns a substring list.
string_split(target, separator)
Parameter |
Type |
Description |
---|---|---|
target |
STRING |
Target string to be processed NOTE:
|
separator |
VARCHAR |
Delimiter. Currently, only single-character delimiters are supported. |
target (STRING) |
separator (VARCHAR) |
---|---|
test-flink |
- |
flink |
- |
one-two-ww-three |
- |
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);
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 |