You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Jark Wu (Jira)" <ji...@apache.org> on 2020/05/01 14:05:00 UTC

[jira] [Updated] (FLINK-17466) toRetractStream doesn't work correctly with Pojo conversion class

     [ https://issues.apache.org/jira/browse/FLINK-17466?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jark Wu updated FLINK-17466:
----------------------------
    Fix Version/s: 1.10.2
                   1.11.0

> 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
>            Priority: Critical
>             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)