意图:通过jdbc访问gateway,做一个mysql表写入的测试。通过jdbc-driver创建mysql表成功,但执行写入数据时失败。SQL-gateway采用默认配置。但语句直接在sqlclient中执行可以成功。想请教一下,是定义不正确?还是环境配置不正确。正常来说不是应该默认使用tablesink吗?错误提示如下:Caused by: org.apache.flink.table.api.TableException: RetractStreamTableSink and UpsertStreamTableSink is not supported in Batch environment. at org.apache.flink.table.planner.plan.nodes.physical.batch.BatchExecSink.translateToPlanInternal(BatchExecSink.scala:85) at org.apache.flink.table.planner.plan.nodes.physical.batch.BatchExecSink.translateToPlanInternal(BatchExecSink.scala:48) at org.apache.flink.table.planner.plan.nodes.exec.ExecNode$class.translateToPlan(ExecNode.scala:58) at org.apache.flink.table.planner.plan.nodes.physical.batch.BatchExecSink.translateToPlan(BatchExecSink.scala:48) at org.apache.flink.table.planner.delegation.BatchPlanner$$anonfun$translateToPlan$1.apply(BatchPlanner.scala:69) at org.apache.flink.table.planner.delegation.BatchPlanner$$anonfun$translateToPlan$1.apply(BatchPlanner.scala:68)
源代码如下:Connection connection = DriverManager.getConnection("jdbc:flink://dataflow1:8083?planner=blink");
Statement statement = connection.createStatement();
sql = "CREATE TABLE t_user_target (\n" +
" id BIGINT,\n" +
" username VARCHAR\n" +
") WITH (\n" +
" 'connector.type' = 'jdbc',\n" +
" 'connector.driver' = 'com.mysql.jdbc.Driver',\n" +
" 'connector.url' = 'jdbc:mysql://172.18.100.85:3306/targetdb',\n" +
" 'connector.table' = 't1target',\n" +
" 'connector.username' = 'root',\n" +
" 'connector.password' = 'root',\n" +
" 'connector.write.flush.max-rows' = '5000'\n" +
");";
statement.executeUpdate(sql);
statement.execute("insert into t_user_target values(1,'fan'),(2,'ss')");*来自志愿者整理的flink邮件归档
当前 batch 模式还不支持 UpsertTableSink,不过已经有 PR 在支持中了: https://issues.apache.org/jira/browse/FLINK-15579*来自志愿者整理的FLINK邮件归档
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。