使用flink-sql解析debezium采集的mysql timestamp字段报错

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

使用flink-sql解析debezium采集的mysql timestamp字段报错

王 羽凡
flink-sql-client执行建表:

CREATE TABLE source_xxx (
 id INT,
 ctime TIMESTAMP
) WITH (
 'connector' = 'kafka',
 'topic' = 'xxx',
 'properties.bootstrap.servers' = 'localhost:9092',
 'format' = 'debezium-json',
 'scan.startup.mode' = 'earliest-offset',
 'debezium-json.schema-include' = 'false',
 'debezium-json.ignore-parse-errors' = 'false'
);

查询:
select * from source_xxx;
[ERROR] Could not execute SQL statement. Reason:
java.time.format.DateTimeParseException: Text '2018-07-10T23:47:35Z' could
not be parsed at index 10

mysql源表中ctime字段为timestamp类型,增加'debezium-json.timestamp-format.standard' =
'ISO-8601'配置依然报错,结尾多了个Z。
想咨询一下,这块儿是flink-sql和debezium采集的timestamp格式不兼容么?还是我debezium的配置,或者使用的flink-sql类型有问题?
Reply | Threaded
Open this post in threaded view
|

Re:使用flink-sql解析debezium采集的mysql timestamp字段报错

hailongwang
Hi,
  引用 Jark 对邮件列表中另一个相关的问题的回答,详情可查看[1]。
  希望对你有帮助。


[1] http://apache-flink.147419.n8.nabble.com/flink-sql-td8884.html#a8888
Best,
Hailong
在 2020-12-01 10:09:21,"王羽凡" <[hidden email]> 写道:

>flink-sql-client执行建表:
>
>CREATE TABLE source_xxx (
> id INT,
> ctime TIMESTAMP
>) WITH (
> 'connector' = 'kafka',
> 'topic' = 'xxx',
> 'properties.bootstrap.servers' = 'localhost:9092',
> 'format' = 'debezium-json',
> 'scan.startup.mode' = 'earliest-offset',
> 'debezium-json.schema-include' = 'false',
> 'debezium-json.ignore-parse-errors' = 'false'
>);
>
>查询:
>select * from source_xxx;
>[ERROR] Could not execute SQL statement. Reason:
>java.time.format.DateTimeParseException: Text '2018-07-10T23:47:35Z' could
>not be parsed at index 10
>
>mysql源表中ctime字段为timestamp类型,增加'debezium-json.timestamp-format.standard' =
>'ISO-8601'配置依然报错,结尾多了个Z。
>想咨询一下,这块儿是flink-sql和debezium采集的timestamp格式不兼容么?还是我debezium的配置,或者使用的flink-sql类型有问题?