flink-user-zh mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Benchao Li <libenc...@gmail.com>
Subject Re: ddl array 创建问题求助
Date Fri, 10 Apr 2020 01:46:25 GMT
Hi,

1. format.json-schema不需要写,可以去掉;
2. 此外event_time_line的类型应该是array<row<`count` int, rule_name varchar>>

出发 <573693104@qq.com> 于2020年4月10日周五 上午12:09写道:

> 源数据:
> {
>         "types": "pg",
>         "event_time_line": [{
>                         "count": 24,
>                         "rule_name": "你好24"
>                 },
>                 {
>                         "count": 25,
>                         "rule_name": "逆战好25"
>
>
>                 }
>         ]
> }
>
>
>
> DDL:
>
>
>
>
>
>
> CREATE TABLE sourceTable (
> &nbsp; &nbsp; types varchar,
>         event_time_line ROW (
>                 `rule_name` VARCHAR,
>                 `count` VARCHAR
>         ),
>         proctime AS PROCTIME ()
> ) WITH (
>         'connector.type' = 'kafka',
>         'connector.version' = 'universal',
>         'connector.startup-mode' = 'earliest-offset',
>         'connector.topic' = 'topic_test_1',
>         'connector.properties.zookeeper.connect' = 'localhost:2181',
>         'connector.properties.bootstrap.servers' = 'localhost:9092',
>         'update-mode' = 'append',
>         'format.type' = 'json',
>         'format.derive-schema' = 'true',
>         'format.json-schema' = '{type: "object", properties:&nbsp;
>         {"types":{type:"string"}},{ "event_time_line": {type:"object",
> "properties":&nbsp;
>         {"rule_name": {type: "string"}},
> &nbsp; &nbsp; "count": {"type": "string"}}}}'
> );
>
>
>
> ERROR:
> table field 'event_time_line' does not match with the physical type
> ROW<`rule_name` STRING&gt; of the 'event_time_line' field of the
> TableSource return type.



-- 

Benchao Li
School of Electronics Engineering and Computer Science, Peking University
Tel:+86-15650713730
Email: libenchao@gmail.com; libenchao@pku.edu.cn

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message