string_split
The string_split function splits a target string into substrings based on the specified separator and returns a substring list.
Description
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. |
Example
- Prepare test input data.
Table 2 Source table disSource target (STRING)
separator (VARCHAR)
test-flink
-
flink
-
one-two-ww-three
-
- Write test SQL statements.
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);
- Check test results.
Table 3 disSink result table 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
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot