Flinksql insert overwrite 报错 requires that the underlying DynamicTableSink of table

FlinkSQL执行INSERT INTO 时不报错,但是重复执行会产生数据重复的情况:

CREATE TABLE dwd_xxx
(
  id BIGINT,
  name STRING,
  amount DECIMAL(10,2)
 ) WITH (
    'connector' = 'kafka',
    'topic' = 'dwd_xxx',
    'scan.startup.mode' = 'earliest-offset',
    'properties.bootstrap.servers' = 'cdh01:9092',
    'format' = 'changelog-json'
);

在这里插入图片描述

在试图向这张表里做INSERT OVERWRITE时,报错如下:

[INFO] Submitting SQL update statement to the cluster...
[ERROR] Could not execute SQL statement. Reason:
org.apache.flink.table.api.ValidationException: INSERT OVERWRITE requires that the underlying DynamicTableSink of table 'default_catalog.default_database.dwd_school_meal_standard_base' implements the SupportsOverwrite interface.

经查,这个错是因为JDBC connector 不支持INSERT OVERWRITE, 官方文档里列出了目前 Flink SQL
支持的INSERT语法,但是不是所有的 connector 都支持 INSERT OVERWRITE, 目前支持的只有 Filesystem
connector 和 Hive table, 这些表一般不会有主键。其他connector 如 JDBC\ES\HBase 目前不支持 INSERT
OVERWRITE,现在 JDBC\ES\HBase connector都是支持upsert 插入的[1],
就是在connector 表上定义了PK,结果可以按照PK更新,对于DB类的系统应该都是可以满足业务需求的。

详见Flink Mail List:Re: flinksql insert overwrite 报错 INSERT OVERWRITE requires JDBC:MySQL DynamicTableSink to implement SupportsOverwrite interface

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值