[ https://issues.apache.org/jira/browse/FLINK-17466?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17125527#comment-17125527 ]
Jark Wu edited comment on FLINK-17466 at 6/4/20, 7:30 AM: ---------------------------------------------------------- - master (1.12.0): fabe02177cad5eb99193d2d0cc76ab15be7b3b41 - 1.11.0: 9d7dc33f7c05e6b44293e5bae9dff2fac9f647cf - 1.10.2: a412840bc077d471813c84d0387a664fd95dae27 was (Author: jark): - master (1.12.0): fabe02177cad5eb99193d2d0cc76ab15be7b3b41 - 1.11.0: 9d7dc33f7c05e6b44293e5bae9dff2fac9f647cf - 1.10.2: TODO > toRetractStream doesn't work correctly with Pojo conversion class > ----------------------------------------------------------------- > > Key: FLINK-17466 > URL: https://issues.apache.org/jira/browse/FLINK-17466 > Project: Flink > Issue Type: Bug > Components: Table SQL / Planner > Affects Versions: 1.10.0 > Reporter: Gyula Fora > Assignee: Jark Wu > Priority: Critical > Labels: pull-request-available > Fix For: 1.11.0, 1.10.2 > > Attachments: retract-issue.patch > > > The toRetractStream(table, Pojo.class) does not map the query columns > properly to the pojo fields. > This either leads to exceptions due to type incompatibility or simply > incorrect results. > It can be simple reproduced by the following test code: > {code:java} > @Test > public void testRetract() throws Exception { > EnvironmentSettings settings = EnvironmentSettings > .newInstance() > .useBlinkPlanner() > .inStreamingMode() > .build(); > StreamExecutionEnvironment env = > StreamExecutionEnvironment.getExecutionEnvironment(); > StreamTableEnvironment tableEnv = StreamTableEnvironment > .create(StreamExecutionEnvironment.getExecutionEnvironment(), settings); > tableEnv.createTemporaryView("person", env.fromElements(new Person())); > tableEnv.toRetractStream(tableEnv.sqlQuery("select name, age from person"), > Person.class).print(); > tableEnv.execute("Test"); > } > public static class Person { > public String name = "bob"; > public int age = 1; > }{code} > Runtime Error: > {noformat} > java.lang.ClassCastException: org.apache.flink.table.dataformat.BinaryString > cannot be cast to java.lang.Integer{noformat} > Changing the query to "select age,name from person" in this case would > resolve the problem but it also highlights the possible underlying issue. -- This message was sent by Atlassian Jira (v8.3.4#803005)