[ https://issues.apache.org/jira/browse/FLINK-14409?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Timo Walther closed FLINK-14409. -------------------------------- Fix Version/s: 1.10.0 Resolution: Fixed Fixed in 1.10.0: 8e81fc265d95f634401269b2acf9a4e80c0c1044 > MapType doesn't accept any subclass of java.util.Map > ---------------------------------------------------- > > Key: FLINK-14409 > URL: https://issues.apache.org/jira/browse/FLINK-14409 > Project: Flink > Issue Type: Bug > Components: Table SQL / API > Reporter: Jark Wu > Assignee: Jark Wu > Priority: Major > Labels: pull-request-available > Fix For: 1.10.0 > > Time Spent: 20m > Remaining Estimate: 0h > > Currently the conversion class of MapType is {{java.util.Map}}, but > {{java.util.Map}} is an interface not a concrete class. So when verifying an > instance of {{HashMap}} for MapType, it fails. > For example: > {code:java} > Map<String, Integer> map = new HashMap<>(); > map.put("key1", 1); > map.put("key2", 2); > map.put("key3", 3); > assertEquals( > "{key1=1, key2=2, key3=3}", > new ValueLiteralExpression( > map, > DataTypes.MAP(DataTypes.STRING(), > DataTypes.INT())) > .toString()); > {code} > throws exception: > {code} > org.apache.flink.table.api.ValidationException: Data type 'MAP<STRING, INT>' > does not support a conversion from class 'java.util.HashMap'. > at > org.apache.flink.table.expressions.ValueLiteralExpression.validateValueDataType(ValueLiteralExpression.java:236) > at > org.apache.flink.table.expressions.ValueLiteralExpression.<init>(ValueLiteralExpression.java:66) > {code} > It's easy to fix this by considering whether it's a subclass of Map. But I'm > wondering what the default conversion class should be? -- This message was sent by Atlassian Jira (v8.3.4#803005)