Details
-
Bug
-
Status: Closed
-
Critical
-
Resolution: Fixed
-
1.10.0
Description
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:
@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; }
Runtime Error:
java.lang.ClassCastException: org.apache.flink.table.dataformat.BinaryString cannot be cast to java.lang.Integer
Changing the query to "select age,name from person" in this case would resolve the problem but it also highlights the possible underlying issue.
Attachments
Attachments
Issue Links
- links to