Flink cdc mysql 字段是datetime类型时0000-00-00 00:00:00会被flink转成1970-01-01T00:00

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

Flink cdc mysql 字段是datetime类型时0000-00-00 00:00:00会被flink转成1970-01-01T00:00

丁浩浩
当我mysql字段时datetime并且字段值是0000-00-00 00:00:00时,会被转成1970-01-01T00:00,如果我应该如何操作才能保证跟原数值保持一致?
输出的结果:
2> (true,1,zhangsan,18,1970-01-01T00:00)
3> (true,2,lisi,20,2020-11-11T14:17:46)
4> (true,3,wangwu,99,1970-01-01T00:00)
1> (true,4,zhaoliu,77,1970-01-01T00:00)
日志信息:
2020-11-11 14:30:37,418 - 19755 WARN  [debezium-mysqlconnector-mysql_binlog_source-snapshot] io.debezium.connector.mysql.MySqlValueConverters:852  - Invalid value '0000-00-00 00:00:00' stored in column 'rigist_time' of table 'test.boos' converted to empty value
2020-11-11 14:30:37,424 - 19761 WARN  [debezium-mysqlconnector-mysql_binlog_source-snapshot] io.debezium.connector.mysql.MySqlValueConverters:852  - Invalid value '0000-00-00 00:00:00' stored in column 'rigist_time' of table 'test.boos' converted to empty value
2020-11-11 14:30:37,424 - 19761 WARN  [debezium-mysqlconnector-mysql_binlog_source-snapshot] io.debezium.connector.mysql.MySqlValueConverters:852  - Invalid value '0000-00-00 00:00:00' stored in column 'rigist_time' of table 'test.boos' converted to empty value


Reply | Threaded
Open this post in threaded view
|

Re: Flink cdc mysql 字段是datetime类型时0000-00-00 00:00:00会被flink转成1970-01-01T00:00

Jark
Administrator
写个 UDF 再把 1970-01-01T00:00 转回去?

On Wed, 11 Nov 2020 at 14:38, 丁浩浩 <[hidden email]> wrote:

> 当我mysql字段时datetime并且字段值是0000-00-00
> 00:00:00时,会被转成1970-01-01T00:00,如果我应该如何操作才能保证跟原数值保持一致?
> 输出的结果:
> 2> (true,1,zhangsan,18,1970-01-01T00:00)
> 3> (true,2,lisi,20,2020-11-11T14:17:46)
> 4> (true,3,wangwu,99,1970-01-01T00:00)
> 1> (true,4,zhaoliu,77,1970-01-01T00:00)
> 日志信息:
> 2020-11-11 14:30:37,418 - 19755 WARN
> [debezium-mysqlconnector-mysql_binlog_source-snapshot]
> io.debezium.connector.mysql.MySqlValueConverters:852  - Invalid value
> '0000-00-00 00:00:00' stored in column 'rigist_time' of table 'test.boos'
> converted to empty value
> 2020-11-11 14:30:37,424 - 19761 WARN
> [debezium-mysqlconnector-mysql_binlog_source-snapshot]
> io.debezium.connector.mysql.MySqlValueConverters:852  - Invalid value
> '0000-00-00 00:00:00' stored in column 'rigist_time' of table 'test.boos'
> converted to empty value
> 2020-11-11 14:30:37,424 - 19761 WARN
> [debezium-mysqlconnector-mysql_binlog_source-snapshot]
> io.debezium.connector.mysql.MySqlValueConverters:852  - Invalid value
> '0000-00-00 00:00:00' stored in column 'rigist_time' of table 'test.boos'
> converted to empty value
>
>
>
Reply | Threaded
Open this post in threaded view
|

回复: Flink cdc mysql 字段是datetime类型时0000-00-00 00:00:00会被flink转成1970-01-01T00:00

史 正超
In reply to this post by 丁浩浩
在flink sql 中用STRING表示datetime,这样的话后续的可操作性会比较大些。
________________________________
发件人: 丁浩浩 <[hidden email]>
发送时间: 2020年11月11日 6:37
收件人: [hidden email] <[hidden email]>
主题: Flink cdc mysql 字段是datetime类型时0000-00-00 00:00:00会被flink转成1970-01-01T00:00

当我mysql字段时datetime并且字段值是0000-00-00 00:00:00时,会被转成1970-01-01T00:00,如果我应该如何操作才能保证跟原数值保持一致?
输出的结果:
2> (true,1,zhangsan,18,1970-01-01T00:00)
3> (true,2,lisi,20,2020-11-11T14:17:46)
4> (true,3,wangwu,99,1970-01-01T00:00)
1> (true,4,zhaoliu,77,1970-01-01T00:00)
日志信息:
2020-11-11 14:30:37,418 - 19755 WARN  [debezium-mysqlconnector-mysql_binlog_source-snapshot] io.debezium.connector.mysql.MySqlValueConverters:852  - Invalid value '0000-00-00 00:00:00' stored in column 'rigist_time' of table 'test.boos' converted to empty value
2020-11-11 14:30:37,424 - 19761 WARN  [debezium-mysqlconnector-mysql_binlog_source-snapshot] io.debezium.connector.mysql.MySqlValueConverters:852  - Invalid value '0000-00-00 00:00:00' stored in column 'rigist_time' of table 'test.boos' converted to empty value
2020-11-11 14:30:37,424 - 19761 WARN  [debezium-mysqlconnector-mysql_binlog_source-snapshot] io.debezium.connector.mysql.MySqlValueConverters:852  - Invalid value '0000-00-00 00:00:00' stored in column 'rigist_time' of table 'test.boos' converted to empty value