[
https://issues.apache.org/jira/browse/FLINK-41780?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Sergey Nuyanzin updated FLINK-41780:
------------------------------------
Summary: Map element access fails with ClassCastException for a MapData}}
that is neither {{BinaryMapData}} nor {{GenericMapData}} (was: Map element
access fails with {{ClassCastException}} for a {{MapData}} that is neither
{{BinaryMapData}} nor {{GenericMapData}})
> Map element access fails with ClassCastException for a MapData}} that is
> neither {{BinaryMapData}} nor {{GenericMapData}}
> -------------------------------------------------------------------------------------------------------------------------
>
> Key: FLINK-41780
> URL: https://issues.apache.org/jira/browse/FLINK-41780
> Project: Flink
> Issue Type: Bug
> Components: Table SQL / Runtime
> Reporter: Sergey Nuyanzin
> Assignee: Sergey Nuyanzin
> Priority: Major
>
> {{map['key']}} fails at runtime when the map is a {{MapData}} other than
> {{BinaryMapData}} or {{GenericMapData}}.
> Example: a UDF that returns a {{MapDataContainer}}:
> {code:java}
> public static class WrapMapFunction extends ScalarFunction {
> public @DataTypeHint(value = "MAP<STRING, STRING>", bridgedTo =
> MapData.class) MapData eval() {
> return new MapDataContainer(
> new GenericArrayData(new Object[]
> {StringData.fromString("a")}),
> new GenericArrayData(new Object[]
> {StringData.fromString("x")}));
> }
> }
> {code}
> {code:sql}
> SELECT wrap_map()['a'] FROM t
> {code}
> fails with:
> {noformat}
> java.lang.ClassCastException: class
> org.apache.flink.table.runtime.util.MapDataContainer cannot be cast to class
> org.apache.flink.table.data.GenericMapData
> at StreamExecCalc$15.processElement(Unknown Source)
> {noformat}
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)