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

[jira] [Closed] (FLINK-17681) TableEnvironment fromValues not work with map type and SQL

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

Dawid Wysakowicz closed FLINK-17681.
------------------------------------
    Resolution: Fixed

Fixed in 6de4f4a675e37ba7fd34a2c9114400fa2e5d25ad

> TableEnvironment fromValues not work with map type and SQL
> ----------------------------------------------------------
>
>                 Key: FLINK-17681
>                 URL: https://issues.apache.org/jira/browse/FLINK-17681
>             Project: Flink
>          Issue Type: Bug
>          Components: Table SQL / API
>            Reporter: Jingsong Lee
>            Assignee: Dawid Wysakowicz
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.11.0
>
>
> {code:java}
> Map<Integer, Integer> mapData = new HashMap<>();
>       mapData.put(1, 1);
>       mapData.put(2, 2);
>       Row row = Row.of(mapData);
>       tEnv().createTemporaryView("values_t", tEnv().fromValues(Collections.singletonList(row)));
>       Iterator<Row> iter = tEnv().executeSql("select * from values_t").collect();
>       List<Row> results = new ArrayList<>();
>       while (iter.hasNext()) {
>          results.add(iter.next());
>       }
>       System.out.println(results);
> {code}
> Not work, will occur exception:
> {code:java}
> java.lang.AssertionError: Conversion to relational algebra failed to preserve datatypes:
> validated type:
> RecordType((INTEGER NOT NULL, INTEGER NOT NULL) MAP f0) NOT NULL
> converted type:
> RecordType((INTEGER NOT NULL, INTEGER NOT NULL) MAP NOT NULL f0) NOT NULL
> {code}
> If change to {{Iterator<Row> iter = tEnv().from("values_t").execute().collect();}} will work.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)