开发者社区> 问答> 正文

flink sql read hbase sink mysql data type not matc

org.apache.flink.client.program.ProgramInvocationException: The main method caused an error: Field types of query result and registered TableSink default_catalog.default_database.user_age do not match. Query schema: [rowkey: STRING, cf: ROW<age INT>] Sink schema: [rowkey: STRING, age: INT] at org.apache.flink.client.program.PackagedProgram.callMainMethod(PackagedProgram.java:335) at org.apache.flink.client.program.PackagedProgram.invokeInteractiveModeForExecution(PackagedProgram.java:205) at org.apache.flink.client.ClientUtils.executeProgram(ClientUtils.java:138) at org.apache.flink.client.cli.CliFrontend.executeProgram(CliFrontend.java:664) at org.apache.flink.client.cli.CliFrontend.run(CliFrontend.java:213) at org.apache.flink.client.cli.CliFrontend.parseParameters(CliFrontend.java:895) at org.apache.flink.client.cli.CliFrontend.lambda$main$10(CliFrontend.java:968) at java.security.AccessController.doPrivileged(Native Method) at javax.security.auth.Subject.doAs(Subject.java:422) at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1875) at org.apache.flink.runtime.security.HadoopSecurityContext.runSecured(HadoopSecurityContext.java:41) at org.apache.flink.client.cli.CliFrontend.main(CliFrontend.java:968) Caused by: org.apache.flink.table.api.ValidationException: Field types of query result and registered TableSink default_catalog.default_database.user_age do not match.

query:

val users = new HBaseTableSource(hConf, "user_hbase5") users.setRowKey("rowkey", classOf[String]) // currency as the primary key users.addColumn("cf", "age", classOf[Integer])

streamTableEnv.registerTableSource("users", users)

streamTableEnv.sqlUpdate( """ | |CREATE TABLE user_age ( | rowkey VARCHAR, | age INT |) WITH ( | 'connector.type' = 'jdbc', | 'connector.write.flush.max-rows' = '1' |) |""".stripMargin)

streamTableEnv.sqlUpdate( """ | |insert into user_age |SELECT * |FROM | users | |""".stripMargin)

*来自志愿者整理的flink邮件归档

展开
收起
游客nnqbtnagn7h6s 2021-12-06 20:00:53 487 0
0 条回答
写回答
取消 提交回答
问答排行榜
最热
最新

相关电子书

更多
大数据时代的存储 ——HBase的实践与探索 立即下载
Hbase在滴滴出行的应用场景和最佳实践 立即下载
阿里云HBase主备双活 立即下载

相关镜像