数据湖探索 DLI-string_split:示例

时间:2023-11-01 16:20:09

示例

  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  disSinkselect  target,  itemfrom  disSource,lateral table(string_split(target, separator)) as T(item);
  3. 查看测试结果
    表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

support.huaweicloud.com/sqlref-flink-dli/dli_08_0356.html