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) |
Hi,
上面的错误提示已经比较明确了,说的是你的query的schema跟sink table的schema对不上。 query的schema是:[rowkey: STRING, cf: ROW<`age` INT>] 而sink的schema是:[rowkey: STRING, age: INT] 你可以调整一下你的sink的schema;或者调整一下你的query语句。 Zhou Zach <[hidden email]> 于2020年6月16日周二 下午5:51写道: > > > 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) |
Free forum by Nabble | Edit this page |