数据湖探索 DLI-string_split:示例
示例
- 准备测试输入数据
表2 测试源表disSource数据和分隔符 target(STRING)
separator (VARCHAR)
test-flink
-
flink
-
one-two-ww-three
-
- 输入测试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 disSinkselect target, itemfrom disSource,lateral table(string_split(target, separator)) as T(item);
- 查看测试结果
表3 disSink结果表数据 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