Jingsong Lee created FLINK-17681:
------------------------------------
Summary: 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
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)